The locker puzzle

5 downloads 315 Views 984KB Size Report
Dec 12, 2009 - The Locker. Puzzle. Eugene Curtin and Max Warshauer. S uppose I take the wallets from you and ninety-nine of your closest friends. We play ...
I I L V ; [ h - ~ i , [ : - ] , , l - : . l i [ , , - t .: a l l ; ; l - - i i ( : a l i /", l - =. i , , a , , [ ~ , l-, i L : - l l -

.

This column is a place for those bits of contagious mathematics that travel from person to person in the community, because they are so elegant, suprising, or appealing that

Michael

Kleber

and

Ravi

The Locker Puzzle

one has an urge to pass them on. Contributions are most welcome.

Eugene Curtin and Max Warshauer

u p p o s e I t a k e the wallets from you and ninety-nine of y o u r c l o s e s t friends. We play the following game with them: I r a n d o m l y p l a c e the wallets inside one h u n d r e d l o c k e r s in a l o c k e r room, one w a l l e t in e a c h locker, and t h e n I let y o u and y o u r friends inside, one at a time. E a c h o f you is all o w e d to o p e n and l o o k inside of up to fifty of the lockers. You m a y i n s p e c t the wallets you find there, even checking the driver's license to see w h o s e it is, in an a t t e m p t to find y o u r wallet. W h e t h e r you s u c c e e d or not, you leave all h u n d r e d wallets e x a c t l y w h e r e you found them, and leave all h u n d r e d l o c k e r s closed, j u s t as they were w h e n you e n t e r e d the room. You exit t h r o u g h a different door, and never communicate in any w a y with the o t h e r p e o p l e waiting to e n t e r the room. Your t e a m o f 100 p l a y e r s wins only if every team m e m b e r finds his or h e r o w n wallet. If you d i s c u s s y o u r strategy b e f o r e h a n d , can you win with a p r o b a b i l i t y that isn't vanishingly small? We develop a m o r e m a t h e m a t i c a l formulation to facilitate a p r e c i s e discussion of the p r o b l e m . This consists of n u m b e r i n g our players, and replacing wallets b y p l a y e r numbers! Our game is p l a y e d b e t w e e n a single Player A against a T e a m B with 100 m e m b e r s , B1, Bu, . . . , B100. P l a y e r A p l a c e s the n u m b e r s 1, 2 , . . . , 100 r a n d o m l y in lockers 1, 2 , . . . , 100 with one n u m b e r p e r locker. The m e m b e r s of T e a m B are adm i t t e d to the l o c k e r r o o m one at a time. E a c h t e a m m e m b e r is a l l o w e d to o p e n and e x a m i n e the c o n t e n t s of e x a c t l y 50 lockers. Team B wins if every t e a m m e m b e r d i s c o v e r s the l o c k e r containing his o w n number. Team B is a l l o w e d

S

Please send all submissions to the Mathematical Entertainments Editor,

Ravi Vakil, Stanford University, Department of Mathematics, Bldg. 380, Stanford, CA 94305-2125, USA e-mail: [email protected]

28

THE MATHEMATICAL INTELLIGENCER 9 2006 Springer Science+Business Media, Inc.

Vakil,

Editors

an initial strategy meeting. No comm u n i c a t i o n is a l l o w e d after the initial meeting, and each t e a m m e m b e r m u s t leave the l o c k e r r o o m e x a c t l y as he found it. It is i m p o r t a n t to realize that the solution d o e s not involve s o m e trick to p a s s information from one p l a y e r to another. We c o u l d equally well m a k e 100 c o p i e s of the r o o m a n d m a k e an identical distribution of numb e r s into l o c k e r s for each room, t h e n a s k the m e m b e r s of T e a m B to p e r f o r m their s e a r c h e s simultaneously, with one p e r s o n p e r room. E a c h individual will s u c c e e d in finding his o w n n u m b e r with p r o b a b i l i t y 1/2. If t h e y act independently, they m u s t get lucky 100 t i m e s in a row, and the t e a m will win with p r o b a b i l i t y only (1/2)1~176 Team B needs s o m e help! Amazingly there is a strategy w h i c h gives significant p r o b a b i l i t y of s u c c e s s for Team B. Even if w e give the p r o b l e m with 2n p l a y e r s on Team B e a c h of w h o m can e x a m i n e n out of 2n lockers, T e a m B can a p p l y the strategy to s u c c e e d with p r o b a b i l i t y over 30% r e g a r d l e s s of h o w large a value w e t a k e for n. Your p r o b l e m is to find this strategy.

Searching For Ideas Let's play with s o m e ideas using a m o r e m a n a g e a b l e n u m b e r of players 9 To be as c o n c r e t e as possible, let's switch to the c a s e of 10 p l a y e r s on T e a m B, e a c h of w h o m can exangne 5 out of l0 lockers. Here random guessing by each player is already s o m e w h a t hopeless and succeeds with probability (1/2)1~ - 1 1024 A first try to i m p r o v e the p r o b a b i l i t y of s u c c e s s is to s e a r c h for a c l e v e r w a y to assign a set of l o c k e r s for e a c h p e r s o n to examine. Certainly w e can i m p r o v e over r a n d o m guessing in this manner. F o r e x a m p l e if t e a m m e m b e r s 1-5 exa m i n e d l o c k e r s 1-5, and t e a m memb e r s 6-10 e x a m i n e d l o c k e r s 6-10, t h e y w o u l d s u c c e e d p r o v i d e d n u m b e r s 1-5 are p l a c e d in l o c k e r s 1-5. N u m b e r 1 is p l a c e d s o m e w h e r e in the first 5 lockers with p r o b a b i l i t y 5/10, t h e n given

that n u m b e r 1 is so placed, n u m b e r 2 is also in the first 5 with p r o b a b i l i t y 4/9 a n d so on. F o l l o w i n g this plan, T e a m B will s u c c e e d with p r o b a b i l i t y 54321_ 10 9 8 7 6

1 242'

While this is an i m p r o v e m e n t o v e r rand o m guessing, it still leaves T e a m B with slim chances. Although the s c h e m e fails, it is w o r t h noticing that if B1 finds his n u m b e r in this scheme, t h e n B6 will find his n u m b e r with p r o b ability 5/9 (as he will l o o k in 5 l o c k e r s not including the one containing the n u m b e r 1), b u t B2 will find his with p r o b a b i l i t y only 4/9. The s u c c e s s o r failure of B1 can influence the p r o b a bilities of s u c c e s s o f the o t h e r members. This is the first clue! An ideal strategy w o u l d be one w h e r e if B1 s u c c e e d s t h e n e v e r y o n e else d o e s too. Note that this w o u l d allow the w h o l e t e a m to s u c c e e d half the time even t h o u g h e a c h individual m e m b e r fails half the time. This ideal is not attainable, b u t p e r h a p s y o u can find a strategy w h e r e if B1 succeeds, then everyone else is m o r e likely to succeed. No m e t h o d of p r e a s s i g n i n g l o c k e r s will a c c o m p l i s h this, as if B~ finds his n u m b e r in l o c k e r k a n y o n e with l o c k e r k in their p r e a s s i g n e d set has his c h a n c e s reduced. This suggests that the l o c k e r choices will have to dep e n d on information n o t available at the initial meeting. The only such inf o r m a t i o n available is the n u m b e r s a p l a y e r finds inside the l o c k e r s he opens. With this further hint try one m o r e time to find a g o o d s t r a t e g y before w e p r o c e e d to the solution!

Developing the Solution Once w e realize that the l o c k e r B1 o p e n s at any stage can d e p e n d on w h a t he has found inside the l o c k e r s he has a l r e a d y opened, the n u m b e r o f possible strategies to c o n s i d e r is enormous, even in the 10-player case. The strategy m u s t tell B1 w h i c h l o c k e r to o p e n first (10 choices), w h i c h l o c k e r to o p e n n e x t if he is n o t lucky on the first try (9 c h o i c e s for e a c h of the p o s s i b l e 9 n u m b e r s he m a y see), w h i c h to o p e n third if he is not lucky on his s e c o n d a t t e m p t either (8 c h o i c e s for e a c h of the 9 • 8 p o s s i b l e s e q u e n c e s of 2 n u m b e r s he has s e e n so far), and so

on. So B1 alone has 10 X 9 9 X 89X8 X 7 9 x s x 7 X 6 9 x s x T x 6 p o s s i b l e strategies. To c o m p u t e the n u m b e r of strategy c h o i c e s for the w h o l e team, we raise this to the 10th p o w e r and get a numb e r 28,537 digits long! H o w are w e to c h o o s e one? In this section w e will show that one very simple strategy lets the team win with remarkably high probability. The strategy for any one player is entirely unremarkable; the magic arises from the fact that the chances of the different players winning are highly correlated. Moreover, in the next section, we will s h o w that the strategy is in fact optimal. F o r t u n a t e l y the g o o d strategy is simple to i m p l e m e n t a n d the choice of the n e x t l o c k e r d o e s not d e p e n d on the entire sequence of n u m b e r s s e e n but only on the m o s t r e c e n t number. The g o o d strategy has p l a y e r Bi start b y opening l o c k e r i. Then if he finds numb e r k at any stage and k # i, he o p e n s l o c k e r k next. Notice t h a t p l a y e r B i , never o p e n s a l o c k e r ( o t h e r t h a n l o c k e r i) w i t h o u t first finding its number, so each time he o p e n s a n e w l o c k e r he m u s t find either his o w n n u m b e r o r the n u m b e r o f a n o t h e r u n o p e n e d locker. Again let's look at a particular case with 10 players and suppose, for example, that the numbers are distributed in the order 6,8,9,7,2,4,1,5,10,3. Player B1 first examines locker 1 and finds the n u m b e r 6. So he looks in locker 6 finding the n u m b e r 4, then locker 4 finding the n u m b e r 7, then finally in locker 7 finding his number. When he finds his number, B1 will n o w k n o w that B6, B4, and B7 will look in exactly the same lockers in the same cyclic order, each finding his n u m b e r on the 4th try! He also knows that none of the other players will waste any tries on these lockers. We m a y r e p r e s e n t any p e r m u t a t i o n of n u m b e r s into l o c k e r s b y listing the cycles. The p e r m u t a t i o n 6,8,9,7,2,4,1,5, 10,3 gives the cycles (6, 4, 7, l ) (8, 5, 2) (9, 10, 3), and T e a m B s u c c e e d s because t h e r e is no long cycle. To find the p r o b a b i l i t y that T e a m B wins, w e count the n u m b e r o f p e r m u t a t i o n s of 10 numb e r s with a cycle of length 6 o r longer. First let's c o u n t h o w m a n y have a 6-cycle. C h o o s e w h i c h 6 e l e m e n t s go into the 6-cycle, arrange t h e m in cyclic order, and then p i c k an a r b i t r a r y p e r m u -

tation of the remaining 4 elements. The n u m b e r o f w a y s to do this is (160) 5!4!-

10,5!4, 6!4! -

10! 6

So 1/6 o f the 10! p e r m u t a t i o n s have a 6-cycle, a n d a r a n d o m p e r m u t a t i o n has a 6-cycle with p r o b a b i l i t y 1/6. The s a m e a r g u m e n t can b e u s e d to find the p r o b a b i l i t y of a p e r m u t a t i o n of 1-10 having a cycle of any length longer than 6. (We w a r n that the a r g u m e n t d o e s n o t w o r k for counting the n u m b e r of perm u t a t i o n s of 1-10 with a 5-cycle (or shorter) as the p e r m u t a t i o n could have two 5-cycles.) A p e r m u t a t i o n o f 10 n u m b e r s has a 7-cycle with p r o b a b i l i t y 1/7 a n d so on, a n d the p r o b a b i l i t y o f a cycle of length 6 o r larger is 1/6 + 1/7 § 1/8 + 1/9 + 1/10 = 1 6 2 7 / 2 5 2 0 0.645635. This gives the p r o b a b i l i t y that T e a m B will fail, so of c o u r s e Team B wins with p r o b a b i l i t y 1 - 1627/ 2520 = 893/2520 ~ 0.354365. Over 35% of the time, all 10 m e m b e r s of Team B find their o w n wallets! Will this i d e a b e g o o d enough for the initial v e r s i o n with 100 players? We can do the a n a l o g o u s c o m p u t a t i o n and see that this pointer-following strategy w o r k s with p r o b a b i l i t y 1 - (1/51 + 1/52 + . . 9 + 1/100) ~ .311828. Notice that while o u r strategy has still p e r f o r m e d r e m a r k a b l y well for 100 players, the p r o b a b i l i t y o f s u c c e s s w a s still less t h a n in the 10-player version. As w e i n c r e a s e the n u m b e r of players, d o e s the s u c c e s s rate d e c r e a s e to zero, o r d o e s it always stay a b o v e a certain positive n u m b e r ? With 2n p l a y e r s and 2n lockers, T e a m B will win p r o v i d e d that the p e r m u t a t i o n of n u m b e r s in l o c k e r s has no cycle o f length n + 1 or longer. The p r o b a b i l i t y o f such a long n nUk" 1 By viewing this excycle is Zk=l p r e s s i o n as an u p p e r R i e m a n n s u m for f,~,~ 1 d x a n d a l o w e r Riemann s u m 7Tf for f,~" ~ d x w e o b t a i n

( 1)2'

In2-

9't

+1

n _