ExamSaathi learning library · Government exams · SSC CGL general intelligence and reasoning; published syllabus labelled 2024 · General intelligence and reasoning

Counting figures: triangles, squares and rectangles in a diagram

Count triangles, squares and rectangles in a figure described in words by labelling its points and counting size by size, plus quick rules for grids, triangles cut from one corner, and points and diagonals.

Status: original pilot lesson. Teacher review is pending. It is not a complete course or official exam material.

You will learn to

Before you start

These questions show a figure of straight lines and ask how many triangles, squares or rectangles it holds. With no pictures here, each figure is given in words; draw it as you read. A triangle needs three corners that are not on one straight line, joined by three drawn lines. A figure may be one small closed piece or several neighbouring pieces taken together, so large figures hide among the small ones. A rectangle needs all four sides drawn, and every square also counts as a rectangle. The same three letters in another order, such as ABO and OBA, name the same triangle. The letters n, m, k and h stand for counts, and x means multiply.

Label every point, then count in order

First give a letter to every corner and every crossing point. Then count in a fixed order, writing each figure down as letters so that none is missed or counted twice. By size: count the smallest pieces, then figures made of two pieces, then three, and so on up to the whole figure. By corner: list the triangles that use A, then those that use B but not A, and so on. Example: square ABCD, with A top left, B top right, C bottom right and D bottom left, and both diagonals drawn, crossing at O. One piece: AOB, BOC, COD and DOA. Two pieces: ABC, BCD, CDA and DAB. Three pieces never make a triangle here, and all four make the square. Total: 4 + 4 = 8 triangles.

Squares and rectangles in a grid

Take a board ruled into n rows and n columns of equal small squares. It has n^2 squares of side 1 and (n - 1)^2 of side 2, because each square is fixed by its top-left cell, and so on down to 1 square of side n. Adding every size gives n^2 + (n - 1)^2 + ... + 1^2, which equals n(n + 1)(2n + 1)/6. A 3 by 3 board has 9 + 4 + 1 = 14 squares, and a chessboard, n = 8, has 8 x 9 x 17 / 6 = 204. For rectangles, look at the lines: an m by n grid has m + 1 vertical and n + 1 horizontal lines, and each rectangle is fixed by picking two of each. Two lines out of m + 1 can be picked in m(m + 1)/2 ways, so there are [m(m + 1)/2] x [n(n + 1)/2] rectangles, squares included. A chessboard has 36 x 36 = 1,296, of which 1,092 are not squares. In a grid that is not square, count the squares size by size.

A triangle cut by lines from its top corner

Let triangle PQR have P at the top and QR as its base, and draw k straight lines from P to k different points strictly between Q and R, so no line ends at Q or R and no two end at the same point. With PQ and PR there are now k + 2 different lines through P, and any two of them, closed by the base, form one triangle, so there are (k + 2)(k + 1)/2 triangles. Next draw h lines parallel to QR, each running from side PQ to side PR and crossing every line from P. Each of the h + 1 horizontal lines (the base included) closes every pair, so the count becomes (h + 1)(k + 1)(k + 2)/2. With k = 2 and no parallel line there are 4 x 3 / 2 = 6 triangles; one parallel line doubles this to 12.

Points, lines and diagonals

Some questions give n points with no three on one straight line. Each line through two of them is fixed by a pair of points, so there are n(n - 1)/2 lines, and each triangle is fixed by three points, so there are n(n - 1)(n - 2)/6 triangles. In a polygon with n sides, each corner sends a diagonal to the n - 3 corners that are not itself or its two neighbours, and each diagonal is counted from both ends, so there are n(n - 3)/2 diagonals. With 6 points: 15 lines and 20 triangles, and a 6-sided figure has 9 diagonals.

Common mistakes

Counting only the smallest pieces and missing big figures made of several pieces. Naming one triangle twice in a different letter order. Counting three points on one straight line as a triangle. Giving n^2 as the number of squares on an n by n board. Leaving out the squares when a question says rectangles, squares included. Using k + 1 lines through the top corner instead of k + 2, or forgetting to multiply by h + 1. Giving n(n - 1)/2 for diagonals, which also counts the n sides.

A routine for counting figures

1. Draw the figure from the words and label every corner and crossing. 2. Pick one order, by size or by corner, and keep to it. 3. Write each figure as letters and tick it off. 4. For a full grid, use the square and rectangle rules; for a triangle cut from its top corner, use (h + 1)(k + 1)(k + 2)/2. 5. For points and polygons, use n(n - 1)/2, n(n - 1)(n - 2)/6 and n(n - 3)/2. 6. If time allows, recount in the other order.

Worked examples

  1. Square ABCD has A at the top left, B top right, C bottom right and D bottom left. Both diagonals are drawn and cross at O. E, F, G and H are the midpoints of AB, BC, CD and DA, and the lines EG and HF are drawn; both pass through O. How many triangles are there?

    1. The four lines through O cut the square into 8 small triangles: AOE, EOB, BOF, FOC, COG, GOD, DOH and HOA.
    2. Two pieces: AOB, BOC, COD and DOA.
    3. Four pieces: ABC, BCD, CDA and DAB.
    4. No other group of pieces has three drawn sides; for example, no line joins E to F.

    Answer: 8 + 4 + 4 = 16 triangles.

  2. A sheet is ruled into equal small squares, 4 columns wide and 3 rows high. How many squares and how many rectangles (squares included) does it contain?

    1. Squares of side 1: 4 x 3 = 12. Side 2: 3 x 2 = 6. Side 3: 2 x 1 = 2. No side-4 square fits, so there are 12 + 6 + 2 = 20 squares.
    2. The 5 vertical lines give 5 x 4 / 2 = 10 pairs, and the 4 horizontal lines give 4 x 3 / 2 = 6 pairs.
    3. Rectangles: 10 x 6 = 60, of which 40 are not squares.

    Answer: 20 squares and 60 rectangles, squares included.

  3. In triangle LMN, L is the top corner and MN the base. Four straight lines are drawn from L to four different points strictly between M and N, and two lines parallel to MN cross the triangle, each meeting every line from L. How many triangles are there?

    1. Lines through L: LM, LN and the 4 new ones, 6 in all, so k = 4.
    2. Closed by the base alone: 6 x 5 / 2 = 15 triangles, one for each pair of lines through L.
    3. There are 3 horizontal lines (the base and the 2 parallels), and each closes every pair: 15 x 3 = 45.

    Answer: 45 triangles.

Practice checks

  1. Square PQRS has P at the top left, Q top right, R bottom right and S bottom left. Its diagonals PR and QS cross at O, and a straight line joins M, the midpoint of PQ, to N, the midpoint of SR, passing through O. How many triangles does the figure contain?
  2. How many rectangles, squares included, are there in a grid of equal small squares 5 columns wide and 4 rows high?
  3. In triangle ABC, A is the top corner. Three straight lines are drawn from A to three different points strictly between B and C, and one line parallel to BC runs from AB to AC, crossing all of them. How many triangles are there?
  4. Ten points are marked on a circle, so no three of them lie on one straight line. How many triangles have all three corners at these points?
  5. How many diagonals does a polygon with 12 sides have?

Sources checked