DoingMaths - Free maths worksheets
  • Home
  • Algebra
    • Algebraic expressions
    • Algebraic equations
    • Expanding brackets
    • Index notation
    • Inequalities
    • Quadratic equations
    • Sequences
    • Simultaneous equations
    • Straight line graphs
    • Substitution
  • Shapes, space and measures
    • Angles
    • Circles
    • Circle theorems
    • Compound measures
    • Construction
    • Distance/speed-time graphs
    • Length, area and volume
    • Metric and Imperial conversions
    • Metric units of measurement
    • Proof
    • Pythagoras' Theorem
    • Scale factors, similarity and congruence
    • Symmetry and reflection
    • Time
    • Trigonometry
  • Number
    • Primary Addition and Subtraction
    • Addition and subtraction
    • Basic number work
    • BODMAS/PEMDAS/BIDMAS
    • Compound percentage change
    • Decimals
    • Factors and Multiples
    • Fractions
    • Fractions, decimals and percentages
    • Money
    • Multiplication and division
    • Percentages
    • Ratio and Proportion
    • Rounding and estimating
    • Standard form
  • Statistics and Probability
    • Averages and the Range
    • Box plots
    • Collecting data
    • Pie charts
    • Probability
  • More
    • Starters >
      • Puzzles and riddles
      • Maths Wordsearches
      • More Maths Lesson Starter Ideas
    • Christmas Maths Activities
    • Maths Articles >
      • Revision and How-To Guides >
        • How do Scale Factors Work for Area and Volume?
        • Edexcel GCSE Maths 2023 Paper 2: The Final Question
        • How to Find the Average From a Frequency Table
        • What Do the Angles in a Polygon Add Up To?
        • How to Integrate by Parts: Calculus Help
        • How to Use Pythagoras' Theorem
        • How to Calculate Compound Percentage Changes
        • How to Find Equivalent Fractions
        • How to Find the Averages and Range From Grouped Data
        • How to Factorise a Quadratic Algebraic Equation
        • How to Expand a Pair of Brackets
        • How to Complete the Square
        • Hannah's Sweets - Tricky GCSE Question
        • Why Do We Rationalise the Denominator?
        • How to Add, Subtract, Multiply and Divide Fractions
        • How to Answer the 'Impossible' Question on the Edexcel GCSE Maths Paper 2022
        • How to draw pie charts
        • How to Differentiate From First Principles
        • How to Solve Direct Proportion Questions
        • How to Calculate a Percentage of an Amount Using a Decimal Multiplier
      • How Many Gifts Do I Get Over the Twelve Days of Christmas?
      • How to Find the Sum of a Geometric Sequence
      • The Maths Behind A4 Paper
      • The Monty Hall Problem
      • Rationalizing the Denominator
      • How Do Binary Numbers Work?
      • Rice on a Chessboard
      • How to Prove Pi Equals 2
      • What is the Maximum Score in Ten-Pin Bowling?
      • The Prisoner's Dilemma
      • How Many Socks Make a Pair?
      • Four Interesting Types of Mathematical Numbers
      • How to Add the Numbers 1-100 Quickly
      • What Is the Sum of the Sequence 1, 1/2, 1/4, 1/8, 1/16, ...?
      • Find the Answer to 8×9×10×11×12 Without Using a Calculator
      • How to Prove that the Square root of 2 is Irrational
      • Three Interesting Fractals From Koch, Sierpinski and Cantor
      • How Many Squares Are on a Chessboard?
      • Different Kinds of Prime Numbers
      • How to Do Long Multiplication Using Napier's Method
      • The Handshake Problem
      • Why You Should Always Order the Large Pizza
      • Maximizing the Area of a Rectangle
      • Speed Arithmetic - How to Multiply by 11 Without a Calculator
      • Speed Arithmetic - How to Multiply and Divide by 5 Without a Calculator
      • Pythagoras' Theorem - A Proof
      • How Large Is Infinity?
      • Interesting Facts About Pascal's Triangle
      • Why Does Time Slow Down as You Approach the Speed of Light?
      • Five of History's Most Influential Women in STEM
      • Five More of History's Most Influential Women in STEM
      • How Likely Are You to Hit the Centre of the Archery Target?
      • Find Four Primes Smaller Than 100 Which Are Factors Of 3^32 − 2^32
      • Bertrand's Paradox: A Problem in Probability Theory
      • What Is an Erdős Number?
      • Three of Isaac Newton's Most Important Contributions to the World
      • Mathematical Numbers: What Is 'e'?
      • Hilbert's Paradox of the Grand Hotel: Another Look at Infinity
      • Decreasing the Circumference of Differently Sized Circles: A Counterintuitive Cricket Problem
      • Zeno's Paradox: Achilles and the Tortoise
      • What Are Hexadecimal Numbers?
      • Why Do We Split a Circle Into 360 Degrees?
      • N-bonacci Sequences - Taking Fibonacci Further
      • Being Careful When You Average an Average: A Basketball Problem
      • What Is a Dudeney Number?
    • A-Level Maths Paper Walkthroughs >
      • A-Level Maths, Edexcel, June 2018, Paper Walkthroughs >
        • A-Level Maths, June 2018, Pure Paper 1 Question Walkthroughs
        • A-Level Maths, June 2018, Pure Paper 2, Question Walkthroughs
        • A-Level Maths, June 2018, Statistics and Mechanics, Question Walkthroughs
      • A-Level Maths, Edexcel, June 2019, Paper Walkthroughs >
        • A-Level Maths, June 2019, Pure Paper 1, Question Walkthroughs
        • A-Level Maths, June 2019, Pure Paper 2, Question Walkthrough
        • A-Level Maths, June 2019, Statistics and Mechanics, Walkthrough answers
      • A-Level Maths, Edexcel, October 2020, Paper Walkthroughs >
        • A-Level Maths, October 2020, Pure Mathematics Paper 1, Question Walkthroughs
        • A-Level Maths, October 2020, Pure Mathematics Paper 2, Question Walkthroughs
        • A-Level Maths, October 2020, Statistics and Mechanics, Walkthrough answers
      • A-Level Maths, Edexcel, October 2021, Paper Walkthroughs >
        • A-Level Maths, October 2021, Pure Mathematics, Paper 1 Walkthroughs
        • A-Level Maths, October 2021, Pure Mathematics Paper 2 Walkthroughs
        • A-Level Maths, October 2021, Statistics and Mechanics, Walkthrough answers
      • A-Level Maths, Edexcel, June 2022, Paper 1 Walkthroughs
    • Mathematician of the Month
    • Tricky Geometry Problems
    • DoingMaths video channel
    • DoingMaths Shop
    • Contact us
    • Privacy policy

The Handshake Problem: Creating a Mathematical Solution

A photo of a group of men shaking hands
A group handshake: Credit - Carl Albert Research and Studies Center, Congressional Collection
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 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.

Small groups​

Let's start by looking at solutions for small groups of people.
The answer is obvious for a group of 2 people: only 1 handshake is needed.

For a group of 3 people, person 1 will shake the hands of person 2 and person 3. This leaves person 2 and 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 4 people

Suppose we have four 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 but 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.

Larger groups

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, one 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, two 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 three 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
2
1
3
3
4
6
5
10
6
15
7
21
8
28

Creating a formula for the handshake problem

Our method so far is great for fairly small groupings, but it will still take a while for larger groups. For this reason, we will 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 one 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 longer, 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 add numbers from 1 to n - 1. Therefore, by adding the terms 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 the room
Number of handshakes required
20
190
50
1225
100
4950
1000
499 500

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.

Comments

​Don't forget to leave your comments below.
Home      Algebra      Shapes, space and measures      Number      Data handling      Starters      Internet articles      DoingMaths Youtube channel
© Copyright DoingMaths free worksheets 2026 - All Rights Reserved
  • Home
  • Algebra
    • Algebraic expressions
    • Algebraic equations
    • Expanding brackets
    • Index notation
    • Inequalities
    • Quadratic equations
    • Sequences
    • Simultaneous equations
    • Straight line graphs
    • Substitution
  • Shapes, space and measures
    • Angles
    • Circles
    • Circle theorems
    • Compound measures
    • Construction
    • Distance/speed-time graphs
    • Length, area and volume
    • Metric and Imperial conversions
    • Metric units of measurement
    • Proof
    • Pythagoras' Theorem
    • Scale factors, similarity and congruence
    • Symmetry and reflection
    • Time
    • Trigonometry
  • Number
    • Primary Addition and Subtraction
    • Addition and subtraction
    • Basic number work
    • BODMAS/PEMDAS/BIDMAS
    • Compound percentage change
    • Decimals
    • Factors and Multiples
    • Fractions
    • Fractions, decimals and percentages
    • Money
    • Multiplication and division
    • Percentages
    • Ratio and Proportion
    • Rounding and estimating
    • Standard form
  • Statistics and Probability
    • Averages and the Range
    • Box plots
    • Collecting data
    • Pie charts
    • Probability
  • More
    • Starters >
      • Puzzles and riddles
      • Maths Wordsearches
      • More Maths Lesson Starter Ideas
    • Christmas Maths Activities
    • Maths Articles >
      • Revision and How-To Guides >
        • How do Scale Factors Work for Area and Volume?
        • Edexcel GCSE Maths 2023 Paper 2: The Final Question
        • How to Find the Average From a Frequency Table
        • What Do the Angles in a Polygon Add Up To?
        • How to Integrate by Parts: Calculus Help
        • How to Use Pythagoras' Theorem
        • How to Calculate Compound Percentage Changes
        • How to Find Equivalent Fractions
        • How to Find the Averages and Range From Grouped Data
        • How to Factorise a Quadratic Algebraic Equation
        • How to Expand a Pair of Brackets
        • How to Complete the Square
        • Hannah's Sweets - Tricky GCSE Question
        • Why Do We Rationalise the Denominator?
        • How to Add, Subtract, Multiply and Divide Fractions
        • How to Answer the 'Impossible' Question on the Edexcel GCSE Maths Paper 2022
        • How to draw pie charts
        • How to Differentiate From First Principles
        • How to Solve Direct Proportion Questions
        • How to Calculate a Percentage of an Amount Using a Decimal Multiplier
      • How Many Gifts Do I Get Over the Twelve Days of Christmas?
      • How to Find the Sum of a Geometric Sequence
      • The Maths Behind A4 Paper
      • The Monty Hall Problem
      • Rationalizing the Denominator
      • How Do Binary Numbers Work?
      • Rice on a Chessboard
      • How to Prove Pi Equals 2
      • What is the Maximum Score in Ten-Pin Bowling?
      • The Prisoner's Dilemma
      • How Many Socks Make a Pair?
      • Four Interesting Types of Mathematical Numbers
      • How to Add the Numbers 1-100 Quickly
      • What Is the Sum of the Sequence 1, 1/2, 1/4, 1/8, 1/16, ...?
      • Find the Answer to 8×9×10×11×12 Without Using a Calculator
      • How to Prove that the Square root of 2 is Irrational
      • Three Interesting Fractals From Koch, Sierpinski and Cantor
      • How Many Squares Are on a Chessboard?
      • Different Kinds of Prime Numbers
      • How to Do Long Multiplication Using Napier's Method
      • The Handshake Problem
      • Why You Should Always Order the Large Pizza
      • Maximizing the Area of a Rectangle
      • Speed Arithmetic - How to Multiply by 11 Without a Calculator
      • Speed Arithmetic - How to Multiply and Divide by 5 Without a Calculator
      • Pythagoras' Theorem - A Proof
      • How Large Is Infinity?
      • Interesting Facts About Pascal's Triangle
      • Why Does Time Slow Down as You Approach the Speed of Light?
      • Five of History's Most Influential Women in STEM
      • Five More of History's Most Influential Women in STEM
      • How Likely Are You to Hit the Centre of the Archery Target?
      • Find Four Primes Smaller Than 100 Which Are Factors Of 3^32 − 2^32
      • Bertrand's Paradox: A Problem in Probability Theory
      • What Is an Erdős Number?
      • Three of Isaac Newton's Most Important Contributions to the World
      • Mathematical Numbers: What Is 'e'?
      • Hilbert's Paradox of the Grand Hotel: Another Look at Infinity
      • Decreasing the Circumference of Differently Sized Circles: A Counterintuitive Cricket Problem
      • Zeno's Paradox: Achilles and the Tortoise
      • What Are Hexadecimal Numbers?
      • Why Do We Split a Circle Into 360 Degrees?
      • N-bonacci Sequences - Taking Fibonacci Further
      • Being Careful When You Average an Average: A Basketball Problem
      • What Is a Dudeney Number?
    • A-Level Maths Paper Walkthroughs >
      • A-Level Maths, Edexcel, June 2018, Paper Walkthroughs >
        • A-Level Maths, June 2018, Pure Paper 1 Question Walkthroughs
        • A-Level Maths, June 2018, Pure Paper 2, Question Walkthroughs
        • A-Level Maths, June 2018, Statistics and Mechanics, Question Walkthroughs
      • A-Level Maths, Edexcel, June 2019, Paper Walkthroughs >
        • A-Level Maths, June 2019, Pure Paper 1, Question Walkthroughs
        • A-Level Maths, June 2019, Pure Paper 2, Question Walkthrough
        • A-Level Maths, June 2019, Statistics and Mechanics, Walkthrough answers
      • A-Level Maths, Edexcel, October 2020, Paper Walkthroughs >
        • A-Level Maths, October 2020, Pure Mathematics Paper 1, Question Walkthroughs
        • A-Level Maths, October 2020, Pure Mathematics Paper 2, Question Walkthroughs
        • A-Level Maths, October 2020, Statistics and Mechanics, Walkthrough answers
      • A-Level Maths, Edexcel, October 2021, Paper Walkthroughs >
        • A-Level Maths, October 2021, Pure Mathematics, Paper 1 Walkthroughs
        • A-Level Maths, October 2021, Pure Mathematics Paper 2 Walkthroughs
        • A-Level Maths, October 2021, Statistics and Mechanics, Walkthrough answers
      • A-Level Maths, Edexcel, June 2022, Paper 1 Walkthroughs
    • Mathematician of the Month
    • Tricky Geometry Problems
    • DoingMaths video channel
    • DoingMaths Shop
    • Contact us
    • Privacy policy