Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Handshake Problem. n people are in a room Each person shakes hands with each other person exactly once. How many handshakes will take place?

Similar presentations


Presentation on theme: "The Handshake Problem. n people are in a room Each person shakes hands with each other person exactly once. How many handshakes will take place?"— Presentation transcript:

1 The Handshake Problem

2 n people are in a room Each person shakes hands with each other person exactly once. How many handshakes will take place?

3 Example: n = 5

4

5 Person 1 shakes hands with the other four and leaves. Running Total: 4

6 Person 1 shakes hands with the other four and leaves. Running Total: 4

7 Person 2 shakes hands with the other three and leaves. Running Total: 4 + 3

8 Person 2 shakes hands with the other three and leaves. Running Total: 4 + 3

9 Person 3 shakes hands with the other two and leaves. Running Total:

10 Person 3 shakes hands with the other two and leaves. Running Total:

11 Person 4 shakes hands with the other one and leaves. Running Total:

12 Person 5 has no one left to shake with. Running Total:

13 Person 5 has no one left to shake with. Running Total: = 10

14 So when n = 5, it takes handshakes In general, it takes … + (n-1) handshakes. Ex: If there were 10 people, there would be = 45 handshakes.

15 Let’s count the handshakes another way. Count each hand in a handshake as a “half- handshake”. Two half-handshakes make a whole handshake.

16 When n = 5 Each person has to shake hands with the other four. So each person contributes 4 half- handshakes. Since there are 5 people, this is a total of 5 ⋅ 4 = 20 half handshakes, or 10 whole handshakes.

17 So for a general n, the total number of handshakes is n(n-1)∕2. Ex: if n = 10, the number of handshakes is

18 If n = 50, then the number of handshakes is This is much easier than adding up ⋅⋅⋅ + 49

19 By counting in two different ways, we determined that the number of handshakes is both ⋅⋅⋅ + (n-1) and n(n-1)/2 Since these formulas count the same things, we have established the identity ⋅⋅⋅ + (n-1) = n(n-1)/2

20 Let f(n) = ⋅⋅⋅ + (n-1). We’ve seen that

21 Let f(n) = ⋅⋅⋅ + (n-1). We’ve seen that To get a function for ⋅⋅⋅ + n, we replace each n with n+1

22 The formula ⋅⋅⋅ + (n-1) + n = n(n+1)/2 Was discovered by Carl Friedrich Gauss when he was a student in primary school.

23 Gauss’s teacher wanted to keep Gauss busy, so he gave him the assignment of adding all the numbers from 1 to 100. Gauss produced the correct answer in a matter of seconds. His teacher was impressed. And annoyed.

24 Gauss realized that it is easy to add up all the numbers twice ⋅⋅⋅ ⋅⋅⋅ ⋅⋅⋅ =101(100). Dividing this by 2 gives a sum of 101 ⋅ 50=5050

25 We can do the same trick for any n: ⋅⋅⋅ + (n-1) + n n + (n-1) + ⋅⋅⋅ n+1 + n+1 + ⋅⋅⋅ + n+1 + n+1 = (n+1)n So 1 + ⋅⋅⋅ + n = (n+1)n/2


Download ppt "The Handshake Problem. n people are in a room Each person shakes hands with each other person exactly once. How many handshakes will take place?"

Similar presentations


Ads by Google