Finding Squares – 2
Drawn in red in this grid are two 1 by 1 squares and one 2 by 2 square with horizontal and vertical sides.

THE CHALLENGE
FInd the number of squares of all sizes and orientations in this grid. Unlike what is shown in the introduction, not all of these squares will have horizontal and vertical sides!

EXPLORATION
Play with what happens with larger grids and with grids that are not squares.
Notes
THE CHALLENGE
The possible squares with horizontal and vertical sides have side lengths from 1 up to one less than the number of rows/columns.
For each size of square, think of the upper left corner as the starting position. You can produce all squares of this size in the grid by shifting this starter square around. You have the choice of moving it to the right or down the remaining number of positions. These are independent choices, so you get <this number plus 1> squared of that size square.
For example, suppose you are counting 2 by 2 squares in this 5 by 5 grid. A 2 by 2 square in the upper left-hand corner can be shifted 1 or 2 to the right and 1 or 2 down. So there are 3 possible positions horizontally (counting the original position) and 3 possible positions vertically. Thus there are 3 x 3 of these 1 by 1 squares.
For the original 5 by 5 grid problem, this gives the following count of squares with horizontal and vertical sides:
- 1 by 1 squares: 4 x 4 = 16
- 2 by 2 squares: 3 x 3 = 9
- 3 by 3 squares: 2 x 2 = 4
- 4 by 4 squares: 1 x 1 = 1.
There are a total of 16 + 9 + 4 + 1 = 30 possible squares with horizontal and vertical sides.
The trick for the remaining squares is to continue to be organized in your counting. I’ll describe a square by what one of its sides does. For example, a square with a side that goes one to the right and one up, or a square with a side that goes two the right and one up – these are two of the squares pictured in this illustration.
Counting by sliding as before we have:
- 1 to the right & 1 up: 3 x 3 = 9
- 2 to the right & 1 up: 2 x 2 = 4
- 3 to the right & 1 up: 1 x 1 = 1
- 2 to the left & 1 up: 2 x 2 = 4
- 3 to the left & 1 up: 1 x 1 = 1
- 2 to the right and 2 up: 1 x 1 = 1

So the total is: 30 (from earlier) + 9 + 4 + 1 + 4 + 1 = 49.
EXPLORATION
You can explore other sizes by finding an organized system of counting!