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?
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityI 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?
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.
If you look at a chessboard ($n = 8$), there are
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.
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$.
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