Problem of the Day: June 19
Alphonse and Beryl play a game involving
safes. Each safe can be opened by a unique key and each key opens a unique safe. Beryl randomly shuffles the
keys, and after placing one key inside each safe, she locks all of the safes with her master key. Alphonse then selects
of the safes (where
), and Beryl uses her master key to open just the safes that Alphonse selected. Alphonse collects all of the keys inside these
safes and tries to use these keys to open up the other
safes. If he can open a safe with one of the
keys, he can then use the key in that safe to try to open any of the
remaining safes, repeating the process until Alphonse successfully opens
all of the safes, or cannot open any more. Let
be the probability that Alphonse can eventually open all
safes starting from his initial selection of
keys. Find (with proof) a general formula for
.
Edited to add solution: We prove by induction that Pm(n) = m/n.
Note first that the initial distribution of the keys in the n safes amounts to some permutation of {1,...,n}. Call that initial permutation p.
Step 1: Suppose m=1, so Alphonse gets only one safe initially opened. Alphonse can then open all of the safes if and only if p is a single cycle. There are n! possible permutations of the n keys, and (n-1)! permutations forming a single cycle, so the probability that Alphone can open all the safes is (n-1)!/n! = 1/n.
Step 2: We can now get a recursive relation between the n+1-safe-case and the n-safe-case. Suppose that we have n safes and m initially opened safes. Look inside one of the opened safes and remove the contained key. There are now two cases:
Case 1: The contained key is for one of the initially opened safes. In that case the key is useless. That safe can now be ignored, and we're left with n safes, m-1 of which have been opened. That's thus P(m-1)(n).
Case 2: The contained key is for a safe not initially opened. In that case, we can ignore that safe, open the safe that the key matches, and we're left with n safes, m of which have been opened. That's thus Pm(n).
Case 1 has a probability of m/(n+1), and Case 2 has a probability of (n+1-m)/(n+1). So we get the recursive relation:
Pm(n+1) = m/(n+1) * P(m-1)(n) + (n+1-m)/(n+1) * Pm(n).
Step 3: We now prove by induction on double induction on m and n that Pm(n) = m/n.
Note that Step 1 already gives us the base case m=1 and n arbitrary. So now fix some m and n and suppose Pk(j) = k/j for all k<=m and all j < n. Then by our recursive relation we have:
Pm(n) = m/n * P(m-1)(n-1) + (n-m)/n * Pm(n-1)
By the inductive hypothesis, that gives us:
Pm(n) = m/n * (m-1)/(n-1) + (n-m)/n * m/(n-1)
With a bit of algebra, we get Pm(n) = m/n.
(Problem source: 2014 Canadian Mathematical Olympiad Qualification #2)
Edited to add solution: We prove by induction that Pm(n) = m/n.
Note first that the initial distribution of the keys in the n safes amounts to some permutation of {1,...,n}. Call that initial permutation p.
Step 1: Suppose m=1, so Alphonse gets only one safe initially opened. Alphonse can then open all of the safes if and only if p is a single cycle. There are n! possible permutations of the n keys, and (n-1)! permutations forming a single cycle, so the probability that Alphone can open all the safes is (n-1)!/n! = 1/n.
Step 2: We can now get a recursive relation between the n+1-safe-case and the n-safe-case. Suppose that we have n safes and m initially opened safes. Look inside one of the opened safes and remove the contained key. There are now two cases:
Case 1: The contained key is for one of the initially opened safes. In that case the key is useless. That safe can now be ignored, and we're left with n safes, m-1 of which have been opened. That's thus P(m-1)(n).
Case 2: The contained key is for a safe not initially opened. In that case, we can ignore that safe, open the safe that the key matches, and we're left with n safes, m of which have been opened. That's thus Pm(n).
Case 1 has a probability of m/(n+1), and Case 2 has a probability of (n+1-m)/(n+1). So we get the recursive relation:
Pm(n+1) = m/(n+1) * P(m-1)(n) + (n+1-m)/(n+1) * Pm(n).
Step 3: We now prove by induction on double induction on m and n that Pm(n) = m/n.
Note that Step 1 already gives us the base case m=1 and n arbitrary. So now fix some m and n and suppose Pk(j) = k/j for all k<=m and all j < n. Then by our recursive relation we have:
Pm(n) = m/n * P(m-1)(n-1) + (n-m)/n * Pm(n-1)
By the inductive hypothesis, that gives us:
Pm(n) = m/n * (m-1)/(n-1) + (n-m)/n * m/(n-1)
With a bit of algebra, we get Pm(n) = m/n.
(Problem source: 2014 Canadian Mathematical Olympiad Qualification #2)
Comments
Post a Comment