9
$\begingroup$

I know the formula $$f(n) = \frac{n \cdot (n + 1) \cdot (2n + 1) } 6$$

Since chess board consists $8\times 8$, hence here $n=8$.

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

4 Answers 4

14

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.

  • 0
    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$2012-08-04
  • 1
    @Geek, consider for $2 \times 2$ squares how many centers they have.2012-08-04
  • 0
    @ladaghini not an elegant way to think in terms of center ...How would you calculate for 3 x 3 then ?2012-08-04
  • 1
    @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.2012-08-04
  • 0
    @AndréNicolas I see how it works . The "top left" is a much better way of thinking than "centre" as ladaghini pointed out . +1 .2012-08-04
  • 0
    i just dont understand why there are 9 horizental and vertical line in chessboard!!!2014-06-16
  • 2
    @mehdi: consider [this picture](http://i.stack.imgur.com/4UX3O.png).2014-06-16
  • 0
    @AndréNicolas, the sum of $\binom{m+1}{2}\binom{n+1}{2}$ and $\sum_{i=1}^n i^2$ give you the recursion formula that OP posted ?2014-06-16
  • 0
    The expression posted by OP is the usual closed form expression for $\sum_1^n i^2$.2014-06-16
  • 0
    @AndréNicolas what ?! How ?2014-06-17
  • 0
    Do you mean how do we prove that $1^2+2^2+\cdots+n^2=\frac{(n)(n+1)(2n+1)}{6}$? Many ways. Induction is one. Exploiting the fact that $(k+1)^3-k^3=3k^2+3k+1$ is another. Must have been done many times in many ways on MSE.2014-06-17
  • 0
    What if the problem changes to only calculating no. of rectangles?2017-09-13
2

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.

1

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$.

0

I made a formula that if a square is made up of small and same size of square with in then the number of rectangle and square in that square is equall to the whole square of sum of conscutive number from 1 to number of square in a row or columns. Example- number of square and rectangle in a chess board is equall to whole square of {1+2+3+4+5+6+7+8} that is whole square of 36 which is equall to 1296