The number of squares in the following figure is
2015
The number of squares in the following figure is

- A.
12
- B.
16
- C.
30
- D.
20
Attempted by 1 students.
Show answer & explanation
Correct answer: C
Concept
To count every square in a square grid of side n (made of n × n unit cells), count squares of each size k = 1, 2, ..., n separately. A square of side k can have its top-left corner placed in (n − k + 1) row positions and (n − k + 1) column positions, so there are (n − k + 1)2 squares of that size. The total number of squares is the sum of these counts over every size from 1 to n.
Application
Here the figure is a 4 × 4 grid of unit cells (n = 4), so squares of four different sizes must be counted:
Size 1×1: (4 − 1 + 1)2 = 42 = 16 squares — every unit cell.
Size 2×2: (4 − 2 + 1)2 = 32 = 9 squares.
Size 3×3: (4 − 3 + 1)2 = 22 = 4 squares.
Size 4×4: (4 − 4 + 1)2 = 12 = 1 square — the outer boundary.
Adding these gives 16 + 9 + 4 + 1 = 30 squares in total. The two diagonal lines drawn corner-to-corner only cross the grid at points that already lie on existing grid lines, so they split a few unit cells into triangles but do not close off any new right-angled region — they add no extra square.
Cross-check
The same total can be verified with the sum-of-squares formula n(n + 1)(2n + 1) / 6. For n = 4 this gives 4 × 5 × 9 / 6 = 180 / 6 = 30, which matches the direct count.
Result
So the figure contains 30 squares.