Explain 13 + 23 + 33 + ... + n3 = (1 + 2 + 3 + ... + n)2

Area of the small squares

The width of the smaller squares along the diagonal (top right to bottom left) is the number of itself. For examples the first square has the width of 1, the second square has the width of 2. Which means the area of the small square is (it's number)2

Area of the large square

The perimeter of the large square equals the sum of smaller squares' perimeter along the diagonal. Because the large square's length of each side is the combine of the small square's side length.

the label on the smaller squares along the diagonal is their width

which really means that the area of the larger square is (1 + 2 + ... + n)2

Now take a look again at the smaller squares and the top and left part (darker color than the diagonal squares) to it.

Look at the area of the darker part and the lighter part, do you find the relationship between them?

The first square has the area of one with 0 darker area that on it's left and top. The second square has the area of 4, and the nearby darker area is also 4. The third square has the area of 9, and the nearby darker area is 18...

lighter area darker area (to it's left and top) lighter area + darker area (lighter area + darker area)/(lighter area)
1 0 1 1
4 4 8 2
9 18 27 3
16 48 64 4
25 100 125 5
36 180 216 6

As you can see, the lighter area is (it's number)2, it's lighter area with it's darker area is exactly (it's number)2 * it's number, which is (it's number)3.

Square and it's recursion

functionnFunction that calculate1cubed + 2cubed + ... +n cubedreturn n cubed + [function](n-1)n-1n=1?yreturn 1n

The total area is the sum of the small square, the area to it's left and top, and last total area.

#Python sample def function(n): if n == 1: return 1 return n**3 + function(n-1)

How are they equal

Let's say we have a square that has 6 smaller squares along the diagonal. It is the same as the graph representing on the right 13 + 23 + 33 + 43 + 53 + 63, which represent a square that has an area of 62 plus the area to it's left and top and it's recursion area.

Obviously that the graph is a square. It is easy to tell a area of square if you know the width. You combine the width of the smaller squares along the diagonal as I said and get the value of (1 + 2 + 3 + 4 + 5 + 6). And you times itself, the total area is (1 + 2 + 3 + 4 + 5 + 6)2

The area of square remains the same, meaning that 13 + 23 + 33 + 43 + 53 + 63 equals (1 + 2 + 3 + 4 + 5 + 6)2

The example is suitable for all the cases that is 13 + 23 + 33 + ... + n3

Draw this square

Using HTML+Js+Css+svg

function drawPattern(n, singleW, label){ var res = ''; for(var i = 1; i <= n; i++){ for(var j = (i*(i-1)/2)*singleW - i * singleW; j >= 0; j -= singleW * i){ res += ` <rect class="graphSub` + i + `" stroke-width="1" stroke="#000" fill="#fff" x="` + j + `" y="` + (i*(i-1)/2)*singleW + `" width="` + i*singleW + `" height="` + i*singleW + `"/> <rect class="graphSub` + i + `" stroke-width="1" stroke="#000" fill="#fff" x="` + (i*(i-1)/2)*singleW + `" y="` + j + `" width="` + i*singleW + `" height="` + i*singleW + `"/> ` } if(i % 2 == 0){ res += ` <rect class="graphSub` + i + `" stroke-width="1" stroke="#000" fill="#fff" x="0" y="` + (i*(i-1)/2)*singleW + `" width="` + i*singleW/2 + `" height="` + i*singleW + `"/> <rect class="graphSub` + i + `" stroke-width="1" stroke="#000" fill="#fff" x="` + (i*(i-1)/2)*singleW + `" y="0" width="` + i*singleW + `" height="` + i*singleW/2 + `"/> ` } res += ` <rect class="graphMain` + i + `" stroke-width="3" stroke="#000" fill="#fff" x="` + (i*(i-1)/2)*singleW + `" y="` + (i*(i-1)/2)*singleW + `" width="` + i*singleW + `" height="` + i*singleW + `"/> <path stroke="#000" stroke-width="2" d="M0 ` + (i*(i-1)/2)*singleW + ` L` + (i*(i-1)/2)*singleW + ` ` + (i*(i-1)/2)*singleW + `"/> <path stroke="#000" stroke-width="2" d="M` + (i*(i-1)/2)*singleW + ` 0 L` + (i*(i-1)/2)*singleW + ` ` + (i*(i-1)/2)*singleW + `"/> ` if(label){ res += ` <text x="` + ((i*(i-1)/2)*singleW+3) + `" y="` + ((i*(i-1)/2)*singleW+15) + `" class="label">` + i + `</text> ` } for(var j = singleW; j < i * singleW; j += singleW){ res += ` <path stroke="#000" stroke-width="2" d="M` + ((i*(i-1)/2)*singleW + j) + ` ` + (i*(i-1)/2)*singleW + ` L` + ((i*(i-1)/2)*singleW + j) + ` ` + ((i*(i-1)/2)*singleW + i * singleW) + `"/> <path stroke="#000" stroke-width="2" d="M` + (i*(i-1)/2)*singleW + ` ` + ((i*(i-1)/2)*singleW + j) + ` L` + ((i*(i-1)/2)*singleW + i * singleW) + ` ` + ((i*(i-1)/2)*singleW + j) + `"/> ` } } return '<svg style="border: 3px solid #000;" width="' + ((1+n)*n/2)*singleW + '" height="' + ((1+n)*n/2)*singleW + '">' + res + '</svg>'; } Example. n =

Using HTML+Js+Css+Canvas

function drawPatternCVS(n, singleW, label, canvas){ canvas.width = ((1+n)*n/2)*singleW; canvas.height = ((1+n)*n/2)*singleW; draw = canvas.getContext('2d'); draw.fillStyle = '#000'; draw.strokeStyle = '#000'; for(var i = 1; i <= n; i++){ draw.lineWidth = 1; for(var j = (i*(i-1)/2)*singleW - i * singleW; j >= 0; j -= singleW * i){ draw.strokeRect(j, (i*(i-1)/2)*singleW, i*singleW, i*singleW); draw.strokeRect((i*(i-1)/2)*singleW, j, i*singleW, i*singleW); } if(i % 2 == 0){ draw.strokeRect(0, (i*(i-1)/2)*singleW, i*singleW/2, i*singleW); draw.strokeRect((i*(i-1)/2)*singleW, 0, i*singleW, i*singleW/2); } draw.lineWidth = 3; draw.strokeRect((i*(i-1)/2)*singleW, (i*(i-1)/2)*singleW, i*singleW, i*singleW); draw.lineWidth = 2; draw.beginPath(); draw.moveTo(0, (i*(i-1)/2)*singleW); draw.lineTo((i*(i-1)/2)*singleW, (i*(i-1)/2)*singleW); draw.moveTo((i*(i-1)/2)*singleW, 0); draw.lineTo((i*(i-1)/2)*singleW, (i*(i-1)/2)*singleW); draw.stroke(); if(label){ draw.fillText(i, ((i*(i-1)/2)*singleW+3), ((i*(i-1)/2)*singleW+15)) } for(var j = singleW; j < i * singleW; j += singleW){ draw.beginPath(); draw.moveTo(((i*(i-1)/2)*singleW + j), (i*(i-1)/2)*singleW); draw.lineTo(((i*(i-1)/2)*singleW + j), ((i*(i-1)/2)*singleW + i * singleW)); draw.moveTo((i*(i-1)/2)*singleW, ((i*(i-1)/2)*singleW + j)); draw.lineTo(((i*(i-1)/2)*singleW + i * singleW), ((i*(i-1)/2)*singleW + j)); draw.stroke(); } } } Example. n =

Simplifing the quation

13 + 23 + 33 + ... + n3

= (1 + 2 + 3 + ... + n)2

= ((1 + n)n / 2)2

Why step 2?

let's set n = 4, transform (1 + 2 + 3 + 4)2 to graph.

What do you notice?

The numbers of round pattern is 1 + 2 + 3 + 4 = 10. Can we find the result by using another way?

The formula of getting the area of trapezoid is (top length + bottom length) * height / 2, in this case the top length is 1 and height always remains botton length.

This gives the equation of (1 + 4) * 4 / 2, also the result of 10. Now we replace 4 to n and get the expression of (1 + n)n / 2.

Now stick the formula fx"=((A2+1)*A2/2)^2" into Excel and check the answers.

13 + 23 + 33 = 36

13 + 23 + 33 + 43 = 100

13 + 23 + 33 + 43 + 53 = 255

13 + 23 + 33 + 43 + 53 + 63 = 441

Math Problem of Square Patterns

Mathematics 9: Problem Index 0

Coby Qiu

Start