Counting Rectangles in a Figure
Count every rectangle in a grid by numbering the columns and rows and multiplying the two totals, then extend the method to irregular figures with extra or missing lines.
Count every rectangle in a grid by numbering the columns and rows and multiplying the two totals, then extend the method to irregular figures with extra or missing lines.
Counting rectangles by eye goes wrong almost immediately — they overlap, nest inside each other, and squares count as rectangles too. Numbering the columns and rows and multiplying two totals replaces all that hunting with one product.
Number of rectangles (sum across)
(sum down), where each sum runs
over the columns and rows.
Remember that a square is a rectangle, so all of them are included in the .
Three columns and two rows.
The counting sequence is always up to the number of columns, and separately up to the number of rows. Each sum is just a consecutive sum.
Every rectangle is fixed by four lines: two vertical ones for its left and right edges, and two horizontal ones for its top and bottom. Those two choices are independent, so the counts multiply.
That makes it a combination problem as well. In a grid there are
vertical lines and
horizontal ones:
Both routes agree because is exactly
. Use whichever feels quicker.
When the figure is not a clean grid — an extra line here, a missing one there — split the work in two:
The second step is the one that needs care: count only the rectangles that use the extra line as an edge, otherwise you will count the same rectangle twice.
A single row of three columns, where one end column is cut in half by a horizontal line.
The two halves are new rectangles that did not exist before. The full-height column was already counted in the , so it is not counted again.
a) A middle line that stops short
b) A grid with one extra line
The three new rectangles in (b) are the ones using the extra line as an edge: the small half it creates, the other half of that cell, and the wider rectangle running from the new line across the rest of the top row.