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?
Answer
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.
No comments:
Post a Comment