Originally Posted by Faptastrophe
An n x n grid will have a total of n2 + (n  1)2 + ... + 22 + 12 squares. The picture has one 4 x 4 square and two 2 x 2 squares. There are 42 + 32 + 22 + 12 = 16 + 9 + 4 + 1 = 30 squares in the 4 x 4, and there are 22 + 12 = 4 + 1 = 5 squares in each 2 x 2. Thus, there are a total of 30 + 2 * 5 = 40 squares.
