Ways to make square from a grid uneven-spaced

1k Views Asked by At

Given 9 vertical lines spaced 1 cm and 6 horizontal lines spaced 2 cm , find how many squares are there?

grid

EDIT:
I've thought about a general case and found that the ways to make S sized square in $MxN(M\ge N)$ rectangle is (M-S+1)(N-S+1). Summing this all the way to N is
$$\sum_{S=1}^N (M-S+1)(N-S+1) =\frac{N(N+1)(3M-N-1)}{6} $$ and I'm stuck after this.

2

There are 2 best solutions below

0
On

Hint: go through the sizes of squares. The smallest is $2 \times 2$ cm. How many ways to choose the top line of a $2 \times 2$ square? How many ways to choose the left side? Now do $4 \times 4$ and on.

0
On

It takes 2 horizontal and 1 vertical rectangle to make a ‘smallest’ square. Each of these can be framed in 7 places horizontally and 5 places vertically. The next size square is double that and can occupy 5 X 4 places. The next size is 3 vertical and 6 horizontal boxes the can be found ing 3X3 places. The next and largest square uses 8 horizontal and 4 vertical rectangles and can ‘move’ between only 2 vertical places in the grid. The total is 7*5+5*4+3*3+2 = 35+20+3+5=60.