Deangements Bian Coney and Tom Davis coney@aimath.og and tomdavis@eathlink.net http://www.geomete.og/mathcicles Mach 23, 2000 Seating Mixup Imagine that Yankee Stadium is completely sold out, but when the ticket holdes aive, they choose seats entiely at andom. What is the pobability that at least one peson is seated in the seat indicated by his ticket? Obviously, you need to know how many seats ae thee if thee wee only one seat in the stadium, then that peson has to be in his seat, so the pobability that he is coectly seated is. Fo the puposes of this poblem, assume that thee ae 50000 seats in Yankee Stadium.. Expeiments It will tun out that thee is not too much diffeence in the answe if thee ae 20 seats o 50000 seats, but that s not obvious at fist. One nice way to appoach the poblem is to do a few expeiments that equie only a deck of playing cads. Let s un some expeiments with a mini Yankee Stadium that contains only 3 seats. Select all of the spades and all of the heats fom the deck. Now place all the spades, in ode, in a line like this: Now shuffle the heats and deal them out undeneath the spades, making a patten that looks like this:! Fo the paticula deal above, the 0 of heats lands unde the 0 of spades, so thee is a match the peson with the ticket numbe 0 wound up in seat numbe 0. Repeat this expeiment many times. Shuffle the heats and epeatedly deal them out unde the spades. Afte each deal, check to see if thee is a match, and keep tack of the numbe of times thee is at least one match and the numbe of times thee is no match. Fom this data, calculate an appoximate pobability, based on the expeiment. Now change the expeiment and do the same thing, but with only 8 cads fom each suit (ace though 8 of heats and spades). Calculate an appoximate pobability based on this smalle deck.
If you can pogam computes, you might ty to simulate this expeiment fo thousands of deals. A sample pogam witten by the autho geneated the following esults with 00000 deals using decks of cads of size, 2, 3, 4, 5, 0, and 30. The numbe in the left column is the numbe of cads in the deck; the numbe in the ight column is the numbe of deals (out of 00000) whee at least one of the cads was in the coect spot. The code fo this pogam, witten in C, appeas at the end of this document. 00000 2 49735 3 66763 4 62655 5 6334 0 6370 30 63059 This makes some sense if thee s only one cad, thee will always be a match, so thee have to be 00000 matches. If thee ae two cads, thee ae only two possible odeings. One of those odeings switches the cads and the othe doesn t, so half the deals should match. The expeimental esult of 49735 out of 00000 is vey close to 50%. 2 Calculations fo Small Decks Let s see if we can wok out the exact esults, at least fo a few small decks. We can check ou calculations against the expeimental esults above. We have aleady done this fo decks of size and 2. Fo a deck of size 3, thee ae 6 possible deals of the cads, all equally likely. Let s just call the cads, 2, and 3. Hee ae the possible deals, with a" mak in the final column if thee s a match: 2 3 2 3 " 3 2 " 2 3 " 2 3 3 2 3 2 " Fou of the six deals have a match, so we expect that oughly # $ %'&)(* * * *+( ( ( of the hands should have a match. Ou expeimental esult of * *, * % $ -...../&0(* *, * % is petty close. Now let s do the same thing fo a fou cad deck: 2
2 3 4 2 3 4 2 4 3 3 2 4 3 4 2 4 2 3 4 3 2 2 3 4 2 4 3 2 3 4 2 3 4 2 4 3 2 4 3 3 2 4 3 4 2 3 2 4 3 2 4 3 4 2 3 4 2 4 2 3 4 3 2 4 2 3 4 2 3 4 3 2 4 3 2 In this example, thee ae 5 cases out of the 24 possible deals whee thee is a match. The pobability should be 2 3 4 5 687:9; 5 3, again not too fa fom ou expeimental esult of; 5 ; 3 3 4 2 < < < < <=7>9; 5 ; 3 3. To do an exhaustive list fo the case of a 5 cad deck would equie 20 deals which we could do, but it would not be pleasant. But look at the case above of couse if thee s a in the fist slot, thee will be a match, so all 6 deals like that will be matches. But if thee is a 2 dealt fist, thee ae 3 matches. Similaly, a 3 dealt fist o a 4 dealt fist yield exactly the same numbe (3) of matches. Theefoe thee ae;@?a+b A7:2 3 deals with at least one match. Fo the case of a 5 cad deck, thee ae 5 possible cads that can come fist. If a comes fist, all have a match, fo 24 combinations. All fou othe possibilities fo the fist cad ae simila, so we meely need to count them fo a 2 in the fist slot. Do this as an execise, and you ll find that thee ae 3, so the gand numbe of deals in which thee is at least one match is 5 68?C6B 2 A'7ED ;. So 76 out of 20 deals gives a pobability of a match of D ; 4 2 5 < 7:9; A A A+9 9 9, again close to the expeimental esult of ; A A 6F2 4 2 < < < < <=7:9; A A 6F2. It is possible to count lage decks, and if you e inteested, it is an inteesting expeience, but let s see what we have so fa: The table below has fou columns: the size of the deck, the numbe of deals with at 3
least one match, the total numbe of possible deals, and the pobability of at least one match: G H G=I:G 2 2 G H J8I:KL 3 4 6 M H N8I>KN N N+K K K 4 5 24 G L H J M8I:KN J L 5 76 20 O N H G J P I:KN Q Q Q+K K K Notice that the pobabilities seem to altenate, going down, then up, then down, but also seeming to convege. In fact, look at the diffeences between the pobabilities: G@RSG H J8I:G H J, G H J+R/M H N8I R8G H N,M H N RCG L H J MI:G H J M, and finally, G L H J M RSO N H G J P I:R8G H G J P. The signs altenate, but the factions ae all of the fom TG H UWV, whee UWVWI)UWX USR G Y X U/RSJ Y[Z Z Z G. So just looking at the data we have, it appeas that the pobability of getting at least one match fom a andom deal of a deck ofu cads is: G G V R G J V[\ 3 Counting Deangements G Q V RCZ Z Z T G UWV K Now let s take a look at a elated poblem. Imagine that you have a bunch of people who list thei food pefeences. Fo the fist example, imagine that we just ask eveybody about two foods: cake and peanuts. Suppose 0 people don t like eithe, 5 people like cake but not peanuts, people like peanuts and not cake, and 4 people like both. So thee ae G P \ L \ G G \ G MICM P total people. Anothe way of looking at the people is this. Of the 40 people, 9 people like cake (the 5 who like cake only and the 4 who like both cake and peanuts), and 25 people like peanuts. Suppose we know these numbes and that thee ae 40 total people and we ty to wok out how many people don t like eithe. The fist appoach is to stat with the 40 and subtact off the people who like one o the othe: M P R]G ^ RJ LI_R@M. Clealy this isn t the ight answe we can t have a negative numbe of people but what went wong? The answe is that we subtacted off the people who like both cake and peanuts moe than once one time when we subtacted the cake people and one time when we subtacted the peanut people. We only wanted to subtact the cake-and-peanut people once, but we subtacted them twice, so if we add them in, we ll get the ight esult: M P RCG ^ RSJ L \ G MI:G P, and 0 is the coect numbe of people who like neithe. Now conside a moe complex example, whee thee ae thee possible foods: cake, peanuts, and tunips. Evey peson eithe likes o dislikes each, so thee ae eight diffeent categoies of people. In the chat below, all the possibilities ae listed, togethe with the numbe of people who fall into each categoy: 4
C P T # ` 5 ` 8 ` ` 2 ` 20 ` ` 5 ` ` 4 ` ` ` 7 If thee is a bullet (` ) in a column, that means the peson likes that paticula food. C, P, and T stand fo cake, peanuts, and tunips. The fouth line indicates that thee ae 2 people who like peanuts and tunips, but do not like cake, et cetea. Evey possible set of likes and dislikes is listed, and thee ae 72 total people. Of these people, 46 like cake (and pehaps othe things). Similaly, 2 like peanuts, and 29 like tunips. If we ty ou defective method fo counting the numbe of people who don t like any of the foods, the fist appoximation is a b@c'd e+c/b fc/b g h:c+b d. But we know what s wong many people wee subtacted moe than once. Thee ae people who like cake and peanuts (and may o may not like tunips), 22 people who like cake and tunips, and 9 people who like peanuts and tunips, so maybe we d bette add them back in: a b8csd e8ccb f csb g8i>f f+i]b b i]g/hjf k. This is still wong. The eason is that 7 people like all thee. They appea in the oiginal list of 72, but wee subtacted out 3 times oiginally. But then they wee added in 3 times when we added the people who like at least two foods. We need to subtact them out again, and when we take the 7 fom 8, we get exactly the numbe who don t like anything. This same geneal scheme will wok fo any numbe of items. To find the numbe of people who don t like any of them, stat with the total numbe of people, subtact off all the people who like each of the individual items, then subtact off the people who like at least two, add in the numbe who like at least 3, and so on. We can do exactly the same sot of thing with the Yankee Stadium poblem. If thee ae l seats, thee ae lsm possible aangements. We want to count the numbe of deangements odeings whee none of the people get the coect seat. To do this, begin withlsm and subtact off the ones whee thee is a match. This is an easy example of what we just did in the pevious examples, we had vaying numbes of people who liked diffeent combinations of food, but hee we just conside a single vesion of each seating aangement. How many aangements ae thee with peson in seat? Well, the est of the l)ccf people can be aanged in any of n l0c]f o m ways, so thee ae n lpc]f o m such aangements. Thee ae a simila numbe of aangements with peson 2 in seat 2, et cetea. So we ll subtact all those off. But then we ve subtacted many aangements moe than once. Some of the aangements have the coect peson in both seats and 2, and we subtacted that aangement twice. 5
w t t w t How many aangements have peson and 2 in the coect seats? Well, thee aeqs8t emaining seats, and those can be aanged in any of u q_/t v w ways. We need to add in all of those, then subtact off all the cases whee thee ae at least 3 people in the ight seats, then add in the cases with 4, et cetea. So thee ae x yz { ways to pick one peson with the coect seat, x y { ways to pick two people with the coect seat, and so on. Thus, the total numbe of deangements is this: qsw E} q u q) v w j} q u q)t v w _} qw u qp v w ]ƒ ƒ ƒ qsw qsu q) v w qsu q) v u q)st v w t w qsu q) v u q)t v u q) qsw w t w w sƒ ƒ ƒ v w ]ƒ ƒ ƒ But thee ae qsw eaangements, so to get the pobability of a deangement, we have to divide by qsw, giving the following pobability fo a deangement: w t w w sƒ ƒ ƒ In the pevious section we wee counting the opposite of deangements we wee counting cases whee at least one slot was coectly filled, so we need to subtact the numbe above fom to get that esult, and thus we obtain the guess we made peviously: w t w w Cƒ ƒ ƒ Fo easonably lageq, the numeical value of this is oughly ˆ t Š Š t Œ. If you happen to know the Taylo seies fo Ž, you can get a quick appoximation fo lageq : Ž S t w [ w F w ]ƒ ƒ ƒ So z t w w w ]ƒ ƒ ƒ Fom this it s easy to deive the esult we want. The pobability of at least one matching seat is appoximately given by: ˆ t Š Š t Œ+ 6
Æ Æ Æ Æ 4 Cad Deck Simulation Code F F š œs ž Ÿ F W F œ F œc _ª «««««F W Ÿ ±² :³ ³ [µ Ÿ: žw ª «««W¹ Ÿ: š Ÿ@¹ Ÿ_ ±²ºW±² Fª[±²»W±ž š œw± Ÿ ¼ ±' [ Ÿ@¹ Ÿ:ž šf œ ž ž]½s«w¹ ) j¾ ½>» µ ¼ Ÿ ž Ÿ œ ±² ÀFž œwá'â žs š à œ > ž Ä [± «µ ¹ œ Å[ ŸW ª µ ¹ š Ÿ>½ ŸF [ ª µ ¹ ) š Ÿ> ½>«µ š Ÿ>½_ª «W¹ ]½s«W¹S ] > š Ÿ@¹ Ç Ç µ žw ş½: ¹ ]½s«W¹S ] ] W¹ Ç Ç µ ž š œs½sè «>Ç µ Â[ª ««[ª[¹ ºs½>«W¹/º: sž š œw¹'º Ç Ç µ FªS½ µ  š Ÿ@¹»s½ µ  š Ÿ@¹ Ÿ ¼ ½> žw Fª W¹ žw Fª ]½> žw» W¹ žw» ]½]Ÿ ¼ ¹ [ Ÿ:½s«W¹ ºs½>«W¹/º: s š Ÿ@¹/º Ç Ç j µ žw º ]½ ½sº µ [ Ÿ>½_ª[¹ ) [ Ÿ µ ž šf œ ž ž Ç ÇW¹ ¼ Ÿ œ žá  W¹/ šf œ ž ž œ žá'â Ä [±' W±/ž šf œ ž ž µ ¹ 7