A 5x5 grid is made up of 25 individual squares, which can be combined to form rectangles. Counting them is a simple matter of adopting a regular approach, which leads to a somewhat surprising result.

Start with the square in the upper-left corner. Count the number of rectangles which can be created starting with this square. There are five different rectangles with a height of 1, five different rectangles with a height of 2, which leads to 5 x 5, or 25 different rectangles starting with this square.

Move one square to the right and count rectangles starting here. There are four different rectangles with a height of 1, four more with a height of 2, leading to 5 x 4, or 20 different rectangles starting here.

Repeat this for the next square over, and you’ll find there are 5 x 3 rectangles, or 15. You should see the pattern by now. For any square, the number of rectangles you can draw is equal to their coordinate distance from the lower right corner.

Fill out the grid with count of each square’s rectangles, either by manually counting them or by using the trick from step 3. When you’re done, it should look something like this:

25 20 15 10 5 20 16 12 8 4 15 12 9 6 3 10 8 6 4 2 5 4 3 2 1

Add up the numbers in the grid to get the total count of rectangles. The answer is 225, which is 5 cubed. Any grid of NxN size will make N cubed rectangles. See the references for the mathematical proof, if you don’t mind a little algebra.

References

About the Author

Ellis Davidson has been a self-employed Internet and technology consultant, entrepreneur and author since 1993. He has written a book about self-employment for recent college graduates and is a regular contributor to "Macworld" and the TidBITS technology newsletter. He is completing a book on self-employment options during a recession. Davidson holds a Bachelor of Arts in American civilization from the University of Pennsylvania.