## How many number of rectangles are present in a MxN matrix?

Click here to See Answers

Out of four points of a rectangle, two points should be in one row and other two points should be in other row. If you select any two points in the top row then we dont have any choice for two points in the bottom row, there is only one possibility for that, as in the image below.

So we first select any two rows and then select any two points in columns.

Number of ways to select any two rows = mP2

Number of ways to select any two points in a row = nP2

Thus total number of rectangles possible are = mP2*nP2

Here nPk = n!/(n-k)!

Facebook Comments

Nitin Jain says

Answer would be:

m*n*(m+1)*(n+1)/4

i.e sum of all number from 1 to M * sum of all number from 1 to N