# Counting Number of Squares Technique

Aside from the most stupid math question circulating in Facebook which was basically needs a small application of PEMDAS, that again most Netizens failed to recognize. Another photo of a 4 by 4 squares circulating for years trying to challenge our most creative minds.

That image is the shown above. The technique in counting the number of squares is very easy. To make sure that you didn’t miss some, start counting from a square with least dimension to greatest dimension.

In this case, the half by half square in red shown in the figure.

Labeled in red, there are 8 half by half squares.

Now, let’s count the number of squares with 1 by 1 unit square unit dimension labeled again with a red square below.

There are 4×4=16 plus the 2 1 by 1 squares formed by connecting the 4 half by half squares. A total of 18 1 by 1 squares.

Now that we’re done counting the 1 by 1 squares, we will continue counting from 2 by 2 to 4 by 4 squares. To count the number of 2 by 2 squares, let the image below be your guide.

Counting from the edge up to the other edge, there are total of 9 2 by 2 squares.

Same technique goes to counting the number of 3 by 3 squares.

If you have a clear vision and no deficiency in counting, then you will come up with 4 3 by 3 squares.

Lastly, the largest square with 4 by 4 square units dimension is only 1. Summing everything we have 8+18+9+4+1=40 squares.

Another solution to count the number of squares efficiently is by using a formula. The number of squares taken from $n\times n$ squares is the same as the sum of the squares of first n positive integers.

Let S be that sum, then we have the following formula

$S=\displaystyle\frac{n(n+1)(2n+1)}{6}$

In this case, n=4.

$S=\displaystyle\frac{4(4+1)(2\cdot4+1)}{6}$

$S=30$

30 is just the number of squares from 4 by 4 square. There are still 8 half by half squares and 2 1 by 1 square. That is 30+10=40 in total number of squares in the figure.