Counting Squares and Other Polygons Within a Complex Figure
Reasoning › Non-Verbal Reasoning – Figure Counting, Embedded Figures and Completion · Topic 25.6
To count squares in a grid of m rows and n columns of unit cells (m not more than n), add (m - k + 1)(n - k + 1) for every side length k from 1 to m; for an n by n grid this equals n(n + 1)(2n + 1)/6. Other polygons in a complex figure are counted by listing them by size, and tilted squares in a dot lattice are counted by the sum of k times (n - k) squared.
7 min read · Reasoning · Non-Verbal Reasoning – Figure Counting, Embedded Figures and Completion
Quick Answer
To count squares in a grid of m rows and n columns of unit cells (m not more than n), add (m – k + 1)(n – k + 1) for every side length k from 1 to m; for an n by n grid this equals n(n + 1)(2n + 1)/6. Other polygons in a complex figure are counted by listing them by size, and tilted squares in a dot lattice are counted by the sum of k times (n – k) squared.
At a Glance
- Squares in n by n grid n(n + 1)(2n + 1)/6
- Squares in m by n grid (m <= n) Sum of (m – k + 1)(n – k + 1)
- Chessboard 8 by 8 204
- Tilted squares in n by n dots Sum of k(n – k) squared
- Dot lattice 4 by 4 dots 20 squares in all
- Method for other polygons Count by size, no repeats
Where Does It Fit?
This topic follows Counting the Number of Straight Lines, Rectangles or Other Shapes in a Figure, where the same grid gave rectangles, and Counting Figures Formed by Overlapping Shapes on overlapping shapes. The last topic of the macro, Figure Completion Problems Involving Pattern Continuation Rather Than Piece Matching, moves to pattern continuation, and square counting also supports the cube counting of Counting the Number of Cubes in a Given Solid Arrangement.
How Many Squares Are in a Grid?
In short: count squares of side 1, then side 2, then side 3 and so on, and add; the squares of side k number (m – k + 1)(n – k + 1) in an m by n grid.
Square formulas for a grid of unit cells
- n by n grid: 1 squared + 2 squared + … + n squared = n(n + 1)(2n + 1)/6.
- m by n grid (m not more than n): sum over k = 1 to m of (m – k + 1)(n – k + 1).
- Squares of side k in an n by n grid: (n – k + 1) squared.
| Grid of cells | Squares by side | Total |
|---|---|---|
| 2 by 2 | 4 + 1 | 5 |
| 3 by 3 | 9 + 4 + 1 | 14 |
| 4 by 4 | 16 + 9 + 4 + 1 | 30 |
| 8 by 8 | 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 | 204 |
| 2 by 3 | 6 + 2 | 8 |
| 3 by 5 | 15 + 8 + 3 | 26 |
The number of squares is always smaller than the number of rectangles for the same grid, because squares are the rectangles with equal sides; rectangle counting is in Counting the Number of Straight Lines, Rectangles or Other Shapes in a Figure.
How Do You Count Tilted Squares in a Dot Lattice?
In short: in a lattice of n by n dots, a tilted square is fixed by a bounding square of side k and a starting point, and the count of squares fitting in a bounding square of side k is k, so the total is the sum of k times (n – k) squared.
Squares in an n by n lattice of dots
- Total squares (upright and tilted) = sum for k = 1 to n – 1 of k(n – k) squared.
- Upright squares only = sum for k = 1 to n – 1 of (n – k) squared.
- Tilted squares = total minus upright.
| Dots | Upright squares | Total squares | Tilted squares |
|---|---|---|---|
| 3 by 3 | 5 | 6 | 1 |
| 4 by 4 | 14 | 20 | 6 |
| 5 by 5 | 30 | 50 | 20 |
| 6 by 6 | 55 | 105 | 50 |
A lattice question usually says “squares formed by joining the dots”, so tilted squares count. If only the drawn lines of a grid may be used, tilted squares do not count.
How Do You Count Other Polygons in a Complex Figure?
In short: list the shapes by the number of small regions they contain, and check that each outline lies along drawn lines.
- Choose the shape to count: squares, rectangles, parallelograms, trapeziums.
- Use a line-pair formula for parallelograms: choose two lines from each of two parallel sets.
- Count by size for squares, as in the grid formula.
- Check each outline for lines drawn all the way along its sides.
- Add the counts for each size and compare with a formula if available.
When overlapping shapes make irregular regions, see Counting Figures Formed by Overlapping Shapes.
Solved Examples
Example 1
Question: How many squares are in a chessboard of 8 by 8 cells?
- Squares of side 1 to 8 number 8 squared, 7 squared, …, 1 squared.
- 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204.
- Formula: 8 x 9 x 17 / 6 = 204.
Answer: 204 squares.
Example 2
Question: How many squares are in a grid of 3 rows and 5 columns of cells?
- Side 1: 3 x 5 = 15.
- Side 2: 2 x 4 = 8.
- Side 3: 1 x 3 = 3.
Answer: 15 + 8 + 3 = 26 squares.
Example 3
Question: How many squares (upright and tilted) can be formed by joining the dots of a 3 by 3 lattice of dots?
- Upright squares: 4 of side 1 and 1 of side 2, which is 5.
- Tilted squares: 1, the diamond joining the four edge midpoints.
- Formula: 1 x 2 squared + 2 x 1 squared = 4 + 2 = 6.
Answer: 6 squares.
Example 4
Question: How many squares can be formed by joining the dots of a 4 by 4 lattice of dots?
- Use sum of k(n – k) squared with n = 4: 1 x 9 + 2 x 4 + 3 x 1.
- 9 + 8 + 3 = 20.
Answer: 20 squares (14 upright and 6 tilted).
Example 5
Question: A grid has 5 horizontal lines and 4 vertical lines forming a regular grid of 4 rows and 3 columns of cells. How many squares does it contain?
- Side 1: 4 x 3 = 12.
- Side 2: 3 x 2 = 6.
- Side 3: 2 x 1 = 2.
Answer: 12 + 6 + 2 = 20 squares.
Shortcuts and Tricks
- Memorise 1, 5, 14, 30, 55, 91, 140, 204 for squares in n by n grids with n from 1 to 8.
- For a rectangular grid, stop at the smaller side when adding squares.
- For dot lattices, add the tilted count using k(n – k) squared.
- Confirm whether the question counts tilted squares.
- Remember squares are fewer than rectangles in the same grid.
Common Mistakes
- Counting only the smallest squares.
- Using the n by n formula for a rectangular grid.
- Forgetting tilted squares in a dot lattice question.
- Using the dot count as the cell count.
- Adding squares for sides longer than the smaller side of the grid.
Practice Questions
- How many squares are in a 5 by 5 grid of cells?
- How many squares are in a 4 by 6 grid of cells?
- How many squares are in a 2 by 5 grid of cells?
- How many squares are in a 6 by 6 grid of cells?
- How many squares (including tilted) are formed by the dots of a 5 by 5 lattice of dots?
- How many tilted squares are in a 4 by 4 lattice of dots?
Answers: 1) 55; 2) 50; 3) 14; 4) 91; 5) 50; 6) 6.
Why Is This Topic Important?
- Classic question Chessboard squares are among the best-known reasoning questions.
- Exam use Square counting is asked in SSC, CAPF and railway papers.
- Pattern thinking It links to sums of squares.
- Link The same idea extends to cubes in Counting the Number of Cubes in a Given Solid Arrangement.
What Comes Next?
The next topic is Figure Completion Problems Involving Pattern Continuation Rather Than Piece Matching. It deals with figure completion where the missing part continues a pattern.
Key Terms and Formulas
- Unit cell The smallest square of a grid
- Upright square A square with sides along the grid lines
- Tilted square A square whose sides slope across the lattice
- Dot lattice A regular array of dots
- Bounding square The upright square that holds a tilted square
- Sum of squares 1 squared + 2 squared + … + n squared
Related Topics
- Counting Figures Formed by Overlapping Shapes
- Figure Completion Problems Involving Pattern Continuation Rather Than Piece Matching
- Counting the Number of Triangles in a Given Complex Figure
- Counting the Number of Straight Lines, Rectangles or Other Shapes in a Figure
Related Topics in Maarg Manthan
Study this topic together with these linked topics from other subjects.
- Properties of Square, Rectangle, Parallelogram, Rhombus and Trapezium (Quantitative Aptitude)
Exam Corner
Points to Remember
- n by n grid: n(n + 1)(2n + 1)/6 squares.
- m by n grid: sum of (m – k + 1)(n – k + 1).
- Chessboard has 204 squares.
- Dot lattice squares: sum of k(n – k) squared.
- Squares are fewer than rectangles.
Do Not Confuse With
- Squares vs rectangles Squares have equal sides; rectangles include them.
- Dots vs cells An n by n lattice of dots has n – 1 by n – 1 cells.
- Upright vs tilted Tilted squares use the dots but not the grid lines.
- Square grid vs rectangular grid The formula for rectangular grids stops at the smaller side.
Memory Hook
Count by side length, then add them up.
GS Relevance
Frequently Asked Questions
How many squares are there in a chessboard?
A chessboard has 204 squares. There are 64 of side 1, 49 of side 2, 36 of side 3, 25 of side 4, 16 of side 5, 9 of side 6, 4 of side 7 and 1 of side 8. This equals 8 times 9 times 17 divided by 6, which is 204.
What is the formula for the number of squares in an n by n grid?
The number of squares in an n by n grid of cells is n times n plus 1 times 2n plus 1, divided by 6. It is the sum of 1 squared up to n squared. For n equal to 5 this gives 55 and for n equal to 6 it gives 91.
How do you count squares in a rectangular grid?
For a grid with m rows and n columns, with m not more than n, the number of squares of side k is m minus k plus 1 times n minus k plus 1. Add this for k from 1 up to m. A 3 by 5 grid has 15, 8 and 3 squares, in all 26.
How do you count tilted squares in a dot lattice?
In an n by n lattice of dots, the total number of squares, upright and tilted, is the sum of k times n minus k all squared, for k from 1 to n minus 1. A 4 by 4 lattice has 20 squares, of which 14 are upright and 6 are tilted.
Are there more squares or rectangles in a grid?
A grid always has more rectangles than squares, unless it is a single cell. Squares are the rectangles with equal sides, so they form a subset. A 3 by 3 grid has 14 squares but 36 rectangles, and an 8 by 8 chessboard has 204 squares among 1296 rectangles.
PYQ Practice — Statement Analysis
1 A 4 by 4 grid of cells contains 30 squares.
16 + 9 + 4 + 1 = 30.
2 A chessboard contains 64 squares.
It contains 204 squares; 64 is the number of small cells.
3 A 4 by 4 lattice of dots has 20 squares if tilted squares are counted.
14 upright squares and 6 tilted squares.
4 In a 3 by 5 grid there are squares of side 4.
The smaller side is 3, so the largest square has side 3.
Related Topics
Browse the full Reasoning index