The diagram below shows a grid, based on a square; in two opposite corners of the square, smaller squares of have been removed.
How many rectangles can you find in this grid?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
First we count the rectangles for a complete 2 0 × 2 0 grid. Then we subtract those rectangles which intersect the cut-out square on in one corner; and the same for the other corner. Finally, we add in all rectangles which intersect both squares, because we subtracted them twice.
A rectangle is the intersection of a horizontal strip and a vertical strip. In each case, we can count the possible horizontal strips and vertical strips separate, and multiply.
For the full 2 0 × 2 0 grid, there are
20 possible ways to choose a horizontal strip of height 1,
19 possible ways to choose a horizontal strip of height 2,
and so on, to 1 possible way to choose a horizontal strip of height 20.
That gives 1 + 2 + ⋯ + 2 0 = 2 1 0 horizontal strips, and likewise 210 vertical strips, for a total of N 1 = 2 1 0 2 = 4 4 1 0 0 rectangles in the large square .
We pick one corner square and ask how many rectangles intersect it. There are
7 horizontal strips of height 1 that intersect it,
7 horizontal strips of height 2 that intersect it,
etc. to 7 possible strips of height 14 that intersect it,
6 possible strips of height 15 the intersect it,
5 possible strips of height 16 that intersect it, etc.
That gives 7 + 7 + ⋯ + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 2 0 ⋅ 7 − ( 1 + 2 + 3 + 4 + 5 + 6 ) = 1 4 0 − 2 1 = 1 1 9 horizontal strips that intersect the chosen corner square, and we find the same count for vertical strips. Thus there are N 2 = 1 1 9 2 = 1 4 1 6 1 rectangles intersecting a specific corner square .
How many rectangles intersect both corner squares? There are
1 horizontal strip of height 8 that intersect both,
2 horizontal strips of height 9,
etc. to 7 horizontal strips of height 14,
6 horizontal strips of height 15,
5 horizontal strips of height 16, etc.
Since 1 + 2 + ⋯ + 6 + 7 + 6 + ⋯ + 2 + 1 = 4 9 , this makes for N 3 = 4 9 2 = 2 4 0 1 rectangles intersecting both corner squares .
To finish up, the number of rectangles in the grid is N 1 − 2 N 2 + N 3 = 4 4 1 0 0 − 2 ⋅ 1 4 1 6 1 + 2 4 0 1 = 1 8 1 7 9 .