What Squares Are in the Square Grid?

Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
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
.
Contributed by: Jaime Rangel-Mondragon (August 2012)
Open content licensed under CC BY-NC-SA
Snapshots
Details
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
.
Permanent Citation