We can just look at the top left corner of each square inside the n x n grid.
For the 1×1 square, there will be n x n of those. For the 2×2, we can see that the top left corner of the 2×2 square must be in a 4×4 square, so there are 16. As a result, the number of squares in nxn is:
n^2 + (n-1)^2 + (n-2)^2….(n-n)^2, which is just the sum of squares up to n. The formula for this is:
Also, how do we use Latex again?