English
/

The Handshake Problem: How Many Handshakes, and Why

Last edited Nov 6, 2026 · 7 min read

If n people each shake hands with everyone else exactly once, there are n times (n minus 1), divided by 2 handshakes: 10 people make 45, and 20 make 190. The same count gives games in a round-robin tournament or lines between points.

On this page▾
  1. Two ways to count
  2. The mistake NRICH points out
  3. Quick table
  4. Running it backward
  5. Puzzle 1
  6. Puzzle 2
  7. Puzzle 3
  8. Puzzle 4
  9. Puzzle 5
  10. Answers
  11. Why the formula keeps showing up
  12. Frequently asked questions
  13. How many handshakes are there among 20 people?
  14. Can there be exactly 4851 handshakes at a gathering where everyone shakes hands?
  15. Why do you divide by 2?

Handshake calculator

Handshakes = n × (n − 1) ÷ 2. Backward: double the total and look for two consecutive whole numbers that multiply to it. Two separate groups: multiply the sizes, no halving.

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.

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.

The mistake NRICH points out

In NRICH's problem, Sam reasons that with 20 mathematicians, each shakes hands 19 times, so there must be 20 times 19 handshakes. Helen disagrees: she 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.

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.

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.

Puzzle 1

Twelve people meet, and everyone shakes hands with everyone else once. How many handshakes are there?

Puzzle 2

At a meeting there were exactly 45 handshakes, one between every pair of people. How many people were there?

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?

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?

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?

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.

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.

Another counting trick, the squares on a chessboard, is worked through in How Many Squares Are on a Chessboard? The Counting Trick.

Frequently asked questions

How many handshakes are there among 20 people?

20 times 19 is 380, and halving it gives 190. This is the 20-mathematician case NRICH uses to show why Sam's 20 times 19 counts every handshake twice.

Can there be exactly 4851 handshakes at a gathering where everyone shakes hands?

Yes. Double it to get 9,702, which is 98 times 99, so there would be 99 people. NRICH poses this question.

Why do you divide by 2?

Multiplying each person's handshakes by the number of people counts every handshake from both ends, so each one is counted twice.

Sources

  1. NRICH, University of Cambridge Millennium Mathematics Project, Handshakes
  2. NRICH, University of Cambridge Millennium Mathematics Project, Developing Mathematical Thinking: Working Systematically

About this guide

Howlane operator · Checked against the official sources listed above. It is general information, not professional advice.

AboutEditorial standardsCorrectionsReport an error

Edit history

  • Updated
  • Updated
  • Updated
  • Updated
  • Published