Skip to content

Chessboard squares and rectangles

October 26, 2012

Another problem I posed a month or so ago:

How many (a) squares and (b) rectangles (with whole number side lengths) are there on a chessboard?

Again, I’ll give you some thinking space…

 

 

 

 

 

 

 

 

 

 

 

 

 

Many, many problems in maths are, in the end, about counting things, and so the problem is actually about finding a good way to count. These are no exception.

Naively, we could start to count every different square (or rectangle) we see. For small numbers that might be OK, but here it would be quite impossible – at least for me. I’d be sure to forget to count one, or not notice that I had counted one twice.

(a) Squares

As usual, there would be many ways to do this. My suggestion is …

For each square on the chessboard, count the squares (of all sizes) having that square in their top-left-hand corner, as follows:

8 7 6 5 4 3 2 1
7 7 6 5 4 3 2 1
6 6 6 5 4 3 2 1
5 5 5 5 4 3 2 1
4 4 4 4 4 3 2 1
3 3 3 3 3 3 2 1
2 2 2 2 2 2 2 1
1 1 1 1 1 1 1 1

So the total of all the numbers in this grid is
1×8 + 3×7 + 5×6 + 7×5 + 9×4 + 11×3 +13×2 + 15×1 = 204.

More generally, for nxn chessboards, the number of squares is n(n+1)(2n+1)/6.

(b) Rectangles

The equivalent counts for rectangles on the chessboard are:

64 56 48 40 32 24 16   8
56 49 42 35 28 21 14   7
48 42 36 30 24 18 12   6
40 35 30 25 20 15 10   5
32 28 24 20 16 12   8   4
24 21 18 15 12   9   6   3
16 14 12 10   8   6   4   2
  8   7   6   5   4   3   2   1

The bottom row is just the sum of the numbers 1 to 8 = 36.
The 2nd bottom row is just 2 times the sum of the numbers 1 to 8 = 2 x 36.
The 3rd bottom row is just 3 times the sum of the numbers 1 to 8 = 3 x 36.
The 4th bottom row is just 4 times the sum of the numbers 1 to 8 = 4 x 36.
The 5th bottom row is just 5 times the sum of the numbers 1 to 8 = 5 x 36.
The 6th bottom row is just 6 times the sum of the numbers 1 to 8 = 6 x 36.
The 7th bottom row is just 7 times the sum of the numbers 1 to 8 = 7 x 36.
The 8th bottom (i.e. top) row is 8 times the sum of the numbers 1 to 8 = 8 x 36.

So the total of all the numbers in this grid is
(1+2+3+4+5+6+7+8) x 36 = 36 x 36 = 1296.

Check it yourself.

More generally, for nxn chessboards, the number of squares is n2(n+1)2/4.

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: