Counting Squares in a Figure

A full grid has a formula for its squares. Knock a piece out and the formula no longer applies, but the counting stays systematic if you work size by size.

--
Counting Squares in an Irregular Figure — Moosa Academy

A full grid has a formula for its squares. Knock a piece out of it and the formula no longer applies — but the counting is still systematic, provided you work size by size and check which squares survive the gap.

Theorem The full grid first

In a complete  n \times n grid the number of squares is  1^{2} + 2^{2} + 3^{2} + \cdots + n^{2} .

The trap is counting only the little cells. The whole grid is a square too, and so is every block in between. Count by size:

In a  2 \times 2 grid there are four  1 \times 1 squares and one  2 \times 2 square.

 1^{2} + 2^{2} = 1 + 4 = 5 squares in all.

A  3 \times 3 grid follows the same pattern: nine  1 \times 1 , four  2 \times 2 and one  3 \times 3 , giving  1 + 4 + 9 = 14 .

Concept Two ways to handle a gap

When part of the grid is missing, the formula alone will overcount. Either approach works:

1. Subtract. Count the full grid with the formula, then remove every square that passes through the gap.
2. Count by size. Count the  1 \times 1 cells that remain, then the  2 \times 2 blocks that are still complete, and so on.

The second method is usually safer. Subtracting requires spotting every square the gap destroys, which is easy to get wrong; counting survivors only asks what is actually there.

Example A missing corner
A  3 \times 3 grid with one corner cell removed
 1 \times 1 squares remaining:  8
 2 \times 2 squares still complete:  3
No  3 \times 3 square survives
 8 + 3 = 11 squares

The full grid would have given  14 . Removing one small cell cost three squares altogether: the cell itself, one  2 \times 2 block and the  3 \times 3 whole.

Example Two opposite corners

Now remove two opposite corners from the  3 \times 3 grid.

 1 \times 1 squares remaining:  7
 2 \times 2 squares still complete:  2
 7 + 2 = 9 squares

Each removed corner destroys the one  2 \times 2 block sitting in that corner, so two corners leave two of the four blocks intact.

Example A missing centre

Remove the middle cell of the  3 \times 3 grid instead.

 1 \times 1 squares remaining:  8
Every  2 \times 2 block contains the centre cell, so none survives
The  3 \times 3 whole is gone too
 8 squares

Compare this with the missing-corner case. The same single cell was removed, yet the centre is far more destructive because every larger square passes through it. Where the gap sits matters as much as how big it is.

Example A cross, and a larger gap

a) A plus-shaped cross of five cells

 1 \times 1 squares:  5
All four corners are missing, so no  2 \times 2 block is complete
 5 squares

b) A  4 \times 4 grid with a  2 \times 2 corner block removed

 1 \times 1 squares remaining:  12
 2 \times 2 squares still complete:  5
No  3 \times 3 or  4 \times 4 survives
 12 + 5 = 17 squares, against  30 for the full grid

Work upward through the sizes and stop as soon as a size yields nothing — no larger size can survive either.

Summary
  1. A complete  n \times n grid holds  1^{2} + 2^{2} + \cdots + n^{2} squares.
  2. Never count only the smallest cells — every larger block is a square too.
  3. For an incomplete figure, count size by size and keep only the complete blocks.
  4. Alternatively, take the full-grid total and subtract every square the gap ruins.
  5. A central gap destroys far more squares than a corner gap of the same size.
  6. Once a size yields no squares, stop — no larger size can survive.