Given a square grid of size, this Demonstration shows each of its grid subsquares or grid subrectangles. The formula enumerating subsquares is . The formula enumerating subrectangles is .
The formula for subrectangles can be obtained by considering how each rectangle arises. Every choice of a pair of horizontal lines and a pair of vertical lines defines a rectangle. There are horizontal and vertical lines, and two of each are chosen, giving of them, which reduces to the formula given.
The first few values of the sequence of the number of grid subsquares in a square of side are .
The first few values of the sequence of the number of grid subrectangles in a square of side are .