# Olivia's cookie jars

Olivia loves cookies so much that Dad promises to buy her two cookie jars on one condition: that she only eats one cookie per day.

Olivia agrees, and now two black, large cookie jars rest on the kitchen table. The jars are completely opaque, but on the label it says very clearly: each jar contains exactly 100 cookies.

So every morning Olivia wakes up, randomly selects one of the cookie jars, opens it and takes one cookie. Yum. Nobody else in the house eats cookies, so she's in for a long time treat.

After some time though, the inevitable happens: when Olivia opens the randomly selected jar that morning, she finds that the jar is empty. Quickly she glances worried to the other jar and the question pops into her mind:

What is the probability that the other jar is also empty?

EDIT: For clarification, Olivia does not realise that a jar is empty when taking the last cookie from it.

• I believe the answer will be around rot13(svir cbvag gjb bar frira creprag) but I'm having trouble proving it – SteveV Dec 2 '18 at 16:01
• This is the restatement of Banach matchbox problem, en.wikipedia.org/wiki/Banach%27s_matchbox_problem – Roah Dec 2 '18 at 21:31

## 5 Answers

There is a

5.63%

chance that the other jar is empty. This puzzle is asking the equivalent of

What is the probability of getting exactly 100 heads and 100 tails when flipping a fair coin 200 times?

which can be calculated by

$$0.5^{100}\times(1-0.5)^{(200-100)}\times\binom{200}{100} = 0.0563 =$$ 5.63%

• This should be it. I left out the fact that it doesnt matter which jar Olivia chooses at the 201th pick. – Kryesec Dec 2 '18 at 15:27
• Hi and welcome to Puzzling.SE! Nice answer. However when I run simulations, it comes out a different answer, so I wonder if they are exactly equivalent. – SteveV Dec 2 '18 at 15:31
• @Kryesec I think the discrepancy comes from the fact that you are assuming that there are always 200 attempts. But this is not true. There could be fewer attempts if there is a failure and these have to be removed from the probability you calculated – SteveV Dec 2 '18 at 15:46
• @SteveV: When I run a simulation it does give me this answer. – Jaap Scherphuis Dec 3 '18 at 7:07

Is it

zero

because this is the first time she's found a jar to be empty, so

the other jar has never been empty

• hello! This was my first thought too for a straightforward answer. But I was thinking that the discovery that it is empty is actually on the 101th reach into the jar. Nevertheless, this is the most logical solution in normal situation (: – Kryesec Dec 2 '18 at 9:54
• Hm. This is probably close, but rot13(vfa'g gurer n fznyy punapr gung fur'f ba qnl gjb uhaqerq, jura obgu wnef ner rzcgl naq fur unf nyjnlf pubfra n aba-rzcgl bar orsber)? – M Oehm Dec 2 '18 at 9:55
• @Kryesec: Not necessarily. That discovery could be on any day between 101 and 200. – M Oehm Dec 2 '18 at 9:56
• @MOehm agreed, but I was referring to the 101th reach into the jar in question (meaning that Olivia doesnt know that she is emptying the jar when she takes the last cookie) – Kryesec Dec 2 '18 at 9:57
• Oh, I see, the 101st time she reaches into that particular jar. I mistook "reach into the jar" for "reach into a jar". – M Oehm Dec 2 '18 at 10:01

The probability is

(Edit: kudos to @SHaze for noting the prior mistake I had on 201th run) 5.63%

Some basic assumptions:

1. Assuming that this is the first occurrence which is discovered that the jar is empty (Noting that this is the 101th time Olivia reach into the jar, discovered that there is 0 cookies inside)
2. This is a simple scenario of comparing 2 binomial distributions:

i.e. A - Number of times Olivia select Jar A ; &
B - Number of times Olivia select Jar B

Therefore:

This problem is a
$$P(A=101 OR B=101|B=100) =(0.5+0.5) * \binom{200}{100}0.5^{100}(1-0.5)^{200-100}$$ = 5.63%

• All I can say right now is that the answer is wrong... – Bogdan Alexandru Dec 2 '18 at 12:13
• @BogdanAlexandru looks like back to the drawing board it is .__. – Kryesec Dec 2 '18 at 15:15
• Better :) just a factor of two was missing. – Bogdan Alexandru Dec 3 '18 at 8:05

The problem means that when she took 100 of one jar she must not take from this jar until she has also taken 100 from the other jar.

So the problem is equivalent to

ending in the middle bin of a Galton Board with 200 rows. When you take 1 of one kind too much, you can't end in the middle bin of the last row anymore.

The probability therefor is:

$$\binom{n}{k}\times p^{k} \times (1-p)^{n-k}$$ Source Wikipedia

In our case:

$$\binom{200}{100} \times 0.5^{100} \times (1-0.5)^{200-100}$$

So the result is

$$0.056348...$$ or $$5.63%$$

• Hello, I've rendered your LaTeX properly and trimmed the decimal in the answer. – Quintec Dec 2 '18 at 22:42

I think the probability that the second jar is also empty is:

50%

Because:

Some other answers liken this problem to "the probability of getting exactly 100 heads and 100 tails when flipping a fair coin 200 times", and that might be the case if the question were "What are the chances of Olivia taking exactly 100 cookies from each jar over 200 days". But that isn't the question - the question is entirely about one of the cookie jars after we know the other is already empty.

Olivia has been "randomly" selecting a cookie jar each morning. If it were truly random, say for example she did toss a coin to decide which one to pick, then each day, the probability of Jar A or Jar B being selected would be 50% on any given day. Sure, the probability of the coin toss landing the same every day over a given period of time would be calculable, but on any individual day the probability in isolation is 50%. Olivia's own method of selection is probably far less random. If she made a "conscious" random selection she may have been very close to precise alternation between the two cookie jars and the number of remaining cookies in the other jar would probably be quite close to 1 or 0; whereas if it was entirely without thought she will almost certainly have subconsciously favoured one of the jars. In the latter case, her 'favoured' jar would be empty first and the other almost certainly contains some cookies, but I do not believe that number would be calculable.

One jar is now confirmed as empty. The question is, does the other jar have any cookies in, or not? It may have none - or any other number of cookies. It's 50-50.

I haven't approached this as a mathematics problem. Humans have been shown to randomly select numbers evenly across a range. With a choice of only two jars, the odds would be on Olivia alternating between them fairly evenly.

• I'm either going to win the lottery or not. So that's a 50-50 chance. – Kruga Dec 3 '18 at 9:04
• @Kruga Not the same, because millions of other people are playing too AND you have to win on a sequence of numbers. If the lottery involved you and two numbers, yes it would be. – Astralbee Dec 3 '18 at 9:10
• It just sounds like that's the kind logic you are using. – Kruga Dec 3 '18 at 10:04
• @Kruga Then I would have to say that you haven't read and understood my first paragraph correctly. I haven't used the logic for calculating a sequence of events because that is not the question. Why not make an answer yourself using the logic you believe to be correct? – Astralbee Dec 3 '18 at 10:11
• @astralbee But with your example there is the possibility that there is none, or there is some. But there could be 1 cookie left, 2 cookies left... until 100 cookies left. this all have the exact same probability as there being 0 cookies left. – TakingNotes Dec 3 '18 at 16:00