I am a former maths teacher and owner of DoingMaths. I love writing about maths, its applications and fun mathematical facts.
The Handshake Problem
The handshake problem is very simple to explain. Basically, if you have a room full of people, how many handshakes are needed for each person to have shaken everybody else's hand exactly once?
For small groups, the solution is quite simple and can be counted fairly quickly, but what about for 20 people? or 50? or 1000? In this article, we will look at how to work out the answers to these questions methodically and create a formula that can be used for any number of people.
Let's start by looking at solutions for small groups of people.
For a group of 2 people, the answer is obvious: only 1 handshake is needed.
For a group of 3 people, person 1 will shake the hands of person 2 and person 3. This just leaves person 2 and person 3 to shake hands with each, other for a total of 3 handshakes.
For groups larger than 3, we will require a methodical way of counting to ensure we don't miss out or repeat any handshakes, but the math is still fairly simple.
Groups of Four People
Let's suppose we have 4 people in a room, whom we shall call A, B, C and D. We can split this into separate steps to make counting easier.
- Person A shakes hands with each of the other people in turn—3 handshakes.
- Person B has now shaken hands with A, still needs to shake hands with C and D—2 more handshakes.
- Person C has now shaken hands with A and B, but still needs to shake D's hand—1 more handshake.
- Person D has now shaken hands with everybody.
Our total number of handshakes is therefore 3 + 2 + 1 = 6.
If you look closely at our calculation for the group of four, you can see a pattern that we can use to continue to work out the number of handshakes needed for different sized groups. Suppose we have n people in a room.
- The first person shakes hands with everybody in the room except for himself. His total number of handshakes is therefore 1 lower than the total number of people.
- The second person has now shaken hands with the first person, but still needs to shake hands with everybody else. The number of people left is therefore 2 lower than the total number of people in the room.
- The third person has now shaken hands with the first and second people. That means the remaining number of handshakes for him is 3 lower than the total number of people in the room.
- This continues with each person having one less handshake to make until we get to the penultimate person, who only has to shake hands with the last person.
Using this logic we get the numbers of handshakes shown in the table below.
The Number of Handshakes Required for Different Sized Groups
|Number of People in the Room||Number of Handshakes Required|
Creating a Formula for the Handshake Problem
Our method so far is great for fairly small groupings, but it is still going to take a while for larger groups. For this reason, we're going to create an algebraic formula to instantly calculate the number of handshakes required for any size group.
Suppose you have n people in a room. Using our logic from above:
- Person 1 shakes n - 1 hands
- Person 2 shakes n - 2 hands
- Person 3 shakes n - 3 hands
- and so on until you get to the penultimate person shaking the 1 remaining hand.
This gives us the following formula:
Number of handshakes for a group of n people = (n - 1) + (n - 2) + (n - 3) + ... + 2 + 1.
This is still a little bit long, but there is a quick and convenient way to simplify it. Consider what happens if we add the first and last terms together: (n - 1) + 1 = n.
If we do the same thing for the second and second to last terms we get: (n - 2) + 2 = n.
In fact, if we do this all the way down we get n each time. There are obviously n - 1 terms in our original series as we are adding the numbers from 1 to n - 1. Therefore, by adding the terms as above, we get n lots of n - 1. We've effectively added our entire sequence to itself here, so to get back to the sum we require we need to halve this answer. This gives us a formula of:
Number of handshakes for a group of n people = n × (n - 1) / 2.
We can now use this formula to calculate the results for much larger groups.
|Number of People in Room||Number of Handshakes Required|
An Interesting Aside: Triangular Numbers
If you look at the number of handshakes required for each group you can see that each time the group size increases by one, the increase in handshakes is one more than the previous increase had been. i.e.
- 2 people = 1
- 3 people = 1 + 2
- 4 people = 1 + 2 + 3
- 5 people = 1 + 2 + 3 + 4, and so on.
The list of numbers created by this method, 1, 3, 6, 10, 15, 21, ... is known as the "triangular numbers." If we use the notation Tn to describe the nth triangular number, then for a group of n people, the number of handshakes required will always be Tn-1.
Questions & Answers
Question: A meeting was attended by some people. Before the start of the meeting, each of them had handshakes with every other exactly once. The total number of handshakes thus made was counted and found to be 36. How many persons attended the meeting based on the handshake problem?
Answer: Setting our formula equal to 36 we get n x (n-1)/2 = 36.
n x (n-1) = 72
n = 9
So there are 9 people in the meeting.
© 2020 David