The Handshake Problem: How Many Handshakes, and Why
If everyone at a gathering shakes hands with everyone else exactly once, how many handshakes happen? It sounds like a party question, but it is one of the most useful counting puzzles there is, and the same idea counts games in a round-robin tournament or lines between points.
NRICH, the mathematics enrichment project at the University of Cambridge, builds a whole problem around it, called Handshakes. It starts with seven mathematicians and grows to 161, then turns the question around. Below are the formula, the common mistake NRICH highlights, and five original puzzles. Every answer was checked by counting all the possibilities directly.
1. Two ways to count
Way 1: add up as people arrive. NRICH describes it this way. The first person shakes hands with everyone else. The second shakes with everyone except the first, since they already shook. The third shakes with everyone except the first two, and so on. With 5 people, that is 4 + 3 + 2 + 1, or 10 handshakes.
Way 2: count hands, then fix the double count. Each of the 5 people shakes 4 hands, which gives 5 times 4, or 20. But every handshake involves two people, so each one was counted twice. Halve it: 10.
Both methods agree. The second gives the general formula:
Handshakes = n times (n minus 1), divided by 2.
2. The mistake NRICH points out
In NRICH's problem, a student called Sam reasons that with 20 mathematicians, each shakes hands 19 times, so there must be 20 times 19 handshakes. Another student adds 19 + 18 + ... + 1 and gets a different total. NRICH asks what went wrong with Sam's method and how to fix it. The fix is Way 2 above: Sam counted every handshake from both ends.
3. Quick table
| People | Handshakes |
|---|---|
| 2 | 1 |
| 3 | 3 |
| 4 | 6 |
| 5 | 10 |
| 6 | 15 |
| 8 | 28 |
| 10 | 45 |
Each new person adds as many handshakes as there were people already in the room. Going from 5 to 6 people adds 5.
4. Running it backward
NRICH also asks whether a given total is possible at all. If you know the number of handshakes, double it and look for two consecutive whole numbers that multiply to that result. If none exist, no gathering produces that total. NRICH's own list of totals is a good test of this, and the answers are left for you.
5. Puzzle 1
Twelve people meet, and everyone shakes hands with everyone else once. How many handshakes are there?
6. Puzzle 2
At a meeting there were exactly 45 handshakes, one between every pair of people. How many people were there?
7. Puzzle 3
After a match, each of 6 players on one team shakes hands with each of 6 players on the other team. Teammates do not shake hands with each other. How many handshakes are there?
8. Puzzle 4
Five couples attend a dinner. Everyone shakes hands with everyone else once, except that nobody shakes hands with their own partner. How many handshakes are there?
9. Puzzle 5
You and your partner go to a party with two other couples, so 6 people are there. Some pairs shake hands; nobody shakes their own partner's hand, and no pair shakes more than once. Afterward you ask the other 5 people how many hands they shook, and you get 5 different answers. How many hands did your partner shake?
10. Answers
Puzzle 1: 66. 12 times 11 is 132, and half of that is 66.
Puzzle 2: 10 people. Double 45 to get 90, which is 10 times 9. Check: 10 times 9, divided by 2, is 45.
Puzzle 3: 36. Each of the 6 players shakes 6 hands on the other side, and here nothing is counted twice, because every handshake has one player from each team. 6 times 6 is 36.
Puzzle 4: 40. Ten people would make 45 handshakes, but the 5 partner pairs do not shake, so 45 minus 5 is 40.
Puzzle 5: 2. Nobody can shake more than 4 hands: there are 6 people, and you skip yourself and your partner. So 5 different answers must be exactly 0, 1, 2, 3, and 4.
- The person who shook 4 shook everyone except their partner. That means everyone else shook at least one hand, so the person who shook 0 must be the partner of the person who shook 4.
- Set that couple aside. Everyone remaining has lost exactly one handshake (the one with the 4-person). The person who shook 3 now behaves like a 2, and the same argument pairs them with the person who shook 1.
- That leaves one answer, 2, and it belongs to your partner.
A check of all 4,096 ways the 12 allowed handshakes could happen or not found 8 arrangements that match the story, and in every one of them your partner shook 2 hands. You did too.
11. Why the formula keeps showing up
The same count answers many questions that look different: games in a league where every team plays every other team once, straight lines joining dots on a circle, or pairs you can pick from a group. Whenever the question is "how many pairs," n times (n minus 1), divided by 2, is the place to start. NRICH's guidance on working systematically is useful here too: list small cases in order, and the pattern in the table above appears quickly.
12. Key takeaways
- With n people all shaking hands once, there are n times (n minus 1), divided by 2, handshakes.
- Multiplying each person's handshakes by the number of people counts every handshake twice, so halve it.
- To run it backward, double the total and look for two consecutive whole numbers that multiply to it.
- When two separate groups only shake across, multiply the group sizes and do not halve.
- In the party puzzle, the possible answers 0 to 4 pair up into couples, which forces your partner's answer.