The main issue to me here is that the problem needs to be clarified. This is interesting.
Suppose you have nxm grid. How many rectangles can you make from this grid?
I solved this by realizing that a rectangle is the intersection obtained by highlighting two vertical lines and two horizontal lines of the grid. The answer I got was (n+1C2)(m+1C2)
I am just wondering how others would solve this.
You're thinking of the "grid" as a grid of
squares, as a chessboard is 8x8; and you're thinking of "making a rectangle" as forming a rectangle by combining some of those squares, or equivalently drawing a rectangle by drawing along the lines in the grid.
I only see n horizontal lines and m vertical ones
Romsek is thinking of the grid as composed of
lines, not squares, but still drawing only along the lines. So it's only the count (the meaning of the variables) that's different.
Rectangles also exist in oblique positions for a sufficiently combined large
number of length and width grid points. You need a different/amended
formula for the total number of rectangles.
lookagain is thinking of a grid as a lattice of
points, and of making a rectangle as choosing four of the points as vertices of a rectangle.
Those are two different problems, and two ways of describing size. Quite a lot of uncertainty in a few words.
Now, I think the first time I saw this problem (Jomo's form), about 20 years ago, I had first seen the question, "How many squares can be made on a chessboard?" That, I think, has to be done as a sum over size, though there may be a more elegant way. So it probably took me a moment or two to get out of that way of thinking and see the product-of-combinations approach for the rectangle problem.
Now, lookagain's version seems considerably harder to make a general formula for. That is worth pondering!