A GEOMETRIC DISCOVERY

The Sum of the Squares of the First n Integers

Introduction

In beginning calculus it is common to show how to evaluate #ºıx¤dx directly from the definition of the definite integral by using the formula [n(n+1)(2n+1)]/6 for the sum of the squares of the first n integers, 1¤+2¤+3¤+...+n¤.  In most texts this formula is presented without consideration of its genesis.  The formula is usually proved using mathematical induction, but induction really does little to explain how the formula was discovered in the first place; in fact, students often object that there is a certain "circularity" to the process since they are being asked to prove something that they have no real reason to predict might be true. This project shows that there is a simple geometric technique for demonstrating the origin of the formula.  This technique can even be used by pre-algebra students to find the sum of the first n squares for any particular n even if they have not yet learned to use a variable.  For students who do understand variables, working with the this technique and Mathematica can provide a nice exercise in algebraic identities.

The Basic Geometric Model of the Sum

Mathematica can display a three dimensional model of the sum 1¤+2¤+3¤+4¤ using unit cubes.

Clear[cL]

cL = Graphics3D[
		{Text[FontForm[
		"SumSquares",
		{"Chicago",10}],{2.5,4,2}],
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,0,3-k},{j,0,3-k}],{k,0,3}],2]]}];

Show[cL,Boxed->False,
		Lighting->False,
		ViewPoint->{1.300, -2.400, 2.000}];

The top cube in the figure "SumSquares" represents 1¤, the next layer of four cubes represents 2¤, the third layer of nine cubes represents 3¤, and the bottom layer of sixteen cubes represents 4¤.

The Sum Embedded in a Cube

A cube 5 units on an edge can be thought of as the sum of three of these "pyramid" models of the basic sum together with several other unit cubes which serve to separate the three "pyramids" and complete the larger cube.  The figure "BigCube" shows the three basic sum "pyramids" in light gray in the lower rear left, the lower rear right, and the top front corners.  The darker unit cubes separate the three basic sum "pyramids."

Clear[c1,c2,c3,c4,c5,c6,c7]

c1 = Graphics3D[{GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,3-i}],{j,0,3-i}],{i,0,3}],2]]}];

c2 = Graphics3D[{
		Text[FontForm["BigCube",{"Chicago",10}],{7,2,0}],
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,j-1}],{i,5-j,4}],{j,1,4}],2]]}];

c3 = Graphics3D[{GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,0,k-1}],{k,1,4}],2]]}];

c4 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,3-k+1,3-k+1},{j,0,k-1}],{k,1,4}],2]]}];

c5 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,k,k}],{k,1,4}],2]]}];

c6 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,0,3-i},{j,4-i,4-i}],{i,0,3}],2]]}];

c7 = Graphics3D[{GrayLevel[0.25],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,4-i,4-i},{j,4-i,4-i}],{i,0,4}],2]]}];

Show[c3,c1,c2,c4,c5,c6,c7,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, 1.300}];

View of the Three Basic Sum "Pyramids."

The figure "3Pyramids" shows the three basic sum pyramids moved apart slightly and without the separating unit cubes.

Clear[c1L,c2L,c3L,c4L];

c1L = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,3-i}],{j,0,3-i}],{i,0,3}],2]]}];

c2L = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,j-1}],{i,5-j,4}],{j,1,4}],2]]}];

c3L = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,0,k-1}],{k,1,4}],2]]}];

c4L = Graphics3D[
		Text[FontForm[
		"3Pyramids",
		{"Chicago",10}],{5,5,0}]];

Clear[pc1L,pc2L,pc3L,pc4L]

pc1L = Show[c1L,Boxed->False,
		Lighting->False,
		ViewPoint->{2.500, -1.500, 2.500},
		DisplayFunction->Identity];

pc2L = Show[c2L,Boxed->False,
		Lighting->False,
		ViewPoint->{1.500, -2.500, 2.500},
		DisplayFunction->Identity];

pc3L = Show[c3L,Boxed->False,
		Lighting->False,
		ViewPoint->{1.500, -1.500, 1.300},
		DisplayFunction->Identity];

pc4L = Show[c4L,Boxed->False,
		Lighting->False,
		ViewPoint->{1.500, -1.500, 1.300},
		DisplayFunction->Identity];

Show[Graphics[{
			Rectangle[Scaled[{0,0}],Scaled[{.66,.66}],pc1L],
			Rectangle[Scaled[{.34,0}],Scaled[{1,.66}],pc2L],
			Rectangle[Scaled[{.17,.34}],Scaled[{.83,1}],pc3L],
			Rectangle[Scaled[{.25,0}],Scaled[{.75,.5}],pc4L]}],
			DisplayFunction->$DisplayFunction];

View of the Three Basic Sum "Pyramids" with the Separating Cubes

The figure "3SeparatedPyramids" shows the three basic sum "pyramids" in light gray and the separating unit cubes in medium and dark gray.

Clear[c1,c2,c3,c4,c5,c6,c7,c8]

c1 = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,
		Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,3-i}],{j,0,3-i}],{i,0,3}],
		2]]}];

c2 = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,j-1}],{i,5-j,4}],{j,1,4}],2]]}];

c3 = Graphics3D[{Text[FontForm[
		"3SeparatedPyramids",
		{"Chicago",10}],{5,0,6}],
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,0,k-1}],{k,1,4}],2]]}];

c4 = Graphics3D[{
		GrayLevel[0.5],Map[Cuboid,
		Flatten[
		Table[
		Table[{i,j,k},{i,3-k+1,3-k+1},{j,0,k-1}],{k,1,4}],
		2]]}];

c5 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,k,k}],{k,1,4}],
		2]]}];

c6 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,0,3-i},{j,4-i,4-i}],{i,0,3}],
		2]]}];

c7 = Graphics3D[{GrayLevel[.25],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,4-i,4-i},{j,4-i,4-i}],{i,0,4}],
		2]]}];

p41 = Show[c1,
		Lighting->False,
		Boxed->False,
		ViewPoint->{2.500, -1.500, 1.300},
		DisplayFunction->Identity];

p42 = Show[c2,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -2.500, 1.300},
		DisplayFunction->Identity];

p43 = Show[c3,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, -1.400},
		DisplayFunction->Identity];

p44 = Show[c4,c5,c6,c7,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, 1.300},
		DisplayFunction->Identity];

Show[Graphics[{
			Rectangle[Scaled[{0,0}],Scaled[{.5,.5}],p41],
			Rectangle[Scaled[{.5,0}],Scaled[{1,.5}],p42],
			Rectangle[Scaled[{.25,.55}],Scaled[{.75,1}],p43],
			Rectangle[Scaled[{.25,.12}],Scaled[{.75,.62}],p44]
			}],
			DisplayFunction->$DisplayFunction];

Completely Separated

The figure "AllSeparated" shows the 3 basic sum "pyramids" in light gray, the unit cubes which are the interfaces separating two "pyramids" in medium gray, and the main diagonal of 5 unit cubes in dark gray.

Clear[c1,c2,c3,c4,c5,c6,c7]

c1 = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,
		Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,3-i}],{j,0,3-i}],{i,0,3}],
		2]]}];

c2 = Graphics3D[{
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,j-1}],{i,5-j,4}],{j,1,4}],2]]}];

c3 = Graphics3D[{Text[FontForm[
		"AllSeparated",
		{"Chicago",10}],{5,0,6}],
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,0,k-1}],{k,1,4}],2]]}];

c4 = Graphics3D[{
		GrayLevel[0.5],Map[Cuboid,
		Flatten[
		Table[
		Table[{i,j,k},{i,3-k+1,3-k+1},{j,0,k-1}],{k,1,4}],
		2]]}];

c5 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,k,k}],{k,1,4}],
		2]]}];

c6 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,0,3-i},{j,4-i,4-i}],{i,0,4}],
		2]]}];

c7 = Graphics3D[{GrayLevel[.25],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,4-i,4-i},{j,4-i,4-i}],{i,0,4}],
		2]]}];

Clear[p71,p72,p73,p74,p75,p76,p77]

p71 = Show[c1,
		Lighting->False,
		Boxed->False,
		ViewPoint->{2.500, -1.500, 1.300},
		DisplayFunction->Identity];

p72 = Show[c2,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -2.500, 1.300},
		DisplayFunction->Identity];

p73 = Show[c3,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, -1.400},
		DisplayFunction->Identity];

p74 = Show[c4,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, 1.300},
		DisplayFunction->Identity];

p75 = Show[c5,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, 1.300},
		DisplayFunction->Identity];

p76 = Show[c6,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -2.500, 1.300},
		DisplayFunction->Identity];

p77 = Show[c7,
		Lighting->False,
		Boxed->False,
		ViewPoint->{2.500, -1.500, 1.300},
		DisplayFunction->Identity];

Show[Graphics[{
			Rectangle[Scaled[{0,0}],Scaled[{.5,.5}],p71],
			Rectangle[Scaled[{.5,0}],Scaled[{1,.5}],p72],
			Rectangle[Scaled[{.25,.55}],Scaled[{.75,1}],p73],
			Rectangle[Scaled[{0,.5}],Scaled[{.5,1}],p74],
			Rectangle[Scaled[{.5,.5}],Scaled[{1,1}],p75],
			Rectangle[Scaled[{.35,0}],Scaled[{.85,.4}],p76],
			Rectangle[Scaled[{.15,0}],Scaled[{.65,.5}],p77]
			}],
			DisplayFunction->$DisplayFunction];

Begin Reassembling the Cube

The figure "ReJoin(1)" shows some parts of the cube reassembled.  The basic sum "pyramids" from the lower rear left and right are shown in light gray, the three sheets of cubes that separate the basic sum "pyramids" are in medium gray, and the five cubes of the main diagonal are in dark gray.  The top front "pyramid" is not shown.

Clear[c1,c2,c3,c4,c5,c6,c7]

c1 = Graphics3D[{
		
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,3-i}],{j,0,3-i}],{i,0,3}],2]]}];

c4 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
Table[
Table[{i,j,k},{i,3-k+1,3-k+1},{j,0,k-1}],{k,1,4}],2]]}];

c2 = Graphics3D[{
			GrayLevel[0.8],Map[Cuboid,Flatten[
			Table[
			Table[
			Table[{i,j,k},{k,0,j-1}],{i,5-j,4}],{j,1,4}],2]]}];

c5 = Graphics3D[{
			GrayLevel[0.5],Map[Cuboid,Flatten[
			Table[
			Table[{i,j,k},{i,5-k,4},{j,k,k}],{k,1,4}],2]]}];

c6 = Graphics3D[{
		Text[FontForm[
		"ReJoin(1)",{"Chicago",10}],{1,0,0}],
		GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,0,3-i},{j,4-i,4-i}],{i,0,3}],2]]}];

c7 = Graphics3D[{GrayLevel[0.25],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,4-i,4-i},{j,4-i,4-i}],{i,0,4}],2]]}];

Clear[r1,r2,r3]

r1 = Show[c1,c4,
			ViewPoint->{2.500, -1.500, 2.500},
			Lighting->False,
			Boxed->False,
			DisplayFunction->Identity];

r2 = Show[c2,c5,
		ViewPoint->{1.500, -2.500, 2.500},
		Lighting->False,
		Boxed->False,
		DisplayFunction->Identity];

r3 = Show[c6,c7,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.300, -2.400, 2.000},
			DisplayFunction->Identity];

Show[Graphics[{
			Rectangle[Scaled[{0,.25}],Scaled[{.5,.75}],r1],
			Rectangle[Scaled[{.5,.25}],Scaled[{1,.75}],r2],
			Rectangle[Scaled[{.25,.25}],Scaled[{.75,.75}],r3]
			}],
			DisplayFunction->$DisplayFunction];

Continue Reassembling the Cube

The figure "ReJoin(2)" shows all of the parts of the cube reassembled except for the top front "pyramid."

Clear[c1,c2,c3,c4,c5,c6,c7]

c1 = Graphics3D[{GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,3-i}],{j,0,3-i}],{i,0,3}],2]]}];

c2 = Graphics3D[{
		Text[FontForm["Rejoin(2)",{"Chicago",10}],{7,2,0}],
		GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[
		Table[{i,j,k},{k,0,j-1}],{i,5-j,4}],{j,1,4}],2]]}];

c3 = Graphics3D[{GrayLevel[0.8],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,0,k-1}],{k,1,4}],2]]}];

c4 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,3-k+1,3-k+1},{j,0,k-1}],{k,1,4}],2]]}];

c5 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{i,5-k,4},{j,k,k}],{k,1,4}],2]]}];

c6 = Graphics3D[{GrayLevel[0.5],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,0,3-i},{j,4-i,4-i}],{i,0,3}],2]]}];

c7 = Graphics3D[{GrayLevel[0.25],Map[Cuboid,Flatten[
		Table[
		Table[{i,j,k},{k,4-i,4-i},{j,4-i,4-i}],{i,0,4}],2]]}];

Show[c1,c2,c4,c5,c6,c7,
		Lighting->False,
		Boxed->False,
		ViewPoint->{1.500, -1.500, 1.300}];

The Cube Revisited

Another look at the figure "BigCube" shows all three of the basic sum pyramids and the separating unit cubes reassembled.

Finding the Sum 1¤+2¤+3¤+...+n¤

Now let's consider how the geometric model leads to the formula for the sum of the first n squares (1¤+2¤+3¤+...+n¤). 
	Each of the three light-gray basic sum "pyramids" represents the sum 1¤+2¤+3¤+4¤.  The three medium-gray sheets that separate the three basic sum "pyramids" each represent the sum 1+2+3+4.

Small Digression

Students studying sums like 1¤+2¤+3¤+4¤ are probably already familiar with sums like 1+2+3+4, but, if not, the the figure "IntegerSum," provides a simple two-dimensional analogue to our three-dimensional technique.  Clearly 1+2+3+4 is [(5)(5) - 5]/2, which easily generalizes to 1+2+3+...+n = 
[(n+1)(n+1) - (n+1)]/2.

Clear[s1,s2,s3,s4]

s1=Graphics[
{Line[{{0,0},{5,0}}],Line[{{0,1},{4,1}}],
Line[{{0,2},{3,2}}],Line[{{0,3},{2,3}}],
Line[{{0,4},{1,4}}],
Line[{{0,0},{0,5}}],Line[{{1,0},{1,4}}],
Line[{{2,0},{2,3}}],Line[{{3,0},{3,2}}],
Line[{{4,0},{4,1}}]}];

s2=Graphics[{GrayLevel[.25],
Rectangle[{0,4},{1,5}],
Rectangle[{1,3},{2,4}],
Rectangle[{2,2},{3,3}],
Rectangle[{3,1},{4,2}],
Rectangle[{4,0},{5,1}]}];

s3=Graphics[
{Line[{{0,5},{5,5}}],Line[{{0,4},{5,4}}],
Line[{{2,3},{5,3}}],Line[{{3,2},{5,2}}],
Line[{{4,1},{5,1}}],
Line[{{1,4},{1,5}}],Line[{{2,3},{2,5}}],
Line[{{3,2},{3,5}}],Line[{{4,0},{4,5}}],
Line[{{5,0},{5,5}}]}];

s4=Graphics[Text[FontForm[
				"IntegerSum",{"Chicago",10}],
				{2.5,5.3}]];

Show[s1,s2,s3,s4,AspectRatio->Automatic];

Notice that Mathematica can easily convert 
[(n+1)(n+1) - (n+1)]/2 to more familiar forms:

Simplify[((n+1)(n+1)-(n+1))/2]

or

Factor[%]

End Small Digression

Finding the Sum 1¤+2¤+3¤+...+n¤, the Legend Continues

Anyway, the entire "BigCube" is made up of three light-gray basic sum "pyramids," three "1+2+3+4" medium-gray separating sheets, and one "1+1+1+1+1 = 5" dark-gray main diagonal.  Therefore 1¤+2¤+3¤+4¤ is í£∕ of [5‹ - 3(í›í”í™ﬁí’) - 5].  Again, this easily generalizes to 1¤+2¤+3¤+...+n¤ = 
í£∕[(n+1)‹ - 3(íˆí”íˆí™±í∕í’) - (n+1)].  Let's see if Mathematica can make this formula look more familiar:

Simplify[((n+1)^3-3(n(n+1)/2)-(n+1))/3]

Together[%]

Factor[%]

There you go; the old familiar  1¤+2¤+3¤+...+n¤ = íˆí”íˆí±í∕í§’í”í¤íˆí±í∕í’.

Q.E.D.

[Which is an abbreviation for the semi-irrelevant (but pleasingly pretentious) Latin phrase "Quod erat demonstrandum," or "That which was to be demonstrated."]

[I did not make that up.]