# Sum of all the numbers in the grid.

A square containing numbers $$\begin{array}{|c|c|c|} \hline 1 & 2 & 3 \\ \hline 1 & 2 & 2 \\ \hline 1 & 1 & 1 \\\hline \end{array} \qquad \qquad\qquad \begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 & 4 \\ \hline 1 & 2 & 3 & 3 \\ \hline 1 & 2 & 2 & 2 \\ \hline 1 & 1 & 1 & 1 \\\hline \end{array}$$ Continue this pattern until the box is $$10 \times 10$$. Then add all the numbers together.

So this was my attempt. Set the square $$1\times1$$ as $$a_1$$ square $$2 \times 2$$ as $$a_2$$ and so on. $$a_1$$ to $$a_2$$'s d is $$(1 \cdot 2)+2 a_2$$ to $$a_3$$'s d is $$(1 \cdot 2)+(2 \cdot 2)+3$$ and so on. So then I can the individual ds from each square to the next square. And because $$1+(1+2)+(1+2+3)\ldots+(1+2+3+\ldots+10) = \sum_{k=1}^{1} 1 + \sum_{k=1}^{2} 1+ \ldots +\sum_{k=1}^{10} 1=\sum_{k=1}^{10} \frac{n(n+1)}{2}$$ so $$(1\cdot2)+(1\cdot2)+(2\cdot2)\ldots+(1\cdot2)+(2\cdot2)\ldots+(10\cdot2) = \sum_{k=1}^{1} 2k + \sum_{k=1}^{2} 2k+\ldots+\sum_{k=1}^{10} 2k$$ which also means $$\sum_{k=1}^{10} 2 \cdot \frac{n(n+1)}{2} =\sum_{k=1}^{10} {n^2+n}$$ And these are my calculations $$\frac{10 \cdot 11 \cdot 21}{6}+\frac{10 \cdot 11}{2}$$ $$385+55=440$$ $$1+2+3+4+\ldots+10=55$$ $$440+55=495$$ It all seems right to me but the answer says its 385 is there any thing I did wrong?

Consider the L-shaped figure $$L_i$$. $$L_1$$ adds $$1.19$$, $$L_2$$ adds $$2.17$$, $$L_3$$ adds $$3.15$$ and so on till $$L_{10}$$ adds $$10.1$$ for a total of $$385$$. $$1.19+2.17+3.15+...+10.1=385$$

Edit: Another way is to look at it as a 3d pyramid where each cube adds a $$1$$ to the sum. The ground floor has $$10^2$$ cubes, first floor has $$9^2$$ cubes and so on giving $$10^2+9^2+...+1^2=385$$

• thanks! But where is my calculations wrong that's what i really want to know. The logic seems to be correct and there is'nt any calculation errors. so i really want to know why its wrong. Jul 3, 2019 at 8:53
• One mistake to spot easily, is that you have the term $2 \cdot 10$ in your calculations, but there is only one 10 in the grid. Jul 3, 2019 at 9:01
• @doodlerdoodle Are you trying to see it as a pyramid? See edit.
– ZSMJ
Jul 3, 2019 at 9:03

To be honest I am not sure what you are doing. Let me add my solution. One way to write down a formula for the $$n \times n$$ version is $$\sum_{i = 1}^n i(2(n+1-i) - 1).$$

You will find $$2n-1$$ times the number $$1$$, $$2(n-1)-1$$ times the number $$2$$ etc. This means we want to add these up and then also add the values to the numbers by multiplying with $$i$$.

Another way to think of it is by summing diagonals: A $$n \times n$$ square has the following diagonal sums $$1, \\ 1 + 2 , \\ \vdots \\ 1 + \ldots + n - 1, \\ 1 + \ldots + n, \\ 1 + \ldots + n - 1, \\ \vdots \\ 1 + 2, \\ 1.$$ Therefore, the formula for the sum is $$2 \sum_{k = 1}^{n - 1}\sum_{j = 1}^{k} j + \sum_{j = 1}^{n} j = 2 \sum_{k = 1}^{n - 1} \frac{k(k + 1)}{2} + \sum_{j = 1}^{n} j = \frac{(n - 1) n (n + 1)}{3} + \frac{n(n + 1)}{2} = \frac{n (n + 1) (2 n + 1)}{6}.$$

We notice that this is also the formula for the sum of the first $$n$$ square numbers. This is because if you consider the sum of all entries of the and mirrored $$L$$-shape (not counting the one element that is in the row and column simultaneously twice) you get $$\sum_{j = 1}^{k} j + \sum_{j = 1}^{k - 1} j = \frac{k(k + 1)}{2} + \frac{k(k - 1)}{2} = \frac{k^2 + k + k^2 - k}{2} = k^2.$$ To explain the $$L$$-shape better: In the first square the first L is just the lower left number, one. The next $$L$$ consist of the adjacent numbers, $$1 + 2 + 1 = 2^2$$ and the next one captures the remaining ones.