This action might not be possible to undo. Are you sure you want to continue?
Heba Hathout, Westridge School for Girls Pasadena, CA
The old hats problem goes by many names (originally described by Montmort in 1713) but is generally described as: A group of n men enter a restaurant and check their hats. The hat-checker is absent minded, and upon leaving, she redistributes the hats back to the men at random. What is the probability Pn that no man gets his correct hat, and how does Pn behave as n approaches infinity? This problem is just a standard question about derangementsi. Three solutions are presented in this paper. The first two apply standard approaches: • • Using the inclusion-exclusion principle, and Using the recurrence relation Pn = Pn-1 - 1/n (Pn-1 - Pn-2 )ii.
Finally, the main point of interest in this paper is a relatively different approach using the technique of binomial inversion. In this presentation, we will also solve the related question: What is the expected value of the number of men who receive their correct hats? We conclude the paper with a derivation of the binomial inversion formula itself.
2. Solution Using the Inclusion-Exclusion Principle
Let N denote the total number of permutations of n hats. To calculate the number of derangements, Dn, we want to exclude all permutations possessing any of the attributes a1, a2, ….., an where ai is the attribute that man i gets his correct hat for 1 ! i ! n. Let N(i) denote the number of permutations possessing attribute ai (and possibly others), N(i,j) the number of permutations possessing attributes ai and aj (and possibly others), etc. Then the inclusion-exclusion principle states that
Dn = N !
1#i # n
" N (i) + " N (i, j ) ! " N (i, j, k ) + L + (!1)
1#i < j # n 1#i < j < k # n
N (1,2, K , n)
By symmetry, N(1) = N(2) = …= N(i), N(1,2) = N(1,3) = …. =N(i,j), and so on. So we have
3)=(n-3)!. In case (b). N(1).3) +L+ ( !1) n $ ' N (1. Therefore. Similarly. then man #1 will not have his correct hat. 3. is simply (n1)!. and so forth. etc. since the remaining hats can be distributed in any order. to get: Pn = (1 ! 1 1 1 1 1 + ! + !L+ ( !1) n ) 1! 2 ! 3! 4 ! n! We easily recognize this series as approaching 1/e as n approaches infinity. and simplifying the above expression. In this subcase. If there is a derangement. man #i cannot get hat #i.2. the number of permutations where man 1 gets his correct hat. the total number of derangements in this subcase is simply Dn-2. for a derangement to occur. In case (a). as follows.2)=(n-2)!.3. n!. or b) man #2 does not get hat #1.2. We begin by looking at the case where man #1 gets hat #2. N(1. Note that this case can be broken down into two subcases: a) man #2 gets hat #1." n% " n% " n% " n% Dn = N ! $ ' N (1) + $ ' N (1.2) ! $ ' N (1. man #2 cannot get hat #1 (that’s case a).2. we obtain: Dn = n !(1 ! 1 1 1 1 1 + ! + !L+ ( !1) n ) 1! 2 ! 3! 4 ! n! To generate Pn. man #3 cannot get hat #3. N(1. the number of derangements is Dn-1. The fact that in this subcase man #2 cannot get hat #1 rather than hat #2 is inconsequential. . the probability of a derangement occurring for n hats. we need the remaining n-2 men to get the wrong hats. Therefore " n% " n% " n% " n% Dn = N ! $ ' (n ! 1)!+ $ ' (n ! 2)!! $ ' (n ! 3)! +L+ ( !1) n $ ' (n ! n)! # 1& # 2& # 3& # n& Replacing N. the total permutations for n hats by n!. Solution Using a Recurrence Relation In this section we derive the formula for Dn using a recurrence relation. we simply divide the total number of derangements Dn by the total permutations of the n hats.K n) # 1& # 2& # 3& # n& Now. for a derangement to occur.
in exactly the same way. or hat #4.+ ! 2 2"3 2 " 3 " 4 """ (n ! 1) n 2 " 3 " 4 """ (n ! 1) 1 1 1 ( !1) n !1 ( !1) n ! + !. .. n!. . Pn = Dn (n ! 1) = ( Dn !1 + Dn ! 2 ) n! n! Dn ! 2 % 1 " 1 Dn !1 Pn = (n ! 1) $ + ' # n (n ! 1)! n(n ! 1) (n ! 2)!& 1 1 = (1 ! ) Pn !1 + Pn ! 2 n n 1 = Pn !1 ! ( Pn !1 ! Pn ! 2 ) n Now..+ + 2 ! 3! 4 ! (n ! 1)! n! Once again.. using our formula. we recognize this as approaching 1/e as n approaches infinity. So. 1 Pn = Pn !1 ! ( Pn !1 ! Pn ! 2 ) n = = 1 1 ( !1) n !1 1 ( !1) n !1 ! +. Dn.. we know that P1= 0... = ! 3 2 3 2 2 2"3 1 1 1 1 1 1 1 1 P4 = P3 ! ( P3 ! P2 ) = ! ! (! )= ! + 4 2 2"3 4 2"3 2 2 " 3 2 " 3" 4 .. . we can calculate successively 1 1 1 1 1 1 P3 = P2 ! ( P2 ! P1 ) = ! . and P2= 1/2. or hat #i. Dn = (n-1) (Dn-1 + Dn-2) The probability of a derangement is again the number of derangements. there are n-1 such possibilities for all the different incorrect hats which man #1 can get. Therefore. divided by all possible outcomes.We can treat the cases where man #1 receives hat #3. So. So.. to account for all possible derangements.
.More formally. we can set up a telescoping sum to calculate Pn: Qn = Pn ! Pn !1 Qn !1 = Pn !1 ! Pn ! 2 M Q2 = P2 ! P1 Therefore. and since P1=0. 1 4. our base case is Q2. which equals P2-P1= 1/2-0 = 1/2.. Thus. Qn = ( !1) n 1 . then 1 Qn = ! Qn !1 n 1 " !1 % =! $ 'Q n # n ! 1& n ! 2 1 " !1 % " !1 % =! $ '$ 'Q . n # n ! 1& # n ! 2 & n ! 3 =. it follows that Pn = i =2 n i =2 " ( !1) i i ! . summing both sides. we can write as 1 Pn = Pn !1 ! ( Pn !1 ! Pn ! 2 ) n 1 Pn ! Pn !1 = ! ( Pn !1 ! Pn ! 2 ) n If we let Qn = Pn ! Pn !1 . = ( !1) n ! 2 1 " 1 % " 1 % " 1% $ '$ ' ((( $ ' Q n # n ! 1& # n ! 2 & # 3& 2 Now. Solution by Binomial Inversion . n! Now. we get n Pn ! P1 = " Qi .
A1. A2..An. and use it to solve our problem. Therefore. then the number of possible arrangements is just Dn-2. % 2" & # $ 2! % " Proceeding with a similar logic. Specifically. given that n ! n$ bn = ' # & ai i =0 " i % we can retrieve the ai coefficients using the formula " n% a n = ( ( !1) n !i $ ' bi #i& i =0 n This is the binomial inversion formula. where Ai is the set of permutations where exactly n-i men receive their correct hats. If we take as an example this subset An-2. we have bn = ' # & Di .. The set of permutations of the hats can be expressed as the disjoint union of n+1 subsets A0. For now.. the number of permutations in set An-2 is: 'n$ An ! 2 = % " Dn ! 2 . there are & n # possible $ ! pairings of the two men who get their correct hats. if only two of the men get their correct hat back. i =0 " i % . the number of derangements for the remaining n-2 men.The old hats problem can also be solved by using binomial inversion. this would correspond to the set of permutations An-2. For instance. However.. we see that if the two men who get the correct hats are man #1 and man #2. we assume it to be true. We will prove the formula using exponential generating functions in Section 6. we may now write the total permutations as: " i % " n ' i% ! n$ ! n $ ! n $ ! n $ ! n$ n ! = # & Dn + # & Dn '1 + # & Dn ' 2 + # & Dn ' 3 +L+# & D0 " n% " n ' 1% " n ' 2% " n ' 3% " 0% n ! n$ Setting n ! = bn . and using the fact that ! n$ ! n $ # & =# & .
n!. how many men on average would have gotten their correct hat? The answer to this question can be defined to be E(n). divided by the total number of possible arrangements of the hats. the expected number of correct hats for n men. and then walk out. then E ( n ) = ! Pj ( j ) j =0 n Let us use P2 as an example to better understand the form of Pj. j men have their correct hats. and reversing the order of summation. we see that this can be written as 'n$ % " Dn!2 %2" P2 = & # n! Proceeding analogously. any number from 0 to n (with the exception of n-1) men may have their correct hat. Therefore. we can then write . This is simply the number of ways in which two men may receive their correct hat. In other words. if n men walk into the restaurant and check their hats. If this experiment is repeated numerous times. Dn = i =0 # ( !1) n ! i (n ! i )!i ! " i ! n n n! Dividing by n!.We can now use binomial inversion to obtain Dn: " n% Dn = ( ( !1) n !i $ ' bi . The Expected Value of Correct Hats A nice application to show the utility of this “binomial” approach is the calculation of the expected value of the correct number of hats. From the foregoing. we get once again: Pn = j =0 " ( !1) j 1 j! 5. receiving their hats at random. #i& i =0 n where each bi = i! . letting j = n-i . If we let Pj be the probability that when n leave the restaurant.
. Derivation of the Binomial Inversion Formula We now derive the binomial inversion formula used in Section 4. if we let j=n-i. we get (n " 1)! E (n) = ! i =0 n n ' n ( 1$ Di (n " 1)! " Di . (n " i )!i! i = 0 ( n " i " 1)!i! E ( n) = ! i =0 Now. = !% (n " 1 " i )!i! i =0 % i " & # Since the term in the summation will equal 0 for i=n. and recall that $ ! = $ $ j ! $ n ' i ! = $ i ! . if we multiply both sides by (n-1)!. and is independent of n. we can write ! $ ! &n# & n # &n# % " % " % " (n% & # Di (n " i ) n &i# E ( n) = ! ' $ n! i =0 When this is simplified. 6. we can rewrite this equation as n "1 n " 1 ( % (n " 1)! E (n) = ! & & i # Di # i =0 ' $ Comparing this to our result from above. yielding the amazing result that E(n) = 1. we get n n Di Di (n " i ) =! .(n% & # D ( j) n & # n" j j E ( n) = ! ' $ n! j =0 Now. we recognize the right hand side of the equation immediately as ( n ! 1)! .
(1) i =0 " i % we wish to show that this can be inverted to retrieve the ai coefficients as follows: n n " n% a n = ( ( !1) n !i $ ' bi #i& i =0 (2) This can be done by introducing exponential generating functions. . still summing over the same half-plane. (8) can be rewritten as. Hence.If we know that ! n$ bn = ' # & ai . If A( x ) = ak x k " k =0 k! ! ! (3) bk x k B( x ) = " k =0 k! then substituting bk from (1) into (4). we get (4) ' ! k ! k$ $ x k B( x ) = ( # ( # & ai & % k! k =0 " i =0 " i % (5) " = # k =0 k! xk ai # i !( k ! i )! k ! i =0 k (6) " k = # # i !( k ! i )!x k =0 i =0 ( k ai k (7) = ) k =0 ! a i x i $ ! x k 'i $ ) # i ! & # ( k ' i )!& % %" i =0 " (8) We now interchange the order of summation.
we can rewrite (10) as B(x) = ! ai x i $ ' ! x j $ ( # i! & ( # j! & % j =0 " % i =0 " ' (11) The left-hand summation is recognized as A(x). the equation can be rearranged as follows: B(x) = ! a i x i $ ( ! x k 'i $ ) # i ! & )i # ( k ' i )!& % % k= " i =0 " ( (10) Letting j = k-i.( B(x) = ) i =0 ! a i x i $ ! x k 'i $ )i # i ! & # ( k ' i )!& % %" k= " ( (9) Since the terms indexed by i can be considered constant with respect to the summation over k. we can write (14) as ( !1) j x j x i bi j! i! " " A( x ) = # j =0 # i =0 (15) . while the right-hand summation is ex. we can now write B(x) = A(x) ex from which we get that A(x) = e-xB(x) (13) (12) bi x i !x Since B ( x ) = " . we have j =0 " " ( ( !1) j x j % " ( x i % A( x ) = $) ' )b j ! & $ i =0 i i ! ' # & # j =0 (14) Becaues the indices are constant with respect to each other. Therefore. and e = i = 0 i! ! ( !1) j x j # j ! .
Letting n = i + j. and multiply numerator and denominator by n! to get A( x ) = " n n = 0i = 0 ## n n! n !i x ( !1) bi (n ! i )!i ! n! (17) This is again rearranged to give n i =0 A( x ) = Now. and once again re-indexing to change the order in which we sum over the i-j plane. comparing (18) with (3). #i& i =0 n . rearrange the variables. we simplify. we see that " n% a n = ( ( !1) n !i $ ' bi . xn ) n = 0 n! ( ) ! n$ n 'i # & ( '1) bi "i% (18) an x n A( x ) = " n = 0 n! ! (written with n instead of k as the summation label). we have " n ( !1) n !i x n !i x i A( x ) = # # b (16) (n ! i )! i i ! n=0 i =0 Now.
D. Hanson. Steve Fisk Mathematics Magazine: Volume 61. J. Number 4. Number 2. pages 224-229. K. Recontres. p. New York. Yaglom. Interesting related articles that generalize the problem of derangements are: iii Matching.H. Yaglom and I.158. Volume I. p. Derangements. 1964. Challenging Mathematical Problems with Elementary Solutions. pages 103-105 . iv The Secretary's Packet Problem. 1965. 78. Dover Publications.M. Seyfforth. A. Weston Mathematics Magazine:Volume 56. Mathematical Association of America.M.i ii Mathematics of Choice. Ivan Niven.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.