TECHNOLOGIESTieInn Technologies

Permutations and combinations

Counting: handshakes, diagonals and lines

6 min read · 8 practice questions · free

Useful for:IT testsBanksSSC / Railways

What it is

Many counting questions are really about pairs:

  • every person shakes hands with every other once
  • every corner of a polygon is joined to every other (sides + diagonals)
  • a line is drawn through every pair of points

How to solve it

  • Pairs from n: ⁿC₂ = n(n − 1)/2
  • Handshakes in a group of n: n(n − 1)/2
  • Diagonals of an n-sided polygon: n(n − 1)/2 − n = n(n − 3)/2
  • Lines through n points, with m of them in one straight line: ⁿC₂ − ᵐC₂ + 1 (the m points give only one line)
  • Triangles from n points with m in a line: ⁿC₃ − ᵐC₃

Tips and shortcuts

  • Each handshake involves two people, so n × (n − 1) counts every handshake twice.
  • Matches in a round-robin tournament are handshakes too: every team plays every other once.
  • Reverse questions: "66 handshakes" → n(n − 1)/2 = 66 → n = 12.
  • A triangle has no diagonals, a square 2, a pentagon 5, a hexagon 9.

Solved examples

Example 1 (easy): handshakes

At a party, 15 people each shake hands with everyone else once. Handshakes?

15 × 14/2 = 105.

Example 2 (medium): diagonals

Diagonals of a 10-sided polygon?

10 × 7/2 = 35.

Example 3 (hard): collinear points

10 points, of which 4 are in a straight line. How many lines through pairs?

45 − 6 + 1 = 40.

Example 4 (medium): reverse

In a meeting there were 45 handshakes. How many people?

n(n − 1)/2 = 45 → n = 10.

Example 5 (hard): triangles

From 8 points, 3 of them in a straight line, how many triangles?

8C3 − 3C3 = 56 − 1 = 55.

Try it

Pick an answer and press Check. Generated questions get new numbers every time you ask.

  1. Question 1easy

    21 people at a meeting each shake hands with every other person once. How many handshakes are there?

  2. Question 2easy

    7 people at a meeting each shake hands with every other person once. How many handshakes are there?

  3. Question 3easy

    12 people at a meeting each shake hands with every other person once. How many handshakes are there?

  4. Question 4medium

    How many diagonals does a polygon with 6 sides have?

  5. Question 5medium

    How many diagonals does a polygon with 15 sides have?

  6. Question 6medium

    How many diagonals does a polygon with 17 sides have?

  7. Question 7hard

    There are 9 points in a plane, of which 6 lie on one straight line; no other three are in a line. How many straight lines can be drawn through pairs of these points?

  8. Question 8hard

    There are 16 points in a plane, of which 5 lie on one straight line; no other three are in a line. How many straight lines can be drawn through pairs of these points?

Ready for a timed set?

Fresh questions on just this problem type, with a score and every explanation at the end. Free.

Test me on this →