In a grid of A x B squares, the formula to find how many unique rectangles there are (and all squares are considered to be rectangles) is:
A * (A+1) * B * ((B+1)/4)
A and B are interchangeable.
So in a 5 x 4 grid, there are
5 * (5+1) * 4 * ((4+1)/4)
Or 5 * 6 * 4 * (5/4)
Or 150 unique rectangles.
Now if we switch A and B, the equation reads:
4 * (4+1) * 5 * ((5+1)/4)
Or 4 * 5 * 5 * (6/4)
Again 150 unique rectangles.
Copyright © 2026 eLLeNow.com All Rights Reserved.