A confusing probability question: Red and green balls in an urn (colab.research.google.com)
Daniel Litt @littmath
You are given an urn containing 100 balls; n of them are red, and 100-n are green, where n is chosen uniformly at random in [0, 100]. You take a random ball out of the urn—it’s red—and discard it. The next ball you pick (out of the 99 remaining) is:
More likely to be red 22.6%
More likely to be green 37.1%
Equally likely 20.9%
Don’t know/see results 19.5%
I thought it was interesting (but not surprising) that so many people got this wrong. Basically, Bayesian thinking is really foreign to people. It's essentially similar to the famous Monty Hall problem, where the first bit of information tells you something about the world. In any case, I thought it might be illuminating to give a complete demonstration, using both exact calculations AND simulation, of the "wrong" and "right" approach, which you can see at the Colab link above.
168 comments
[ 3.3 ms ] story [ 247 ms ] threadWe don't actually know the mix-rate of what's in the urn. It's possible we just pulled the only red ball and all the others are green... However the fact that our first n=1 sample happened to be red (and not something else) gives a small (and varying) amount of confidence towards red-heavier mixes rather than the red-scarce ones.
We can use that to figure out which mixes are slightly more-likely to be in there (based on our tiny amount of data after assuming they begin equally-likely) and then for each of those determine "if it's mix X, then what are the odds of our next draw", and combine the two layers of probability.
In this case, the bias towards presuming the mix is fundamentally reddish outweighs the presumption of "removing one red makes the greens the majority."
Also, the logic continues as you draw more balls from the urn. If the second ball is ALSO red, then you have even more evidence suggesting that N was selected in such a way as to make red the overwhelmingly more likely choice. Thus the chance of the third ball being red is even higher than the 66% probability in the second draw.
"One cool thing is that this probability doesn’t change if you replace 100 in the statement of the problem with some other number (as long as it’s at least 2), as these arguments show."
Source: https://x.com/littmath/status/1752167731682492522?s=46
I wouldn't characterize this as a small amount of confidence, as conditional distribution of the mix-rate after the first sample drastically differs from the prior.
Originally each mix-rate has 1/101 probablity. After the sample having a mix with n reds in it has the probablity 2n/(100101).
> You are given an urn containing 100 balls; n of them are red, and 100-n are green, where n is chosen uniformly at random in [0, 100]. You select 99 balls at random and find that they are all red. What is the probability the last ball is red?
But if there is a green ball, it is unlikely to be the last picked. So the fact that you saw 99 red balls makes it unlikely there is a green ball.
4901:4900 in favor of red. (100*98/2 = 100*49. Plus one in favor of red)
If the number of distribution were odd, the odds would be even.
Am I right?
Let's try it as a set of 3 balls. You have 3 balls in an urn, random number of red v green, the first one you pull is red, what's the likelihood that the second one you pull is also red?
So I added one to one side instead of 50 and 49 to the other.
So 4950:4949.
... is that right? Im pretty sure red is favored, and Im pretty sure if the number of dists were odd the odds would be even. But are the odds right?
ie i think many of the More Likely to be Green people are doing the math of if you pull from an urn with n/100 odds of getting red, your second pull will have odds (n-1)/99, which is less than n/100 for all n except n=100. Which is obviously a different question than should you bet on Green or Red.
Which is obviously a different question than "would you bet on the next ball being red or green"
Yes, under that definition of "more likely", it cannot be more likely. It can be equally likely or less likely. And then weighted it would be less likely. And that would be the answer. Which is one of the choices.
2 - Exactly what parts of the question are nonsense under that interpretation?
Under this interpretation, the second ball is more likely to be green.
Like: you have a box with a whole bunch of red and green balls. Would removing a red ball increase or decrease the likelihood of drawing a red ball from the box in the future?
I wouldn't buy that as a reasonable misinterpretation of the question in most cases, but I don't know what standard of analysis holds for Twitter polls.
I think it's a matter of knowing that the phrase "where n is chosen uniformly at random" means something very different in a probability question than "where n is an arbitrary value".
Or I could just say "I think most people interpreted the tweet correctly, and it would be annoying if it was overly precise"
Try this book out, it's a fun read on how minor changes in words can make big differences in readability: https://www.amazon.com/Sense-Style-Thinking-Persons-Writing-...
For example:
> The first time you shoot a basketball, you will almost certainly miss. The second time, you are more likely to make it.
Does the second sentence mean "more likely to make it than to miss"? No.
You can easily apply frequentist probability reasoning and still get the right answer. You have to start from P(n > 50 | first pull is a red ball), and compute P(second ball red | first ball red) based on that.
Basically the mistake is computing the frequency over 100 balls, instead of computing it over the 100 possible values of n multiplied by the 100 balls.
I think if the question had instead been "would you bet on the urn having started out with more red balls, green balls, or equal number of balls" the distribution would have been very different.
Personally I’d word it as “The next ball is… more likely to be red than green / more likely to be green than red / equally likely to be red or green / I don’t know.”
But also, it's not irrelevant because for two cases the probability stays equal. Calculating the exact chance is still an interesting problem and it could have been dumbed down for twitter only.
I say both can be a question in Statistics I where you calculate probabilities based on combinations.
So I'll say it depends on the level of education for how the question gets interpreted and saying those who never took Bayesian reasoning and consider n unknown are wrong gets elitist.
If you change their simulation formula to pull from a binomial instead of uniform... it looks 50/50.
Since the coins are independently flipped, you can assume that it’s still just a binomial distribution of size n-1 and the same p.
Someone picks a coin without you knowing which one, then starts flipping.
The first toss shows heads.
Does that mean subsequent flips from the same coin will be more likely to be heads?
Yes.
Answer is only no if all coins are the same with no bias, which they are not.
You now have 101 coins, with biases ranging from 100 percent heads (or urn with only red balls) to 100 percent tails (or urn with only green).
Someone chooses one of the 101 coins randomly (each coin has equal probability of being chosen) and starts flipping it.
First flip shows heads, what is the probability the next flip is also heads?
Answer is 2/3.
The point is that knowing what was the first flip gives information about what biases a coin may have.
The original problem has a minor technical twist that balls are drawn without replacement, but it’s an irrelevant detail for N>10 total balls.
You’ve replaced it with a binomial of a uniformly selected p, which ends up being, amusingly, the same as a uniform.
It’s mostly irrelevant what kind of distribution this bag of coins comes from (except for some degenerate cases). What matters is that selecting coins from this bag gives coins of varying biases.
Let’s ignore RRG because it becomes a 50-50 anyway.
RRR has a 100% chance of yielding Red. But is 3X less likely than RGG.
RGG has a 33% chance of yielding Red but was 3X more likely.
Edit: so still 50/50 Given a draw of red, you have exactly the same probability of having been in RRR and RGG. So you were equally likely to have 100% chance or a 0% chance.
Humans aren't wired for uniform distribution. 100 reds seems crazy unlikely compared to 50/50, yet this trick question makes those equally likely.
I am imaging a random number generated from truncated normal distribution with mean 50, clipped 0 and 100: the answer will still lean right.
How would binomial work? You have 101 urns from which to choose.
Binomial: it is 50/50.
The reason these change the situation dramatically is that under normal or binomial, you are waaaay more likely to be in a situation that is close to 50/50 to begin with because they are way more likely to occur. The quirk of this question is that a 0 green 100 red urn is just as likely as a 50-50 red/green urn using a uniform distribution - hence if you get red on the first draw you are much more likely to be in a heavily tilted red urn.
How do you narrow 101 choices into two?
Would the question be valid if the first ball was green? If not, then it's equivalent to the standard answer to the Monty Hall problem. Analyze it as if the first ball was not picked randomly (i.e. Monty intentionally picked the wrong door).
edit: After thinking about it some more, it is NOTHING like handing the bag to someone else and having them remove a red ball. The whole point to the first draw is to draw the ball randomly. I think my second statement is still true. But to your original question, if the first ball isn't red, then the question is invalid (and you can't throw the ball in and choose again)
When in doubt, simulate (with code). Do this N times for a large N, and take the ratio to get a probability estimate.
So the question is: How will you code it? You'll find half the people code it one way (to get one answer), and the other half will code it differently to get a different answer. That's because it is ill posed.
As an example, I would code it as:
Let n be a random number from 1 to 100 (cannot be 0!)
We throw away one red ball as we know we picked one.
Construct a list of n-1 red balls, and 100 - n green balls.
Pick a ball at random. Success if it is red.
Repeat this N times where N is large.
Take the ratio of successes with N.
When I run it, I get 50%
How would you simulate it differently?
The problems with the code in the submission:
If n==0, he continues, but still counts it as a trial (he still divides by num_trials). He should deduct the number of trials every time n==0.
Roughly similar to what I wrote too.
A common phrasing. It doesn't mean that scoring is more likely than missing, it means the second time is more likely than the first was.
If monty opens doors randomly, and shows you a goat, you do not benefit from switching. Edit: assuming he doesn’t open your door of course
ROT13: Gur zber erqf, gur zber yvxryl lbhe svefg chyy vf erq.
No one is making changes based on your actions, like Monty did.
1. Red, Red, Red
2. Red, Red, Green
3. Red, Green, Green
(The Green, Green, Green case is impossible because you drew one Red.)
Drawing a Red from urn configuration (1) was a 100% probability; from (2) was a 66% probability, and from (3) was a 33% probability. If these configurations were equally likely, then the probability of Red and Green on the second draw would be the same.
However, and this is the crux: we are more likely to be in a configuration which shows us what we have observed with a higher likelihood [1]; so we're more likely in configuration (1) or (2) than (3), and as (3) is the only one that favors Green for the next draw (and only by as much as (1) favors Red), the next ball being Red is more probable.
[1] Imagine, for example, that you have 100 coins, and 99 of those coins are biased so that they only show heads once every trillion tosses, while the remaining one coin is fair. If you pick a coin randomly and flip heads, which is more likely: that you got a biased coin to show a one-in-a-trillion event, or that you picked the fair coin?
The contents of the urn would still be a set, but if the contents were initially drawn from a binomial distribution, calling out the possible combinations is required for purposes of counting, ie figuring the probability of each combination.
People intuitively know that there are more ways to have two green and one red than three reds. That maps to most things in the real world too. This question sort of tricks people.
> n of them are red, and 100-n are green, where n is chosen uniformly at random in [0, 100].
N is chosen first, and that many red balls are put in. You don't flip a coin 100 times and then determine N from how many heads you flipped, that would be a tortuous interpretation from my pov, and would violate the requirement that N is chosen uniformly, so it seems like it's right there in the question.
The way you can know this is: ask people the same question with "binomial" instead of "uniform" and see if you get a different answer. My guess is people will say the same regardless.
> n is chosen uniformly at random
If the balls follow a binomial distribution, then your intuition would say that N wasn't the thing that was chosen; the balls were chosen, and then N was determined afterwards by counting the balls that you picked. This is because you cannot choose N and then draw balls binomially and get that many green or red balls. You'd have to choose 100 balls, see whether the number of Red matches your chosen N, and if it didn't, draw again, which is a tortuous interpretation given the phrasing, as I said above.
By saying that N was "chosen", it implies to me that N comes first, and the choice of balls comes after that, i.e. the balls are not binomially distributed.
Wouldn't you need some extra parameters if it were a binomial distribution though? For a uniform distribution every item is equiprobable (i.e. there's only one uniform distribution for a given N) but there are many binomial distributions possible for a given N. (Disclaimer, I know very little about statistics.) So the fact that you aren't given those parameters in the question means you can't make much of a prediction if it were binomial.
Edit: I read that binomial distributions are parameterized on both the number of trials and the probability of the two outcomes, so that kind of demonstrates my point doesn't it? You're not given the probability of Red and Green for the binomial distribution, so you can't really answer the question that way. You could assume it's 50/50, but that's an assumption that isn't justified by the question.
What is 3 x 2?
. . .
. . .
1, 2, 3, 4, 5, 6 . . . six?
Edit: To add to that, check out the Erdos book from the 90s on innumeracy (here's Wikipedia instead of an AMZN affiliate link):
https://en.wikipedia.org/wiki/Innumeracy_(book)
1. More likely to be red because the urn has a greater chance of having more red balls
2. Equally likely by considering all remaining urn possibilities to be equally likely
3. More likely to be green because obviously there is one less red ball than before
I wrote a Python program to simulate the problem. It tells me that the correct answer is (2) - it's equally likely that the next ball is red or green.
I wonder if I've made a mistake, or if that's really the real answer!
EDIT: I did make a mistake! The above produces a binomial distribution of urns with red/green. As in, the most common urn is one with an equal number of reds and greens, and the least common is all reds or all greens. Whereas they should have equal probability. To actually match the question: The answer is indeed (1) More likely to be red.In this specific case, P(redOnKthSample) = (numberOfRedSamples + 1) / (totalNumberOfSamples + 2) = (1+1)/(1+2) = 66% red.
On the second draw, if the ball is green, then you get P(redOnThirdSample) = (1 + 1) / ( 2 + 2) = 50%
There are 101 configurations (the different values of N). We know our first ball was red. So N == 0 has a score of 0 (it's impossible since we found a red), N == 6 has a score of 6 (there are six different ways we could draw a red), N == 100 has a score of 100. The sum of all the scores is 5050, so the probability that N == 100 is 100/5050 = 1.98%.
The value we're interested in is p(2nd ball == red). In the N == 100 configuration, that's 100%: it contributes 100% * 1.98% to the final "score". In the N == 6 configuration, that's 5/99 (we already drew one red), so it contributes 5/99 * 6/5050 to the final score. Add up the final scores and you get 66.67%.
As long as you can feasibly enumerate all possible configurations and score them accurately, this approach basically never fails.
"More likely to be red"
More likely than what?
"The next ball you draw from this urn is more likely to be red than green?"
One is 0% red, one 1% red, one 2% red, etc.
If I choose one urn at random, and then the first ball I pick is red, odds are good I picked a red-heavy urn.
I’d be interested to see if the general public answers differently when it is framed more concretely.
An obvious visual proof: Line up 101 marbles. Choose one to be the divider; to the left is red, to the right is green. Now draw two more marbles. Or just pick three, then decide which one is the divider.
`You take a random ball out of the urn—it’s red—and discard it.`
How normal people read it: Given this specific instance where you just discarded a red ball from this urn, what's the probability of the next ball?
How it expects you to read it: Given infinitely many random samples from the urn. For cases where you get red, remove it, then take a second sample. What's the probability of the next ball, given all the samplings?
This problem is in a similar category as badly explained monty hall problems where the statement of the problem is so bad that it ends up changing the answer.
For example I have seen the Monty hall problem stated in popular media like this:
“There are three doors, behind two are goats and one is a car. You choose a door at random and there’s a goat behind it. You choose another door, but before opening it the host asks if you want to switch your choice. Is it more profitable to switch or to stick or does it have the same chance?”
Of course it doesn’t matter. This is actually a good way to trick inattentive mathematicians who pattern match on the problem but don’t actually read it.
Two ways to think about this (same conclusion):
- Without loss of generality, take the case of just one red ball, rest are green. If you pick the one red ball on your first draw the chances are now 100% that the next ball is green (since there aren't any red ones left) whereas before you had picked the red one you had just a 99% chance of picking a green one.
Hence after picking a red ball you are slightly more likely to pick a green ball next.
- Another way to think of it, again without loss of generality consider if there was just one green ball and 99 red, then if you pick every one of them in some order there are a hundred different positions the green one could end up as. If you consider the one where it's last, after you have picked all but one (and they were all red), now you have a 100% chance to pick the green ball, even though you started out with 1% chance on the first draw: without loss of generality in the case of drawing until you reach the green ball when it is 1 in 100, each red ball you have drawn so far increases the chance of drawing the green ball next, up to a 100% chance when it is the only one left. Visualizing the chance going from 1% to 100% in this case as you draw more red balls should drive home the point that it becomes more and more likely you'll draw a green one next, in the cases that you've made it that far drawing red ones.)
Your reasoning can conclude that picking a green ball next time is more likely for any specific bag contents. But you can't then conclude that picking a green ball the next time is more likely, period. Picking red the first time gives you information that changes the probability distribution of likely bag contents.
We have N+1 people, also numbered 0 through N. Person k is holding jar k.
We ask each person to draw a ball at random from their jar. If they draw a green ball they take their jar and leave. If they draw a red ball they stay.
We expect on average (N+1)/2 people will remain.
We now ask them to draw another ball.
The expected number of red balls on this second drawing is (N+1)/3.
The expected number of green balls on this second drawing is (N+1)/6, half the expected number of red balls.
That's because on the first drawing, the more green balls in your jar the more likely you will draw green on the first round and thus take your jar and go home. The second round is biased toward people who have jars with more red balls.
Here's the math behind those results. The probability that person k makes it to round 2 is k/N. The expect number that will make it is sum {k=0, N) = (N+1)/2.
Once in round 2 the probability they draw red is (k-1)/(N-1). The probability they draw green is (N-k)/(N-1).
The probability then that they make it to the second round and then draw red is k/N (k-1)/(N-1).
The probability that they make it to the second round and then draw green is k/N (N-k)/(N-1).
The expected number of reds we see in the second round is sum {k=1, N} k (k-1) / N / (N-1).
The expected number of greens is sum {k=1, N} k (N-k) / N / (N-1).
Use the well known formulas 1 + 2 + 3 + ... + M = M (M+1) / 2 and 1^2 + 2^2 + ... + M^2 = M (M+1) (2M+1) / 6 and simplify and you'll get the (N+1)/3 expected red and (N+1)/6 expected green I stated above.