Squares on a chessboard¶
Counting and combinations · level 3, lesson 4 of 6
A question to start¶
A chessboard is 8 squares wide and 8 squares tall. How many squares are on it?
"64" is the answer everyone gives first. But the whole board is a square too: that makes 65. And there are 2-by-2 squares, made of four little squares, all over the board. And 3-by-3 squares. And so on.
Counted properly, a chessboard has 204 squares. And if you count rectangles of every shape and size (squares included), there are 1296. In this lesson you will find both numbers without drawing a single rectangle more than you need to, and you will see the neat reasons behind them.
The idea¶
Count by size¶
When there are too many things to count in one go, sort them into groups and count each group. Here the natural groups are the sizes: 1 by 1, 2 by 2, 3 by 3, and so on up to 8 by 8. Every square on the board belongs to exactly one size, so adding the groups counts every square exactly once.
Start small, with a 3-by-3 board.
- 1 by 1: the 9 little squares.
- 2 by 2: a 2-by-2 square can sit in 4 places. The dots in the middle picture mark where its top-left corner can go. It can slide 2 ways across (left or right position) and 2 ways down, so 2 × 2 = 4.
- 3 by 3: only the whole board. 1.
Total for a 3-by-3 board: 9 + 4 + 1 = 14 squares.
Why the counts are square numbers¶
How many places can a square of a given size go? Look at its top-left corner. A 2-by-2 square on a 3-wide board can start in column 1 or column 2, but not column 3 (it would hang off the edge). So it has 3 − 1 = 2 positions across. The same thinking down the board gives 2 positions down. Across and down are separate choices, so multiply: 2 × 2.
On the full 8-by-8 board, a square of size \(k\) by \(k\) can start in any of the first \(9 - k\) columns, and any of the first \(9 - k\) rows. (Size 1: 8 positions across. Size 2: 7. Size 8: just 1.) So:
| Size | Positions across | Positions down | How many |
|---|---|---|---|
| 1 by 1 | 8 | 8 | 64 |
| 2 by 2 | 7 | 7 | 49 |
| 3 by 3 | 6 | 6 | 36 |
| 4 by 4 | 5 | 5 | 25 |
| 5 by 5 | 4 | 4 | 16 |
| 6 by 6 | 3 | 3 | 9 |
| 7 by 7 | 2 | 2 | 4 |
| 8 by 8 | 1 | 1 | 1 |
64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204. All the square numbers from 1 × 1 up to 8 × 8, added together.
For a board of any size, the number of squares is the sum of the square numbers up to the board's width. A 4-by-4 board has 16 + 9 + 4 + 1 = 30 squares. A 5-by-5 board has 25 + 16 + 9 + 4 + 1 = 55.
Rectangles: choose the lines¶
Rectangles come in many more shapes (1 by 2, 3 by 5, 7 by 1, ...), and counting each shape separately would take a long time. Here is a much smarter way.
Look at the lines on the board, not the squares. An 8-by-8 board has 9 lines going up and down (the two edges and 7 in between) and 9 lines going across.
Every rectangle on the board has a left side and a right side, which lie on two of the up-and-down lines, and a top and a bottom, which lie on two of the across lines. And the other way round: if you pick any 2 up-and-down lines and any 2 across lines, they box in exactly one rectangle.
So counting rectangles is the same as counting ways to choose two lines one way and two lines the other way.
How many ways are there to choose 2 lines out of 9? This is the handshake problem from level 2. If 9 people each shake hands once with everyone else, the number of handshakes is the number of ways to pick a pair. The first person shakes 8 hands, the next has 7 new people left to shake, then 6, and so on:
8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 36.
So there are 36 ways to choose the left and right sides, and 36 ways to choose the top and bottom. "And" multiplies:
36 × 36 = 1296 rectangles on a chessboard.
Of those, 204 are squares, so 1296 − 204 = 1092 are rectangles that are not squares.
Check the line trick on a small board¶
Level 2 counted the rectangles in a 2-by-3 grid by hand and got 18. The grid has 4 up-and-down lines and 3 across lines. Pairs from 4 lines: 3 + 2 + 1 = 6. Pairs from 3 lines: 2 + 1 = 3. And 6 × 3 = 18. ✓
A beautiful extra¶
The number of ways to choose 2 lines from 9 is 36 = 1 + 2 + ... + 8, so the number of rectangles is (1 + 2 + ... + 8) × (1 + 2 + ... + 8). It turns out that this is also equal to 1 × 1 × 1 + 2 × 2 × 2 + ... + 8 × 8 × 8, the sum of the cubes up to 8. For an 8-by-8 board both give 1296. You can test it for a 2-by-2 board: (1 + 2) × (1 + 2) = 9, and 1 + 8 = 9. The proof belongs to a later level, but the pattern is real.
Worked examples¶
1. Squares on a 4-by-4 board. Sizes 1 by 1 to 4 by 4: 16 + 9 + 4 + 1 = 30.
2. Rectangles on a 3-by-3 board. 4 lines each way. Pairs from 4 lines: 3 + 2 + 1 = 6. Rectangles: 6 × 6 = 36. Of these, 14 are squares (from above), so 22 are not.
3. Squares on a board that is not square. How many squares are on a board 3 wide and 4 tall?
- 1 by 1: 3 across × 4 down = 12.
- 2 by 2: 2 positions across, 3 down: 6.
- 3 by 3: 1 across, 2 down: 2.
- A 4-by-4 square does not fit (the board is only 3 wide).
- Total: 12 + 6 + 2 = 20.
4. Rectangles on that board. 4 up-and-down lines (pairs: 6) and 5 across lines (pairs: 4 + 3 + 2 + 1 = 10). 6 × 10 = 60 rectangles.
Try it¶
- How many squares are on a 2-by-2 board? Draw it and check.
- How many squares are on a 5-by-5 board?
- How many rectangles are on a 2-by-2 board? Use the line trick, then find them all in a drawing.
- How many rectangles are on a 5-by-5 board?
- How many squares are on a board 2 wide and 5 tall?
- How many squares of size 3 by 3 are on an ordinary chessboard?
- A chessboard-style board has 140 squares in total. How big is it? (Keep adding square numbers.)
- How many rectangles on a chessboard are exactly 1 square tall (thin strips, including the 1-by-1 squares)?
Answers
- 4 small squares + 1 big one = 5.
- 25 + 16 + 9 + 4 + 1 = 55.
- 3 lines each way; pairs from 3 lines: 2 + 1 = 3. 3 × 3 = 9 rectangles: 4 small squares, 2 tall 1-by-2 ones, 2 wide 2-by-1 ones and the whole board.
- 6 lines each way; pairs: 5 + 4 + 3 + 2 + 1 = 15. 15 × 15 = 225.
- 1 by 1: 2 × 5 = 10. 2 by 2: 1 across × 4 down = 4. Total 14.
- 6 positions across × 6 down = 36.
- 1 + 4 + 9 + 16 + 25 + 36 + 49 = 140, so a 7-by-7 board.
- The top and bottom must be two neighbouring across lines: 8 ways (one for each row). The sides are any 2 of the 9 up-and-down lines: 36 ways. 8 × 36 = 288.
Common mistake¶
Counting only the small squares. "Squares on a chessboard" includes every size. When a question says "how many squares (or triangles, or rectangles) in this picture", sort them by size and count each size.
Counting the positions wrongly. A 2-by-2 square on an 8-wide board has 7 starting columns, not 8 and not 6. Check with the smallest case: a 1-by-1 square has 8 positions across, and an 8-by-8 square has 1. The rule "9 minus the size" gives both.
Where it leads¶
- Back: Counting what you do not want · Next: Counting by symmetry
- Level 3 page · Counting topic page
- "Choose 2 lines out of 9" is the handshake count. In level 5 it gets its own name, "9 choose 2": Level 5.
- The sums 1 + 4 + 9 + ... and 1 + 2 + 3 + ... are famous number patterns: Patterns.
- Squares, rectangles and their areas are in Geometry level 3.