Counting Figures: Squares, Triangles and Rectangles in Grids

Counting figures asks how many squares, rectangles or triangles are hidden in a drawing. Most exam figures are grids, triangles cut by lines from a vertex, or squares with diagonals, and each type has a formula. Learn the formulas, then count by size so nothing is missed or counted twice.

Asked in: GAT, HAT, NTS, ISSB, SSC CGL, IBPS PO, CAT

Count by size, never by eye

Random counting always misses shapes. Instead, list the sizes the shape can have, count each size separately, and add.

For example, in a 3 by 3 grid count 1 by 1 squares, then 2 by 2, then 3 by 3. In a triangle figure, count the smallest triangles, then those made of two pieces, three pieces and so on.

Squares in a grid

In an n by n grid, a square of side k can start in (n − k + 1) positions across and (n − k + 1) down, so there are (n − k + 1)² of them. Adding over all k gives the sum of the first n square numbers.

In an m by n grid (m columns, n rows, m at least n), squares of side k number (m − k + 1)(n − k + 1), and k only goes up to n.

Rectangles in a grid

Every rectangle is fixed by choosing 2 of the vertical lines and 2 of the horizontal lines. An m by n grid has m + 1 vertical and n + 1 horizontal lines.

Squares are rectangles too. If a question asks for rectangles that are not squares, subtract the square count.

Triangles from one vertex

If lines are drawn from the top vertex of a triangle to its base, every triangle uses the top vertex, two of the lines leaving it, and the base. With L lines leaving the vertex (the two sides included), that is C(L, 2).

Each line drawn parallel to the base works as another base, so multiply by the number of horizontal lines (the base included).

Triangular grids

When each side of an equilateral triangle is cut into n equal parts and lines are drawn parallel to the sides, count upright and upside-down triangles separately.

Upright triangles of size k: (n − k + 1)(n − k + 2) ÷ 2. Upside-down triangles of size k exist only when 2k is at most n, and number (n − 2k + 1)(n − 2k + 2) ÷ 2.

Squares with diagonals

A square with both diagonals has 8 triangles: 4 small and 4 halves. Adding the two midlines (joining midpoints of opposite sides) raises this to 16.

For mixed figures, give the smallest piece an area value and group triangles by area. Triangles of equal area usually come in symmetric sets of 4 or 8, which is a quick check.

Solved examples

  1. How many squares are there in a 2 by 2 grid of four equal small squares?
    1. Size 1: 4 small squares.
    2. Size 2: the whole figure, 1 square.
    3. Check with the formula: 2 × 3 × 5 ÷ 6 = 5.
    Answer: 5 squares
  2. A rectangle is divided into a grid of 3 columns and 2 rows of equal squares. How many rectangles does it contain, and how many of them are squares?
    1. Lines: 4 vertical and 3 horizontal.
    2. Rectangles = C(4,2) × C(3,2) = 6 × 3 = 18.
    3. Squares: size 1 gives 3 × 2 = 6, size 2 gives 2 × 1 = 2, total 8.
    4. So 18 rectangles, of which 8 are squares and 10 are not.
    Answer: 18 rectangles, 8 of them squares
  3. How many squares are there in a grid of 6 columns and 4 rows of equal squares?
    1. Size 1: 6 × 4 = 24.
    2. Size 2: 5 × 3 = 15.
    3. Size 3: 4 × 2 = 8.
    4. Size 4: 3 × 1 = 3.
    5. Total = 24 + 15 + 8 + 3 = 50.
    Answer: 50 squares
  4. In a triangle, 3 lines are drawn from the top vertex to the base. How many triangles are formed? Ayesha counts the smallest ones first; check her total with the formula.
    1. Smallest triangles: 4. Two pieces together: 3. Three pieces: 2. Four pieces (the whole): 1.
    2. Sum = 4 + 3 + 2 + 1 = 10.
    3. Formula: lines leaving the vertex = 2 sides + 3 = 5, so C(5,2) = 10.
    Answer: 10 triangles
  5. In a triangle, 2 lines are drawn from the top vertex to the base and 2 lines are drawn parallel to the base across the whole triangle. How many triangles are there?
    1. Lines leaving the top vertex: L = 2 + 2 = 4, so each base gives C(4,2) = 6 triangles.
    2. Horizontal lines including the base: H = 3.
    3. Total = 6 × 3 = 18.
    Answer: 18 triangles
  6. Each side of an equilateral triangle is divided into 4 equal parts and lines are drawn parallel to the sides. How many triangles are there?
    1. Upright: size 1 gives 10, size 2 gives 6, size 3 gives 3, size 4 gives 1, so 20.
    2. Upside down: size 1 gives 6, size 2 gives 1, so 7.
    3. Total = 20 + 7 = 27, matching 4 × 6 × 9 ÷ 8 = 27.
    Answer: 27 triangles

Exam shortcuts

Common mistakes

Practice MCQs

  1. A square is divided into a 3 by 3 grid of nine equal small squares. How many squares of all sizes are there in the figure?
    A) 9
    B) 14
    C) 10
    D) 13
    Answer: B) 14 — Count by size: 1 by 1 squares number 3 × 3 = 9, 2 by 2 squares number 2 × 2 = 4, and the whole 3 by 3 square is 1. Total 9 + 4 + 1 = 14. 9 counts only the small squares, 10 adds just the outer square, and 13 forgets the outer square.
  2. A square has both of its diagonals drawn. How many triangles are there in the figure?
    A) 4
    B) 6
    C) 10
    D) 8
    Answer: D) 8 — The diagonals cut the square into 4 small triangles. Each diagonal on its own also cuts the square into 2 large triangles, and there are 2 diagonals, giving 4 more. Total 4 + 4 = 8. 4 counts only the small pieces; 6 and 10 miscount the large halves.
  3. A rectangle is divided into a single row of 5 equal small squares by 4 vertical lines. How many rectangles (squares included) are there in the figure?
    A) 15
    B) 5
    C) 10
    D) 14
    Answer: A) 15 — There are 6 vertical lines and 2 horizontal lines. A rectangle is fixed by choosing 2 vertical lines and 2 horizontal lines: C(6,2) × C(2,2) = 15 × 1 = 15. Equivalently 5 + 4 + 3 + 2 + 1 = 15. 5 counts only the small squares, 10 stops at blocks of two, and 14 forgets the whole strip.
  4. In a triangle, 3 straight lines are drawn from the top vertex to the base, dividing the base into 4 parts. How many triangles are there in the figure?
    A) 4
    B) 6
    C) 10
    D) 8
    Answer: C) 10 — Every triangle uses the top vertex and two of the 5 lines that leave it (the 2 sides plus the 3 inner lines), with the base as the third side. So the count is C(5,2) = 10, the same as 4 + 3 + 2 + 1. 4 counts only the smallest triangles, while 6 and 8 miss some of the wider combinations.
  5. A square is divided into a 4 by 4 grid of sixteen equal small squares. How many squares of all sizes are there?
    A) 30
    B) 16
    C) 25
    D) 20
    Answer: A) 30 — Use 1² + 2² + 3² + 4² = 1 + 4 + 9 + 16 = 30: there are 16 squares of size 1, 9 of size 2, 4 of size 3 and 1 of size 4. 16 counts only the smallest squares, 25 is the answer for a 5 by 5 grid's smallest squares, and 20 misses the larger sizes.
  6. A square is divided into a 3 by 3 grid of nine equal small squares. How many rectangles (squares included) are there in the figure?
    A) 14
    B) 36
    C) 22
    D) 30
    Answer: B) 36 — A 3 by 3 grid has 4 vertical and 4 horizontal lines. Choose 2 of each: C(4,2) × C(4,2) = 6 × 6 = 36. 14 is the number of squares only, 22 is the number of non-square rectangles, and 30 is the square count for a 4 by 4 grid.
  7. A square is divided into a 3 by 3 grid of nine equal small squares. How many of the rectangles in the figure are not squares?
    A) 14
    B) 36
    C) 18
    D) 22
    Answer: D) 22 — All rectangles: C(4,2) × C(4,2) = 36. Squares among them: 9 + 4 + 1 = 14. Rectangles that are not squares = 36 − 14 = 22. 36 includes the squares, 14 is the squares alone, and 18 subtracts the wrong number.
  8. A square has both diagonals drawn and also the two lines joining the midpoints of opposite sides, so four lines pass through the centre. How many triangles are there in the figure?
    A) 8
    B) 12
    C) 16
    D) 20
    Answer: C) 16 — Smallest triangles: the 4 lines through the centre make 8 thin pieces. Triangles of two pieces with a side of the square as base and the centre as top: 4. Halves of the square cut by a diagonal: 4. Total 8 + 4 + 4 = 16. 8 counts only the smallest, 12 misses one size, and 20 counts shapes that are not triangles.
  9. In a triangle, 2 straight lines are drawn from the top vertex to the base, and 1 line is drawn parallel to the base, cutting across the whole triangle. How many triangles are there in the figure?
    A) 6
    B) 9
    C) 10
    D) 12
    Answer: D) 12 — There are 4 lines leaving the top vertex (2 sides and 2 inner lines). With the base as the third side they give C(4,2) = 6 triangles; with the parallel line as the third side they give another 6. Total 6 × 2 = 12. 6 ignores the parallel line, 9 and 10 miss some combinations.
  10. Each side of an equilateral triangle is divided into 3 equal parts, and lines are drawn through these points parallel to the sides, making 9 small equilateral triangles. How many triangles are there in all?
    A) 13
    B) 9
    C) 10
    D) 12
    Answer: A) 13 — Upright triangles: 6 of size 1, 3 of size 2 and 1 of size 3, which is 10. Upside-down triangles: only size 1 fits, and there are 3. Total 10 + 3 = 13. 9 counts only the smallest pieces, 10 counts only the upright ones, and 12 misses one triangle.
  11. A rectangle is divided into a grid that is 5 squares long and 3 squares wide (15 equal small squares). How many squares of all sizes are there?
    A) 15
    B) 23
    C) 26
    D) 30
    Answer: C) 26 — Size 1: 5 × 3 = 15. Size 2: 4 × 2 = 8. Size 3: 3 × 1 = 3. A 4 by 4 square cannot fit in a grid only 3 wide. Total 15 + 8 + 3 = 26. 15 counts only the smallest squares, 23 misses the size-3 squares, and 30 wrongly adds a larger size.
  12. All three medians of a triangle are drawn (each joins a vertex to the midpoint of the opposite side). How many triangles are there in the figure?
    A) 6
    B) 16
    C) 12
    D) 18
    Answer: B) 16 — The medians cut the triangle into 6 small triangles. The two small triangles on either side of the short median piece running from the centroid to a side's midpoint join into a triangle with that full side as base: 3 such triangles. Each median splits the whole triangle into 2 halves, giving 6. Add the whole triangle: 6 + 3 + 6 + 1 = 16. 6 counts only the smallest pieces; 12 and 18 miss or double-count sizes.
  13. A rectangle is divided into a grid of 4 columns and 3 rows of equal squares. How many rectangles (squares included) are there?
    A) 60
    B) 20
    C) 48
    D) 72
    Answer: A) 60 — There are 5 vertical lines and 4 horizontal lines. Choose 2 of each: C(5,2) × C(4,2) = 10 × 6 = 60. 20 is the number of squares only, 48 and 72 come from using the wrong number of lines in one direction.
  14. A chessboard is an 8 by 8 grid of equal squares. How many squares of all sizes does it contain?
    A) 64
    B) 196
    C) 1296
    D) 204
    Answer: D) 204 — Add the squares of 1 to 8: 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 = 204, or use 8 × 9 × 17 ÷ 6 = 204. 64 counts only the smallest squares, 196 (which is 14²) is not the sum of the squares from 1² to 8², and 1296 is the number of all rectangles on the board.
  15. A square is divided into four equal smaller squares by joining the midpoints of opposite sides. Then both diagonals of each small square are drawn. How many triangles are there in the figure?
    A) 16
    B) 44
    C) 32
    D) 40
    Answer: B) 44 — Take the big square as 16 area units. Smallest triangles (a quarter of a small square, area 1): 16. Halves of a small square (area 2): each small square has 4, so 16. Area-4 triangles: 4 standing on a side of the big square with the centre as top, plus 4 formed by a midline and the tilted square through the side midpoints: 8. Halves of the big square (area 8): 4. Total 16 + 16 + 8 + 4 = 44. 16 and 32 stop at the small sizes and 40 misses the big halves.

Questions

Is a square counted as a rectangle?

Yes. Unless the question says rectangles that are not squares, every square is also counted as a rectangle.

Why does the rectangle formula use lines and not boxes?

A rectangle's four sides lie on two vertical and two horizontal grid lines, so choosing those lines fixes the rectangle exactly once.

What is the fastest way to count triangles in an irregular figure?

Label the points, then count triangles by size or by the smallest pieces they contain. Symmetry helps: equal shapes usually appear in sets of 2, 4 or 8.

How many rectangles are on a chessboard?

An 8 by 8 board has 9 lines each way, so C(9,2) × C(9,2) = 36 × 36 = 1296 rectangles, of which 204 are squares.