My aim is to find the number of rectangles (squares included) in a $n \times n$ grid. It is easy to get that result with combinations. The usual answer to this problem is given by
$$\binom{n+1}{2}^2$$
which makes sense, just select two parallel lines from the $n+1$ vertical lines and another two from horizontal ones. Intriguingly, this is the same as the sum of the first $n$ cubes: that is
$$1^3 + 2^3 + 3^3 + ... +n^3 = \binom{n+1}{2}^2$$
Are these two problems (the number of rectangles and the sum of cubes) and their results interrelated? Is there some sort of geometric connection between the two, and, if so, what is it?
So it would take some effort to create the figure, but here is the math.
Let $N_k=\{i| 1\leq i \leq k\}$.
Consider an $(n+1)$x$(n+1)$ grid of points $\{(i,j)| \{i,j\}\subset N_{n+1}\}$ . The number of rectangles with vertices on those points is $\sum_{i=1}^n i^3$. If we consider the upper left subgrid of $n$x$n$ points, there are $\sum_{i=1}^{n-1} i^3$ rectangles within the upper left $n$x$n$ subgrid.
Subtracting, we find that there are exactly $n^3$ rectangles with a vertex on either 1) the right side of the $(n+1)$x$(n+1)$ grid or 2) the bottom of the $(n+1)$x$(n+1)$ grid. Call this set of rectangles $S$. We will group these $n^3$ rectangles into two disjoint sets: set $R$ - the rectangles with a vertex on the right side of the $(n+1)$x$(n+1)$ grid, and set $B$ - the rectangles with a vertex on the bottom of the $(n+1)$x$(n+1)$ grid that do not have a vertex on the right side of the grid.
$$S=R\cup B.$$
SET R
We can further divide set $R$ into $n$ disjoint subsets:
The cardinality of $R_i$ is $n\cdot(n-i+1)$ where $1\leq i\leq n$.
Consider the sets $$C= \{(i,j,k) | \{i,j,k\}\subset N_n\},$$ $$C_R= \{(i,j,k) | \{i,j,k\}\subset N_n, i\leq j\},\mathrm{\ and}$$ $$C_B= \{(i,j,k) | \{i,j,k\}\subset N_n, i> j\}.$$
Note that $C$ is the disjoint union of $C_R$ and $C_B$.
Also notice that the intersection of $C_R$ and the set of points with x-coordinate is 1 has exactly $n^2$ points which happens to be the cardinality of $R_1$. The intersection of $C_R$ and the set of points with x-coordinate is 2 has exactly $n\cdot(n-1)$ points which happens to be the cardinality of $R_2$. Continuing in this fashion, we can see that there is a 1-1 correspondence between the rectangles in $R$ and the points in $C_R$. $$|R|=|C_R|.$$
SET B
We can divide set $B$ into $n-1$ disjoint subsets:
The cardinality of $B_i$ is $n\cdot(n-i)$ where $1\leq i\leq n-1$.
Notice that the intersection of $C_B$ and the set of points with x-coordinate is $n$ has exactly $n\cdot (n-1)$ points which happens to be the cardinality of $B_1$. The intersection of $C_B$ and the set of points with x-coordinate is $(n-1)$ has exactly $n\cdot(n-2)$ points which happens to be the cardinality of $B_2$. Continuing in this fashion, we can see that there is a 1-1 correspondence between the rectangles in $B$ and the points in $C_B$. $$|B|=|C_B|.$$
We have shown that there is a 1-1 correspondence between the set of rectangles with a vertex either on the right side or the bottom of the $(n+1)$x$(n+1)$ grid of points and the points in an $n$x$n$x$n$ cube of points.
Induction could now be used to prove that the number of rectangles with vertices on a $(n+1)$x$(n+1)$ grid of points is $\sum_{i=1}^{n} i^3$.
Drawing all of this is possible but cumbersome.