On this page
If 10 people meet and each person shakes hands with everyone else exactly once, exactly 45 handshakes happen.
This counting problem appears everywhere from school exams to software engineering interviews. The underlying mathematics does not just count handshakes; it governs network connections, the scheduling of league sports, and the number of ways to pair objects up.
Why is the formula n(n−1)/2?
Imagine n people in a room. If each person shakes hands with everyone else, they each perform n−1 handshakes (because they do not shake hands with themselves).
If you simply multiply the number of people by the number of hands each person shakes, you get n(n−1). However, this counts every handshake two times, since Person A shaking hands with Person B is the exact same event as Person B shaking hands with Person A. To find the true total, you must divide the result by two, a rule grounded in graph theory where the number of unique edges is half the sum of the vertex degrees (Wikipedia).
This gives the standard formula: Total = n(n−1)/2.
In combinatorics, this is identical to choosing 2 items from a group of n, written as ⁿC₂. Understanding the intuition behind formulas like this—rather than just memorising them—is often where a student gets stuck. If you find yourself forgetting which formula to use, Fermi's AI tutor can work out what you already know and build a plan for the session, guiding you to derive the logic yourself.
How do league matches differ from knockout tournaments?
The mathematics of handshakes maps directly onto sports tournaments.
If a league plays a single round-robin format, every team plays every other team exactly once (Wikipedia). This means a league with n teams will require exactly n(n−1)/2 matches. If the league plays a double round-robin format where pairs meet twice, you simply do not divide by two, resulting in n(n−1) matches.
A knockout (or single-elimination) tournament works on a different principle. In a single-elimination format, the loser of each match-up is immediately eliminated (Wikipedia). To declare one winner out of n teams, you must eliminate n−1 teams. Since each match eliminates exactly one team, a knockout tournament with n competitors will always require exactly n−1 matches. For example, a 64-team tennis tournament needs exactly 63 matches to crown a champion.
How do you find n from the total number of handshakes?
Sometimes an exam question gives you the total number of handshakes or matches and asks you to find n, the number of people or teams.
Set up the equation: n(n−1)/2 = 66
Multiply by 2: n(n−1) = 132
Expand the brackets: n² − n = 132
Rearrange into a standard quadratic: n² − n − 132 = 0
Factorise the quadratic: (n − 12)(n + 11) = 0
The solutions are n = 12 or n = −11. Since you cannot have a negative number of people, there must have been 12 people at the meeting.
If you struggle with setting up equations from word problems, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than just printing an answer.
For related counting principles, see Permutations and combinations: how to stop double counting or review At least one, at most two: selection problems with combinations.



