# math

posted by on .

how many squares are there in the shape ?

and how rectangles are there in it ?

{}{}{}{}
{}{}{}{}
{}{}{}{}

{}= mean a square ...

• math - ,

How many squares and rectangles are on a chess board?

If you determine the number of squares on smaller boards starting with one square you will readily discover a pattern that leads to a simple formula for a board of any number of squares.
A one square board obviously has only one square.
A 2x2 square board has 5 squares, the 4 basic ones and the one large 2x2 one.
A 3x3 square board has 14 squares, the smaller 9 plus 4 2x2's plus 1 3x3 one.
A 4x4 square board has 30 squares, the smaller 16 plus 9 3x3's, plus 4 2x2's plus 1 4x4 one.
Are you beginning to see the pattern?
1x1 - 1^2 = 1
2x2 - 2^2 + 1^2 = 5.
3x3 - 3^2 + 2^2 + 1^2 = 14.
4x4 - 4^2 + 3^2 + 2^2 + 1^2 = 30.
5x5 - 5^2 + 4^2 + 3^2 + 2^2 + 1^1 = 55.

What would your guess be for the number of squares on an 8x8 board? Can you derive a general expression for the answer? If not, see below.

Let N = the total number of squares in a square of nxn squares. Then

N = n^2 + (n-1)^2 + (n-2)^2................(n-n+1)^2 = n(n + 1)(2n + 1)/6

So for the typical chess board problem with 8x8 squares, the total number of definable squares is

N = 8^2 + 7^2 + 6^2 + 5^2 = 4^2 + 3^2 + 2^2 + 1^2 = 8(9)(16+1)/6 = 204.

Now we ask ourselves, how many rectangles are there in a square nxn squares big? We count only "rectangles", not the squares which are special cases of rectangles. Remember, only rectangles where the length is longer than the width.

Again, the best way to creep up on a solution is to start out with the small size squares and see where it leads you. For a 2x2 square, we have a total of 4 possible rectangles, each 1x2 squares. For the 3x3 square, we can find 12 1x2 squares, 6 1x3 squares, and 4 2x3 squares for a total of 22 squares. For the 4x4 square, we can find 24 1x2's, 16 1x3's, 8 1x4's, 12 2x3's, 6 2x4's, and 4 3x4's for a total of 70 squares. For the 5x5 square, we get 40 1x2's, 30 1x3's, 20 1x4's, 10 1x5's, 24 2x3's, 16 2x4's, 8 2x5's, 12 3x4's, 6 3x5's, and 4 4x5's.
Did you notice anything as you looked through these nymbers? Lets put them into a tabular form. Along side each nxn square will be the number of squares identified at the top of the column.
1x2 1x3 1x4 1x5 2x3 2x4 2x5 3x4 3x5 4x5 Total
2x2 4 4
3x3 12 6 4 22
4x4 24 16 8 12 6 4 70
5x5 40 30 20 10 24 16 8 12 6 4 170

NOTICE ANYTHING???

1--The number of 1 square wide rectangles in each case is equal to n^2(n-1).
2--The number of 2 square wide rectangles in each case is equal to the number of 1 square wide rectangles in the previous case. The number of 3 square wide rectangles in each case is equal to the number of 2 square wide rectangles in the previous case.
The total number of rectangles in a square of nxn squares is equal to the sum of the 1 square wide rectangles for each rectangle from the 2x2 up to and including the nxn one being considered. Thus, the number of rectangles in a 5x5 square is the sum of the 1 square wide rectangles in the 1x1, 2x2, 3x3, 4x4, and 5x5 squares or 4 + 18 + 48 + 100 = 170. Therefore, for the typical chess board problem of 8x8 squares, we have a total of 4 + 18 + 48 + 100 + 180 + 294 + 448 = 1092.

The general expression for the number of rectangles can be derived from the following extension of our data so far.
Term.........1........2........3.........4.........5........6.........7.........................n = number of cells per side
Squares...1x1....2x2.....3x3.....4x4.....5x5.....6x6.....7x7.....8x8
R..............0........4........22......70......170.....350.....644....1092.............N = number of internal rectangles
1st diff...........4........18......48......100.....180.....294.....448
2nd diff..............14.......30......52........80.....114....154
3rd diff....................16.......22.......28.......34......40
4th diff..........................6.........6.........6........6

Therefore, we have a finite difference series ending in the constant difference of 6. An expression can be derived enabling the definition the nth term of any finite difference series. The expression is a function of the number of successive differences required to reach the constant difference. If the first differences are constant, the expression is of the first order, i.e., N = an + b. If the second differences are constant, the expression is of the second order, i.e., N = an^2 + bn + c. Similarly, constant third differences derive from N = an^3 + bn^2 + cn + d.
Our case will derive from N = an^4 + bn^3 + cn^2 + dn + e.

Using the data points (n1, N1), (n2,N2), (n3,N3), etc., we substitute them into N = an^4 + bn^3 + cn^2 + dn + e as follows:
(n1,N1) = (1,0) produces a(1^4) + b(1^3) + c(1^2) + d(1) + e = 0 or a + b + c + d + e = 0
(n2,N2) = (2,4) produces a(2^4) + b(2^3) + c(2^2) + d(2) + e = 4 or 16a + 8b + 4c + 2d + e = 4
(n3,N3) = (3,22) produces a(3^4) + b(3^3) + c(3^2) + d(3) + e = 22 or 81a + 27b + 9c + 3d + e = 22
(n4,N4) = (4,70) produces a(4^4) + b(4^3) + c(4^2) + d(4) + e = 70 or 128a + 64b + 16c + 4d + e = 70.

The solution to these four expressions leaves us with the number of individual rectangles within a square divided up into nxn smaller squares being R(nxn) = n^4 + 14n^3 - 102n^2 + 197n - 110.

If you want to derive the total number of squares and rectangles, then the total on an 8x8 checkerboard would be 204 + 1092 for a total of 1296, the square of 36.

Letting N(s,r)n = the total number of squares and rectangles in a square of nxn squares, we can also use

N(s,r)n = n(n + 1)(2n + 1)/6 + n(3n^3 + 2n^2 - 3n - 2)/12 = [(n^2 + n)^2]/4

For our 8x8 board, N(s,r)8 = [(n^2 + n)^2]/4 = [(64 + 8)^2]/4 = 1296