- Practice
- About 13 min
- 5 practice questions
Counting squares, rectangles and triangles in a figure
Count every square and rectangle in a grid with systematic formulas, and every triangle in a triangle cut by lines from one corner.
If something looks wrong, please tell us.
A figure is drawn and you must count all the squares, or all the rectangles, or all the triangles in it, not only the smallest ones. The common mistake is to count the small pieces and forget the larger shapes made by joining them. A systematic count by size fixes this.
Squares in a grid
In an m by n grid of unit squares, count by size. Squares of side 1: m times n. Squares of side 2: (m minus 1) times (n minus 1), because the top-left corner of a 2 by 2 square can be in any place except the last row and column. Squares of side k: (m minus k plus 1) times (n minus k plus 1). Continue until k reaches the smaller of m and n.
| Grid | Working | Total squares |
|---|---|---|
| 2 by 3 | 6 + 2 | 8 |
| 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 |
Rectangles in a grid
A rectangle is fixed by choosing 2 of the m + 1 vertical lines and 2 of the n + 1 horizontal lines. Choosing 2 of m + 1 lines can be done in (m + 1)m divided by 2 ways. So the number of rectangles (squares included) is [m(m + 1) divided by 2] times [n(n + 1) divided by 2]. For a 3 by 3 grid: 6 times 6 = 36. For a 4 by 4 grid: 10 times 10 = 100. For a 2 by 3 grid: 3 times 6 = 18.
Triangles cut by lines from one corner
Take a triangle and draw lines from its top corner to points on the base, so that the base is divided into n parts. Every triangle in the figure has the top corner as one vertex and a piece of the base as its base. A piece of the base runs between two of the n + 1 marked points, so the number of triangles is n(n + 1) divided by 2. For n = 4: 10 triangles.
Worked examples
Example 1. How many squares are there in a 3 by 3 grid? Working: size 1: 9; size 2: 4; size 3: 1. Total 9 + 4 + 1 = 14.
Example 2. How many rectangles that are not squares are there in a 3 by 3 grid? Working: all rectangles 36, squares 14, so 36 minus 14 = 22.
Example 3. How many rectangles are in a 2 by 3 grid? Working: 3 times 6 = 18. Check by size: 1 by 1: 6; 1 by 2: 4; 1 by 3: 2; 2 by 1: 3; 2 by 2: 2; 2 by 3: 1. Total 6 + 4 + 2 + 3 + 2 + 1 = 18.
Example 4. A triangle has lines drawn from the top corner to 3 points on the base, so the base is divided into 4 parts. How many triangles? Working: the 5 marked points on the base (2 corners and 3 new points) give 4 times 5 divided by 2 = 10 triangles.
Squares: add (m - k + 1)(n - k + 1) over every size k. Rectangles: [m(m + 1)/2] times [n(n + 1)/2]. Triangles from one corner: n(n + 1)/2.
Key takeaways
- Count by size, smallest to largest, so that nothing is missed.
- A rectangle is a choice of two vertical and two horizontal lines.
- Rectangles include squares; subtract if the question asks for rectangles that are not squares.
- For triangles from one corner, count pairs of points on the base.
Check your understanding
-
1. How many squares of all sizes are there in a 3 by 3 grid of unit squares?
- 9
- 14
- 13
- 16
Show answer
Answer: B. Squares of side 1: 9. Side 2: 4. Side 3: 1. Total 9 + 4 + 1 = 14.
-
2. How many rectangles (squares included) are there in a 4 by 4 grid of unit squares?
- 70
- 16
- 30
- 100
Show answer
Answer: D. Choose 2 of 5 vertical lines and 2 of 5 horizontal lines: 10 times 10 = 100.
-
3. How many squares of all sizes are there in a 2 by 3 grid of unit squares?
- 8
- 6
- 10
- 12
Show answer
Answer: A. Squares of side 1: 2 times 3 = 6. Squares of side 2: 1 times 2 = 2. Total 8.
-
4. How many squares of all sizes are there on an 8 by 8 chessboard?
- 140
- 64
- 204
- 256
Show answer
Answer: C. 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204.
-
5. The base of a triangle is divided into 4 equal parts, and lines are drawn from the top corner to the dividing points. How many triangles are in the figure?
- 4
- 10
- 6
- 16
Show answer
Answer: B. There are 5 points on the base (the 2 corners and 3 dividing points). Choosing two of 5 gives 5 times 4 divided by 2 = 10 triangles.
Sign in to keep track of the lessons you finish.