Permutations and Combinations

8. Application in Geometry

8.2. Squares, Rectangles and Parallelograms

In a rectangular or square grid, the number of squares (and rectangles) shows a pattern. Using this pattern, we can develop a formula to calculate number of squares and rectangles in the grid. Let us consider the grid of size 3×3.


Number of squares of side 1 = 3 × 3 = 9 

Number of squares of side 2 = 2 × 2 = 4


Number of squares of side 3 = 1 × 1 = 1

Hence total number of squares = 9 + 4 + 1 = 13.

Take one more example:
Consider the following grid of size 6×4. 


Number of squares in the grid of all possible size:
Number of squares of side 1 = 4 × 6
Number of squares of side 2 = 3 × 5
Number of squares of side 3 = 2 × 4
Number of squares of side 4 = 1 × 3

Total number of squares = 24 +15 + 8 + 3 = 50

In a grid of dimension \(m \times n,\;m > n\) total number of squares of all possible dimensions

= \(mn + (m - 1)(n - 1) + (m - 2)(n - 2) + .....\)

When \(m = n\), then number of squares is:

\( = {m^2} + {(m - 1)^2} + {(m - 2)^2} + ....... + {2^2} + {1^2}\)

Number of rectangles in the same grid:

To form a rectangle, we need two vertical lines and two horizontal lines. In the given grid, there are  \(m + 1\) horizontal lines and \(n + 1\) vertical lines and by selecting any two vertical and any two horizontal lines we get a rectangle

Number of rectangles = \(^{m + 1}{{\rm{C}}_2} \times {\,^{n + 1}}{{\rm{C}}_2}\)

Number of parallelograms is same as number of rectangles.

Example 01:  Find the number of squares of all possible dimensions in the given grid.

Total number of squares in the outer grid = 3² + 2² + 1² = 14.
Number of squares in the inner grid is also 14. But one square is common that is counted twice. Hence the required number of squares = 14 + 14 – 1 = 27.