Opening Boxes

Alice and Bob are in a room with 100 boxes. The boxes are labeled 1, 2, ..., 100. Bob has 100 sheets of paper, also labeled 1, 2, ..., 100. He randomly puts one sheet of paper into each box.

Alice may start by opening any box of her choice.

After opening a box and finding paper k k :

  • If box k k is unopened, Alice will open box k k and repeat this process.
  • If box k k is open, Alice will stop.

What is the probability that Alice will open all of the boxes? When your answer is of the form p q \frac{p}{q} , where p p and q q are positive, coprime integers, input p + q p+q .


The answer is 101.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Ivan Koswara
Jul 18, 2015

I'm sure there is a more elegant solution that this, but I can't find it at the moment.

We change the rules slightly:

Suppose the first box is numbered a a , containing the paper b b , and assume a b a \neq b Suppose box b b contains the paper c c . Immediately swap the contents of the two (so box a a contains paper c c and box b b contains paper b b ), and kick away box b b . Thus now we only need to look at box a a .

Suppose there are n n boxes, and box a a doesn't contain paper a a . Then after kicking one box, we're left with the identical(!) situation on n 1 n-1 boxes. This allows induction.

The only way to open all boxes is if we kick all the boxes except for box a a . If there are n 2 n \ge 2 boxes, the probability that we will kick at least one box is simply n 1 n \frac{n-1}{n} (the probability that box a a doesn't contain paper a a ). Thus the probability of opening all boxes is the probability of opening some box, for all of n = 100 , 99 , 98 , , 2 n = 100, 99, 98, \ldots, 2 , multiplied together. This gives 99 100 98 99 1 2 = 1 100 \frac{99}{100} \cdot \frac{98}{99} \cdot \ldots \cdot \frac{1}{2} = \boxed{\frac{1}{100}} .

Moderator note:

There actually isn't a need to change the rules. The main observation is that "the game ends when we find the paper marked a a ".

If there are n n boxes left, and none of the previous boxes have the paper marked a a , then the probability that the next box doesn't have the paper marked a a is n 1 n \frac{n-1}{n} . Thus, the probability that we don't find the paper marked a a for 99 boxes, is just

99 100 × 98 99 × × 1 2 \frac{99}{100} \times \frac{98}{99} \times \ldots \times \frac{1}{2}

Maggie Miller
Jul 17, 2015

The arrangements of papers in boxes uniquely determines an element from the symmetric group S 100 S_{100} , which sends n n to k k when box n n contains paper k k . Alice will open all the boxes if and only if this element of S 100 S_{100} is a cycle of length 100 100 . There are 99 ! 99! such elements, and 100 ! 100! elements altogether in S 100 S_{100} . Therefore, the probability that Alice will open all the boxes is 99 ! 100 ! = 1 100 \frac{99!}{100!}=\frac{1}{100} , so the answer is 101 \boxed{101} .

Does this cover the chance that paper k is in box k ? If that's the case, then it is indeed 1 / 100 1/100 . But does it also cover the chance that paper k is in box n paper n in box k ? Then you will have to take care of cycles 2-98.

Anthony Pham - 5 years, 11 months ago

Log in to reply

When paper k k is in box n n and vice versa, that case is still covered - Alice can't open all the boxes because if she opens box k k , she could have only opened box k k and n n . The corresponding element in S 100 S_{100} has a cycle of length 2, so it isn't a cycle of length 100.

Similarly, when paper k k is in box k k , Alice can't open all the boxes because if she opens box k k , she couldn't have opened anything else. The corresponding element of S 100 S_{100} fixes a number ( k k ), so isn't a cycle of length 100.

So, we count both of these cases as cases where Alice doesn't open all the boxes. The cases with cycles 2-98 are similar! Hope that helps.

Maggie Miller - 5 years, 11 months ago

Nobody understanding the answer

Adarsh Mahor - 5 years, 11 months ago

Log in to reply

Yeah, it's a bit of college-level algebra, but it is very slick. Luckily, Ivan has uploaded a more accessible answer! :)

Maggie Miller - 5 years, 11 months ago

Log in to reply

You could make the solution by accessible by explaining why
- There are 100! permutations of 100 elements
- There are 99! permutations that involve a 100 cycle

Yes, the "correct" setting is in terms of permutation groups, but it isn't necessary for someone to understand group theory, in order to solve this problem.

Calvin Lin Staff - 5 years, 11 months ago
Radhika Saithree
Jul 19, 2015

There is a good chance that the paper won't be in the right box (99/100 chance, I think). But imagine her opening all the boxes... if she opens one and it is wrong, she goes to the next one, and then the next one and the next one till she opens the last box. But what if she does find a right after opening box 99? or box 38? or box 47? and so on... So there is a 99% chance that she will find the right one in one of the boxes between box one and box hundred. Meaning 1/100 chance of opening ALL of the boxes and ALL of them are wrong.

1 + 100 = 101.

Note: this is just my guess at what the solution would be. It may not be an entirely accurate response/way to solve it :)

This is right - great intuition! :)

Maggie Miller - 5 years, 11 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...