Total number of right-angled triangles that can be formed on an $n \times n$ chessboard I know that the total number of squares of any size on an $n \times n$ chessboard is equal to $ \frac 1 6 n(n + 1)(2n+1)$ (i.e. the sum of the first $n$ squares). But what is the general formula for the total number of right-angled triangles on an $n \times n$ chessboard? Thanks. 
 A: The number of rectangles that can be formed is clearly $\binom{n+1}{2}\binom{n+1}{2}$, since there are $\binom{n+1}{2}$ ways to choose the left and right sides and $\binom{n+1}{2}$ ways to choose top and bottom sides. For each such rectangle we have four right angled triangles. In this we are counting each triangle only once since we are counting them by the smallest rectangle that encloses them. Thus the number is $4\binom{n+1}{2}\binom{n+1}{2}$
A: Each triangle contains one horizontal leg (which goes from left to right across chess board). The number of horizontal legs in one horizontal boundary (ie the horizontal boundary between squares or between squares and the edge of the board) is $\binom{n+1}{2}$. The number of horizontal boundaries in $n+1$. So there are $\binom{n+1}{2}(n+1)$ horizontal legs. Each horizontal leg can be in $2n$ triangles. So number of triangles is
$$\binom{n+1}{2}(n+1)2n \Rightarrow ((n+1)n)^2 \Rightarrow \left(2\binom{n+1}{2}\right)^2 $$.
For $n=1,2,3$ this gives $4, 36, 144$ triangles.
