Download as pdf or txt
Download as pdf or txt
You are on page 1of 124

Fun with probability

Ananda Dasgupta

IISER Kolkata

NGPE 2016

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners.

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners. He promises to let them off if they succeed in a game
that he has devised.

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners. He promises to let them off if they succeed in a game
that he has devised.
He sets up 100 identical looking boxes, each containing the name
of one prisoner, in an otherwise empty room.

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners. He promises to let them off if they succeed in a game
that he has devised.
He sets up 100 identical looking boxes, each containing the name
of one prisoner, in an otherwise empty room.
The prisoners are then let into the room, one by one, and each one
is allowed to open any 50 boxes of his choice.

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners. He promises to let them off if they succeed in a game
that he has devised.
He sets up 100 identical looking boxes, each containing the name
of one prisoner, in an otherwise empty room.
The prisoners are then let into the room, one by one, and each one
is allowed to open any 50 boxes of his choice. Once this is done,
the prisoner is segregated from the rest.

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners. He promises to let them off if they succeed in a game
that he has devised.
He sets up 100 identical looking boxes, each containing the name
of one prisoner, in an otherwise empty room.
The prisoners are then let into the room, one by one, and each one
is allowed to open any 50 boxes of his choice. Once this is done,
the prisoner is segregated from the rest.
In order to succeed each one of them must manage to find the
box with his own name.

Ananda Dasgupta
Warden versus prisoners

A jail warden comes up with a novel way to torment his 100


prisoners. He promises to let them off if they succeed in a game
that he has devised.
He sets up 100 identical looking boxes, each containing the name
of one prisoner, in an otherwise empty room.
The prisoners are then let into the room, one by one, and each one
is allowed to open any 50 boxes of his choice. Once this is done,
the prisoner is segregated from the rest.
In order to succeed each one of them must manage to find the
box with his own name.
Can the prisoners come up with a strategy that will give them a
resonable chance of success?

Ananda Dasgupta
Warden versus prisoners
A strategy is necessary

If every one opens the first 50 boxes, they are bound to fail.

Ananda Dasgupta
Warden versus prisoners
A strategy is necessary

If every one opens the first 50 boxes, they are bound to fail.
If each prisoner opens 50 boxes at random, their chance
increases.

Ananda Dasgupta
Warden versus prisoners
A strategy is necessary

If every one opens the first 50 boxes, they are bound to fail.
If each prisoner opens 50 boxes at random, their chance
increases.
There is a 50 % chance of each prisoner finding his box.

Ananda Dasgupta
Warden versus prisoners
A strategy is necessary

If every one opens the first 50 boxes, they are bound to fail.
If each prisoner opens 50 boxes at random, their chance
increases.
There is a 50 % chance of each prisoner finding his box.
 100
1
The chance of everyone doing so is ≈ 10−30
2

Ananda Dasgupta
Warden versus prisoners
A strategy is necessary

If every one opens the first 50 boxes, they are bound to fail.
If each prisoner opens 50 boxes at random, their chance
increases.
There is a 50 % chance of each prisoner finding his box.
 100
1
The chance of everyone doing so is ≈ 10−30
2
There is a strategy, though, that will give them over 30%
chance of success!

Ananda Dasgupta
The birthday problem

Consider a class of N students. What is the probability that there


is at least a pair of students who share a birthday?

Ananda Dasgupta
The birthday problem

Consider a class of N students. What is the probability that there


is at least a pair of students who share a birthday?

Guess: How large does the class have to be for the probability to
exceed 50%?

Ananda Dasgupta
The birthday problem

Consider a class of N students. What is the probability that there


is at least a pair of students who share a birthday?

Guess: How large does the class have to be for the probability to
exceed 50%?

Hint: The answer isn’t 163!

Ananda Dasgupta
The birthday problem

Let’s ignore leap years!

Ananda Dasgupta
The birthday problem

Let’s ignore leap years!

The number of all possible birthday lists (d1 , . . . , dN ) is 365N .

Ananda Dasgupta
The birthday problem

Let’s ignore leap years!

The number of all possible birthday lists (d1 , . . . , dN ) is 365N .

Let’s find the probability that all the N students have different
birthdays.

Ananda Dasgupta
The birthday problem

Let’s ignore leap years!

The number of all possible birthday lists (d1 , . . . , dN ) is 365N .

Let’s find the probability that all the N students have different
birthdays.

This can happen in 365 × 364 × 363 × . . . × (365 − N + 1) ways!

Ananda Dasgupta
The birthday problem

Let’s ignore leap years!

The number of all possible birthday lists (d1 , . . . , dN ) is 365N .

Let’s find the probability that all the N students have different
birthdays.

This can happen in 365 × 364 × 363 × . . . × (365 − N + 1) ways!

The probability of no common birthdays is


       
1 2 3 N −1
1× 1− × 1− × 1− ×...× 1 −
365 365 365 365

Ananda Dasgupta
The birthday problem

Let’s ignore leap years!

The number of all possible birthday lists (d1 , . . . , dN ) is 365N .

Let’s find the probability that all the N students have different
birthdays.

This can happen in 365 × 364 × 363 × . . . × (365 − N + 1) ways!

The probability of no common birthdays is


       
1 2 3 N −1
1× 1− × 1− × 1− ×...× 1 −
365 365 365 365

Our answer can be found by subtracting this from one.

Ananda Dasgupta
The Birthday problem

1
2

10 20 30 40 50 N

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:
toss the coin twice.

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:
toss the coin twice.
Call ’HT’ for one captain, and ’TH’ for the rival.

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:
toss the coin twice.
Call ’HT’ for one captain, and ’TH’ for the rival.
Both outcomes have the same probability pq

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:
toss the coin twice.
Call ’HT’ for one captain, and ’TH’ for the rival.
Both outcomes have the same probability pq
If the tosses turn up ’HH’ or ’TT’, reject them and try again!

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:
toss the coin twice.
Call ’HT’ for one captain, and ’TH’ for the rival.
Both outcomes have the same probability pq
If the tosses turn up ’HH’ or ’TT’, reject them and try again!
1
Neumann’s algorithm needs, on average, tosses to work.
pq

Ananda Dasgupta
A fair toss ... with a biased coin!

You have a biased coin.


You are not even sure what the probability p of it turning up
head is!
Can you use it to ensure that two rival captains can carry out
a fair toss?
John von Neumann’s solution:
toss the coin twice.
Call ’HT’ for one captain, and ’TH’ for the rival.
Both outcomes have the same probability pq
If the tosses turn up ’HH’ or ’TT’, reject them and try again!
1
Neumann’s algorithm needs, on average, tosses to work.
pq
You can, actually make it a lot more efficient!

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.
One fine morning you decide to test yourself for the disease.

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.
One fine morning you decide to test yourself for the disease.
The test turns out to be positive for the disease.

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.
One fine morning you decide to test yourself for the disease.
The test turns out to be positive for the disease.
Should you be writing out your last will and testament?

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.
One fine morning you decide to test yourself for the disease.
The test turns out to be positive for the disease.
Should you be writing out your last will and testament?
After all, your chances of having the disease seems 99%!

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.
One fine morning you decide to test yourself for the disease.
The test turns out to be positive for the disease.
Should you be writing out your last will and testament?
After all, your chances of having the disease seems 99%!
actually, 99% = P ( Test is negative | You are healthy )

Ananda Dasgupta
A matter of life and death ... literally!

A fatal disease afflicts 1 in 10000 people in a population of,


say, a million.
The standard test for this disease has a false positive rate of
1%.
One fine morning you decide to test yourself for the disease.
The test turns out to be positive for the disease.
Should you be writing out your last will and testament?
After all, your chances of having the disease seems 99%!
actually, 99% = P ( Test is negative | You are healthy )
What you need is

P (You are sick|Test is positive)

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,


100 would be sick, the rest 999900, would be healthy.

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,


100 would be sick, the rest 999900, would be healthy.
All the sick will test positive (we assume no false negatives).

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,


100 would be sick, the rest 999900, would be healthy.
All the sick will test positive (we assume no false negatives).
So will 9999 healthy people!

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,


100 would be sick, the rest 999900, would be healthy.
All the sick will test positive (we assume no false negatives).
So will 9999 healthy people!
You are one of these 10099 people.

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,


100 would be sick, the rest 999900, would be healthy.
All the sick will test positive (we assume no false negatives).
So will 9999 healthy people!
You are one of these 10099 people.
100
The chance that you are sick is – less than 1%!
10099

Ananda Dasgupta
A matter of life and death ... literally!
The perils of random testing

If all the million inhabitants got tested,


100 would be sick, the rest 999900, would be healthy.
All the sick will test positive (we assume no false negatives).
So will 9999 healthy people!
You are one of these 10099 people.
100
The chance that you are sick is – less than 1%!
10099
Prior probabilities matter!

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?
tb

tg

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?
tb
(tg , tb )

tg

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?
tb
(tg , tb )

tg

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?
tb
(tg , tb )

tb
=
tg

tg

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?
tb
(tg , tb )
5
+
tg
=
tb

10
+
tb
=
tg

tg

Ananda Dasgupta
The caféteria problem
Two friends decide to meet at the caféteria during a 30 minute
recess. If the girl arrives first, she will wait for five minutes for the
boy to arrive. If, on the other hand, the boy is the first to arrive,
he will wait for ten minutes. What is the probability that they will
meet?
tb
(tg , tb )
5
+
tg
=
tb

10
+
tb
=
tg

tg

Ananda Dasgupta
The caféteria problem
Python code

Ananda Dasgupta
The uniform variate

N = 100

0.1

Ananda Dasgupta
The uniform variate

N = 100000

0.1

Ananda Dasgupta
Distribution for y = x 2

N = 100

0.3

0.2

0.1

Ananda Dasgupta
Distribution for y = x 2

N = 100000

0.3

0.2

0.1

Ananda Dasgupta
Distribution for y = x 2
The theory:

y = x2

Ananda Dasgupta
Distribution for y = x 2
The theory:

y = x2

y + ∆y
y

x x + ∆x

x
For x 2 to lie between y and y + ∆y , x must lie between x and
x + ∆x

Ananda Dasgupta
Distribution for y = x 2
The theory:

y = x2

y + ∆y
y

x x + ∆x

x

For x 2 to lie between y and y + ∆y , x must lie between
√ y and
y + ∆y

Ananda Dasgupta
Distribution for y = x 2
The theory:

y = x2

y + ∆y
y

x x + ∆x

x
Probability of x 2 lying between y and y + ∆y is
p √
∆x = y + ∆y − y

Ananda Dasgupta
Distribution for y = x 2
The theory:

y = x2

y + ∆y
y

x x + ∆x

x
Probability of x 2 lying between y and y + ∆y is
p √ 1
∆x = y + ∆y − y ≈ √ ∆y
2 y
Ananda Dasgupta
Distribution for y = x 2
The theory:

y = x2

y + ∆y
y

x x + ∆x

1
P(y )dy = √ dy
2 y

Ananda Dasgupta
Distribution for f (x)
The theory:

y = f (x)

Ananda Dasgupta
Distribution for f (x)
The theory:

y = f (x)

y + ∆y
y

x x + ∆x

x
For f (x) to lie between y and y + ∆y , x must lie between x and
x + ∆x

Ananda Dasgupta
Distribution for f (x)
The theory:

y = f (x)

y + ∆y
y

x x + ∆x

x
For f (x) to lie between y and y + ∆y , x must lie between f −1 (y )
and f −1 (y + ∆y )

Ananda Dasgupta
Distribution for f (x)
The theory:

y = f (x)

y + ∆y
y

x x + ∆x

x
Probability of f (x) lying between y and y + ∆y is

∆x = f −1 (y + ∆y ) − f −1 (y )

Ananda Dasgupta
Distribution for f (x)
The theory:

y = f (x)

y + ∆y
y

x x + ∆x

x
Probability of f (x) lying between y and y + ∆y is

df −1 (y )
∆x = f −1 (y + ∆y ) − f −1 (y ) ≈ ∆y
dy
Ananda Dasgupta
Distribution for f (x)
The theory:

y = f (x)

y + ∆y
y

x x + ∆x

1
P(y )dy = dy
f0

Ananda Dasgupta
A physics question
V (x)

A number of particles are released from rest with the same energy
E at random initial times. If a snapshot of the system is then
taken, how will they be distributed?
Ananda Dasgupta
A physics question
V (x)

What is the probability distribution P(x)dx of finding any given


particle between x and x + dx?
Ananda Dasgupta
A physics question

V (x)

P Q R S Tx

The particle(s) will oscillate between P and T ,

Ananda Dasgupta
A physics question

V (x)

P Q R S Tx

The particle(s) will oscillate between P and T , speeding up from P


to Q, slowing down till R, speeding up again till S, slowing down
and coming momentarily to rest at T ...
Ananda Dasgupta
A physics question

V (x)

P Q R S Tx

1
P(x) = reflects the fact that it spends most of its time
v (x)T
close to the points P and T ...
Ananda Dasgupta
Warden versus prisoners
The solution

3 11 7 1
1 2 3 4

6 16 4 12
5 6 7 8

14 2 10 9
9 10 11 12

15 8 13 5
13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

3
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

7
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

4
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

11
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

10
9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

2
9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

7
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

4
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

3
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

3
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

7
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

4
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

6
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

16
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9 10 11 12

5
13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

16
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9 10 11 12

5
13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

6
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

4
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

3
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

7
1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

12
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9
9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

14
9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9 10 11 12

8
13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

14
9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9 10 11 12

8
13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

12
5 6 7 8

9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

1 2 3 4

5 6 7 8

9
9 10 11 12

13 14 15 16
Ananda Dasgupta
Warden versus prisoners
The solution

3 11 7 1
1 2 3 4

6 16 4 12
5 6 7 8

14 2 10 9
9 10 11 12

15 8 13 5
13 14 15 16

P = [1 3 7 4] [2 11 10] [5 6 16] [8 12 9 14] [13 15]

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
2n
You can choose the entries of the k-cycle in Ck ways!

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
You can choose the entries of the k-cycle in 2n Ck ways!
The rest of the entries can be permuted in (2n − k)! ways.

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
You can choose the entries of the k-cycle in 2n Ck ways!
The rest of the entries can be permuted in (2n − k)! ways.
The entries in the cycle itself can be permuted in (k − 1)! ways

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
You can choose the entries of the k-cycle in 2n Ck ways!
The rest of the entries can be permuted in (2n − k)! ways.
The entries in the cycle itself can be permuted in (k − 1)! ways
(2n)!
There are permutations with a k-cycle, if k > n.
k

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
You can choose the entries of the k-cycle in 2n Ck ways!
The rest of the entries can be permuted in (2n − k)! ways.
The entries in the cycle itself can be permuted in (k − 1)! ways
(2n)!
There are permutations with a k-cycle, if k > n.
k
The probability that a random perturbation will have such a
1
cycle is .
k

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
You can choose the entries of the k-cycle in 2n Ck ways!
The rest of the entries can be permuted in (2n − k)! ways.
The entries in the cycle itself can be permuted in (k − 1)! ways
(2n)!
There are permutations with a k-cycle, if k > n.
k
The probability that a random perturbation will have such a
1
cycle is .
k
2n
X 1
The probability of failure is = H2n − Hn ≈ ln 2
k
k=n+1

Ananda Dasgupta
Warden versus prisoners
The solution

The strategy will fail only if, in a random permutation of 2n


objects, there is a cycle of length k > n.
How many such permutations are there?
You can choose the entries of the k-cycle in 2n Ck ways!
The rest of the entries can be permuted in (2n − k)! ways.
The entries in the cycle itself can be permuted in (k − 1)! ways
(2n)!
There are permutations with a k-cycle, if k > n.
k
The probability that a random perturbation will have such a
1
cycle is .
k
2n
X 1
The probability of failure is = H2n − Hn ≈ ln 2
k
k=n+1
The success probability is more than 30% !

Ananda Dasgupta
Probability is a serious matter!

Ananda Dasgupta
Probability is a serious matter!

But it can also be a lot of fun!!!

Ananda Dasgupta

You might also like