This is the first part of grids in which I will be covering number of squares and rectangles in an m*n grid. The next part will cover paths along a grid.

This is an easy sub-topic from permutations and combinations and can be solved within seconds by application of simple logic and the formulae. Although direct questions are rare, there could be questions which test the same concept in a hidden manner.

**Number of squares in m * m figures**

In a simple 2*2 figure, it is easy to see that there are 5 squares in total – 4 small ones and 1 large.

Again, if you try it in a 3*3 square, you can see that there are 14 squares in total.

With larger dimensions, there is a shorter way to solve it. In the above cases, you saw that the number of unit dimension squares (1*1) was equal to m*m. That is an easy spot. After that, if you want to find all the 2*2 squares, you can start from the top left corner and figure out that in every row, you will get (m-1) such squares. Also, this can be done for (m-1) rows and so, a total of (m-1) * (m-1) = (m-1)^{2} squares of 2*2 dimension. Similarly, you can do it for 3*3, 4*4 and so on till you reach to finding a square of dimensions m*m which is the outer square. So, the total number of squares is nothing but:

**Number of squares in m * n figures**

In the above figure, you can see that there are 2 rows and 3 columns. The number of unit squares is simply 2*3=6. Also, by observation, you can see that the number of squares of dimensions 2*2 is 2. So, there are a total of 8 squares that can be found.

which can be simplified to be:

**Note:** In the above formula, if m=n, you get the same formula that we derived earlier. So, an easier way to remember the second formula is to replace 2m by 3m-n and you should be good to go.

**Number of rectangles in a grid (both for m*m and m*n)**

This is easier to understand and to solve. The basic interpretation of an m*n grid is that there are two sets of parallel lines (consisting of m+1 and n+1 lines) that are perpendicular to each other and intersect each other at all possible points. To form a rectangle, we require 2 horizontal and 2 vertical lines. Now, these 2 lines can be chosen from (m+1) and (n+1) lines in

which is the number of rectangles than can be formed. So, if you have a 3*3 grid as was shown above, you will have a total of ^{4}C_{2 }* ^{4}C_{2 }= 36 rectangles. If you have a 2*3 grid, number of rectangles will be 18.

**Note:** In an m*m grid, the number of rectangles will also be given by the sum of cubes of the first m natural numbers which will be equal to

Hope that clears all the doubts regarding number of squares and rectangles in a grid.

Edit: You can read the Part 2 of the article here.

All the best!

Pingback: CAT 2016 syllabus, resource links and more()