Table of Contents >> Show >> Hide
- First, the tiny definition that saves hours
- The two big strategies
- How to count rectangles in an m×n grid (fast and foolproof)
- How to count squares in an n×n grid (the “sizes” method)
- Squares in an m×n grid (not necessarily a square grid)
- Rectangles vs. squares: getting “rectangles only”
- “Picture puzzles” with missing lines: how to solve without tears
- Common mistakes (and how to dodge them)
- Mini practice: try these (answers included)
- Wrap-up: the clean “solution mindset”
- Experiences and real-world moments with “How many squares and rectangles?” puzzles
If you’ve ever stared at a grid and thought, “This is easythere are, like… a bunch,” congratulations:
you’ve been personally invited to the world’s most sneaky little math puzzle. Counting squares and rectangles
looks like it should take five seconds. Then you blink, miss the bigger shapes, double-count a few, and
suddenly your “five seconds” turns into “I live here now.”
This article is your escape plan. You’ll learn a clean, repeatable method to count rectangles
and squares in grids (and many common “picture puzzles”), plus the fast formulas that turn
chaos into a one-line calculation. We’ll keep it practical, include worked examples, and sprinkle in enough
humor to keep your brain from unionizing.
First, the tiny definition that saves hours
A rectangle is any four-sided shape with four right angles.
A square is a rectangle with equal side lengths. That means:
every square is a rectangle, but not every rectangle is a square.
So when someone asks, “How many rectangles?” they might mean:
- Rectangles including squares (common in math/combinatorics), or
- Rectangles excluding squares (common in trick questions and some puzzles).
We’ll show you how to do bothno guesswork, no dramatic sighing at the ceiling.
The two big strategies
There are two reliable ways to count shapes in a grid:
-
Systematic counting by size: count 1×1, then 2×2, then 3×3, and so on.
This is great for explaining your work and avoiding misses. -
Combinatorics (the “choose lines” method): pick boundary lines to form shapes.
This is the fastest route to the total number of rectangles.
The trick is knowing when to use which. If the figure is a clean grid, formulas are your best friend.
If it’s a “weird picture puzzle” with missing segments, you’ll use formulas as a baseline and then adjust.
How to count rectangles in an m×n grid (fast and foolproof)
Imagine an m×n grid of small unit squaresthat is, m columns and n rows.
The grid is made of lines: there are (m + 1) vertical grid lines and
(n + 1) horizontal grid lines.
The key idea: every rectangle is chosen by 4 lines
To make a rectangle, you choose:
2 distinct vertical lines (left and right sides) and
2 distinct horizontal lines (top and bottom sides).
That means the total number of rectangles is:
Rectangles in an m×n grid = C(m+1, 2) × C(n+1, 2)
Using the combination formula C(k, 2) = k(k−1)/2, this becomes:
Rectangles = (m(m+1)n(n+1)) / 4
Example: How many rectangles are in a 4×3 grid?
Here, m = 4 columns and n = 3 rows.
- C(m+1, 2) = C(5, 2) = 10
- C(n+1, 2) = C(4, 2) = 6
- Total rectangles = 10 × 6 = 60
So a 4×3 grid contains 60 rectangles (including squares). That’s a lot for something that
looks like a polite little checker pattern.
How to count squares in an n×n grid (the “sizes” method)
Squares are pickier than rectangles because all sides must match. In an n×n grid:
- There are n² small 1×1 squares.
- There are (n−1)² squares of size 2×2.
- There are (n−2)² squares of size 3×3.
- …and so on, down to 1 square of size n×n.
So the total number of squares is:
Squares in an n×n grid = 1² + 2² + 3² + … + n²
And that sum has a famous closed form:
Squares = n(n+1)(2n+1) / 6
Example: How many squares are on an 8×8 chessboard?
Plug in n = 8:
- Squares = 8×9×17 / 6
- 8×9 = 72, and 72/6 = 12
- 12×17 = 204
So there are 204 squares on a standard chessboardnot 64. (That “64” is just the number of
1×1 squares. The bigger squares are quietly waiting to ruin your confidence.)
Squares in an m×n grid (not necessarily a square grid)
If the grid is rectangular (m columns, n rows), the largest possible square has side length
min(m, n). For each square size k×k:
- It can slide horizontally into (m − k + 1) positions.
- It can slide vertically into (n − k + 1) positions.
So the number of k×k squares is (m − k + 1)(n − k + 1), and the total squares are:
Squares in m×n grid = Σk=1..min(m,n) (m − k + 1)(n − k + 1)
Example: Squares in a 4×3 grid
min(4,3) = 3, so we add k = 1, 2, 3:
- k = 1: (4)(3) = 12
- k = 2: (3)(2) = 6
- k = 3: (2)(1) = 2
Total squares = 12 + 6 + 2 = 20.
(And yes: those 20 squares are included inside the 60 rectangles we counted earlier.)
Rectangles vs. squares: getting “rectangles only”
Many puzzles ask for “rectangles” but secretly mean “rectangles that are not squares.”
If you have a clean grid and you already know:
- Total rectangles (including squares), and
- Total squares
Then:
Non-square rectangles = Total rectangles − Total squares
Example: Non-square rectangles in an 8×8 grid
Total rectangles in an n×n grid are:
[n(n+1)/2]² (because C(n+1,2) × C(n+1,2)).
- Total rectangles = [8×9/2]² = 36² = 1296
- Total squares = 204
- Non-square rectangles = 1296 − 204 = 1092
Translation: chessboards contain more rectangles than most people contain patience.
“Picture puzzles” with missing lines: how to solve without tears
Real-life versions of this puzzle often aren’t perfect grids. You’ll see missing segments, bold lines,
interior boxes, or a patchwork that looks like it was drawn during a bumpy car ride.
Method A: Count the full grid, then subtract what’s impossible
If the figure is “almost” an m×n grid, start with the full-grid rectangle count:
C(m+1,2)×C(n+1,2), then remove rectangles that rely on missing boundaries.
This is especially effective when only a few segments are missing.
Tip: Rather than subtracting one rectangle at a time, group them by which missing segment breaks them.
For example, a missing vertical segment might eliminate all rectangles that use that segment as part of
their left or right boundary over certain rows.
Method B: Count by “families” (sizes or spans)
When subtraction gets messy, count rectangles by their width and height in unit squares:
- Count all 1×1 rectangles (just the unit cells that actually exist).
- Then 1×2 and 2×1 rectangles, then 1×3 and 3×1, etc.
- Continue for 2×2, 2×3, 3×2, and so on.
This method is slower, but it’s sturdylike a math-flavored seatbelt.
Method C: Use a checklist grid to avoid double-counting
If you’re counting from a diagram, mark each rectangle you count by labeling its top-left corner and size
(for example: “starts at (row 2, col 3), size 2×4”). This turns a chaotic visual scan into a controlled inventory.
Common mistakes (and how to dodge them)
-
Only counting 1×1 squares: Your brain loves the obvious. Train it to look for 2×2, 3×3,
and “the big one that contains everything.” -
Mixing up m and n: Decide once: m = columns, n = rows (or vice versa), and stick to it.
Your future self will thank you. -
Counting “almost rectangles”: A rectangle needs four straight boundaries. If a boundary is broken
by a missing segment in a picture puzzle, it doesn’t count. -
Double-counting: If you’re counting manually, keep a table by size (like 1×2, 1×3, 2×3…).
If you’re using formulas, you’re already safer.
Mini practice: try these (answers included)
1) How many rectangles are in a 2×2 grid?
m = 2, n = 2 → rectangles = (2×3×2×3)/4 = 36/4 = 9.
Squares are 1²+2² = 5, so non-square rectangles are 9 − 5 = 4.
2) How many rectangles are in a 5×3 grid?
rectangles = (5×6×3×4)/4 = (30×12)/4 = 360/4 = 90.
3) How many squares are in a 4×4 grid?
squares = 1²+2²+3²+4² = 1+4+9+16 = 30.
Wrap-up: the clean “solution mindset”
When the puzzle asks, “How many squares and rectangles can you find?” the winning approach is:
- For rectangles in a clean grid: choose 2 vertical and 2 horizontal lines.
- For squares in an n×n grid: add up k² (or use n(n+1)(2n+1)/6).
- For squares in an m×n grid: sum (m−k+1)(n−k+1) for k up to min(m,n).
- For messy picture puzzles: start with a full-grid count and adjust, or count by families.
If you do it this way, you’re not “guessing until the number feels right.” You’re running a method.
And methods don’t panic, don’t forget the 3×3 squares, and don’t suddenly decide that rectangles are “basically vibes.”
Experiences and real-world moments with “How many squares and rectangles?” puzzles
These puzzles show up in more places than you’d expectclassrooms, brain-teaser books, interview questions,
and that one friend who insists every hangout needs a “quick riddle” (and then somehow it’s a 20-minute ordeal).
What makes them so memorable isn’t the arithmeticit’s the way they mess with how we see.
A common experience is the “confidence cliff.” At first glance, your brain locks onto the smallest shapes.
On a chessboard, you see 64 and feel accomplished. Then someone says, “What about 2×2 squares?” and suddenly
your certainty evaporates like a puddle in July. That moment is actually useful: it reveals a big truth about
problem-solvingwhat feels obvious is rarely the whole story. The puzzle quietly teaches you to scan for
structure, not just for what pops out.
Another classic moment happens when people count together. Someone starts listing squares by size (1×1, 2×2, 3×3…),
while someone else tries to “eyeball it.” The eyeballer usually announces a number with great confidence, and the
size-counter calmly asks, “Did you include the 4×4?” Watching that exchange is like seeing two different operating
systems running the same app: one is powered by vibes, and one is powered by a checklist. The funny part is that
the vibes person isn’t carelessthey’re just using a strategy that’s not built for scaling. As soon as the grid gets
bigger or the picture gets weird, vibes collapses.
In “picture puzzles” (where some lines are bold, broken, or missing), people often report a different feeling:
frustration that seems irrationally intense for a bunch of squares. That’s because your brain wants a simple pattern,
but the figure refuses to cooperate. The best experience-based trick here is to stop trying to count “by staring.”
Staring is not a counting technique; it’s a dramatic pause. Switching to a methodlike starting from a complete grid
and subtracting what’s impossible, or counting by rectangle familiesfeels like flipping on a light.
There’s also a surprisingly practical side to these puzzles. Designers and developers use grid thinking constantly:
layout systems, pixel art, UI components, spreadsheets, tiling patterns, and even photo-cropping tools all rely on
understanding how many “sub-rectangles” exist in a structure. The math behind rectangle counting shows up in algorithm
design too, especially when you’re scanning all possible subregions of an image or matrix. The puzzle is playful,
but the idea is powerful: you’re learning how to count combinations without listing every single one.
Finally, one of the best experiences with this topic is the “I can teach it now” moment. Once you understand the
choose-the-lines method for rectangles, you can explain it in under a minuteand it feels like magic to someone who
has been manually counting shapes. That’s a great sign you truly own the concept: you can move from doing the puzzle
to running the puzzle. And the next time you see a grid, you won’t think, “How many are there?”
You’ll think, “Okayhow many vertical lines, how many horizontal lines, and where’s my combinatorics cape?”
