Originally Posted by

**Soroban** Hello, Navesh!

Of course, it is! . . . I looked at it from the *worst* direction . . . *blush*

I've solved this type of problem before, but totally forgot the approach.

We have an $\displaystyle m \times n $ "chessboard" with $\displaystyle m$ rows and $\displaystyle n$ columns.

How many $\displaystyle 1\!\times\!1$ squares are there? .Let's call them $\displaystyle \text{one-squares}.$

. . Place a $\displaystyle \text{one-square}$ in the upper-left corner.

. . There are $\displaystyle m$of them in the first row, and there are $\displaystyle n$ such rows.

Hence, there are: $\displaystyle (m)(n)\text{ one-squares.}$

How many $\displaystyle \text{two-squares}$ are there?

. . Place a $\displaystyle \text{two-square}$ in the upper-left corner.

. . There are $\displaystyle n-1$ of them in the first row, and there are $\displaystyle m-1$ such rows.

Hence, there are: $\displaystyle (m-1)(n-1)\text{ two-squares.}$

How many $\displaystyle \text{three-squares}$ are there?

. . Place a $\displaystyle \text{three-square}$ in the upper-left corner.

. . There are $\displaystyle n-2$ of them in the first row, and there are $\displaystyle m-2$ such rows.

Hence, there: $\displaystyle (m-2)(n-2)\text{ three-squares.}$

. . . $\displaystyle \vdots$

How many $\displaystyle \text{m-squares}$ are there?

. . Place an $\displaystyle \text{m-square}$ in the upper-left corner.

. . There are $\displaystyle n-m+1$ of them in the first row, and there is $\displaystyle 1$ such row.

Hence, there are: $\displaystyle 1(n-m+1)\;\text{m-squares.}$

Therefore, the total number of squares is:

. . $\displaystyle m\cdot n + (m-1)(n-1) + (m-2)(m-2) +$$\displaystyle \hdots + 1(n-m+1)$

which can be written: .$\displaystyle \sum^{m-1}_{r=0}(m - r)(n - r)$