Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I know the formula f(n) = n * (n + 1) * (2 * n + 1) / 6 . Here n==8.

But I want to know how it has been derived ? Also how to tackle the number of rectangles ?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

Here is an easy way to count the number of rectangles. There are $9$ horizontal lines on the chessboard, and $9$ vertical lines. Choose two distinct horizontal lines, and two distinct vertical lines. These determine a unique rectangle. And any rectangle determines a pair of horizontal lines and a pair of vertical lines.

So the number of rectangles is $\binom{9}{2}^2$. That is $1296$.

Exactly the same idea can be used to count the number of rectangles on an $m$ by $n$ chessboard. It is $$\binom{m+1}{2}\binom{n+1}{2}.$$

The number of squares is a bit less nice. It is easy to see that there are $8^2$ small $1\times 1$ squares, $7^2$ $2\times 2$ squares, and so on down to $1^2$ $1\times 1$ squares, for a total of $$1^2+2^2+3^2+\cdots+8^2.$$ Now we can add up, but there is also a simple formula for the sum of the first $n$ squares. The same idea works for counting the squares on an $n \times n$ chessboard. A relatively minor modification deals with the number of squares on an $m \times n$ board, where $m \le n$.

share|improve this answer
    
It is easy to see that there will be 64 small (1 x1) squares . But what is the logic behind 2 x 2 squares ? How is it $7^2$ –  Geek Aug 4 '12 at 7:36
    
@Geek, consider for $2 \times 2$ squares how many centers they have. –  ladaghini Aug 4 '12 at 7:45
    
@ladaghini not an elegant way to think in terms of center ...How would you calculate for 3 x 3 then ? –  Geek Aug 4 '12 at 7:47
    
@Geek: For the $3\times 3$, for example, consider the top left corner. It can take $6$ positions on the top line, $6$ positions on the second line, and so on up to $6$ positions on the sixth line, total $6^2$. Equivalently, the top left little square of the $3\times 3$ can take $6$ positions on the first row, $6$ positions on the second row, and so on. Same idea works for $k\times k$ squares. –  André Nicolas Aug 4 '12 at 7:52
1  
@mehdi: consider this picture. –  robjohn Jun 16 at 15:25

If you look at a chessboard ($n = 8$), there are

  • 1 square of size 8x8
  • 4 squares of size 7x7
  • 9 squares of size 6x6
  • and so on until
  • 64 squares of size 1x1

So, really, the formula boils down the the summation $\sum_{i=1}^n i^2$, which can be derived as shown in the answers here. See also a combinatorial approach to better suit your question.

For rectangles, note that for an $n \times m$ chessboard, there are $n+1$ lines that form the rows and $m+1$ lines that form the columns. A rectangle will be bound by two of these rows and two of these columns, so the number of rectangles is given by:

$R(n,m) = \binom{n+1}{2}\binom{m+1}{2}$

Note that the formula is generalized for any rectangular chessboard, not just a square one.

share|improve this answer

To get the squares, integrate $(m+1-x)(n+1-x)$ for $x$ from $1$ to $m$, where $m$ and $n$ are the dimensions of a $m\times n$ chessboard, where $m\lt n$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.