Live data from Hacker News

A confusing probability question: Red and green balls in an urn

colab.research.google.com

101–110 of 169 posts

Re: A confusing probability question: Red and green balls in an urn

#101
Greetings

Unfortunately my probability skills are quite bad and i easily get confused, could someone explain where my reasoning fails?

I assumed since we have a uniform distribution of red to green balls, then the expected value would be 50 red balls.

So I assumed I can use this expected distribution to figure out the probability the question asked

in an urn where there is 50 red balls and 50 green balls, and we draw one red ball. The ball we draw next is more likely to be green (since we have 49 red balls vs 50 green balls)

Is my mistake that I took the expected value of the uniform distribution before the first ball was drawn? And I should think of the expected distribution of the urn given the first ball drawn was red? If so how would I go about that probabilistically? (i.e. how would I calculate

Exp [ n given first ball is red ] )

I can see that if the first ball was red, this removes one of the possible values (all balls are green)

And I can see how from all possible urns, the more they have red balls, the higher the likelihood the first ball drawn is red. I would assume this will skew the expected value somehow.

Is it like

``` expVal = 0

for all possible n (101 possible values): # possibility of first ball being red when we have n red balls * n * probability of n?

   expVal += (n / 100) \* n \* (1/101)
```

I'm sure the above is wrong, because this will just decrease the expected value where I am expecting an increase but I'm not sure how to model it

I would appreciate any pointers/help

Re: A confusing probability question: Red and green balls in an urn

#102
Answer is impossible to know without knowing n. If there are n=0 red balls probability of having a red ball is 0%. If n=100 red balls is 100%

If the idea is to repeat the experiment until reaching a limit the probability of choosing each number must be taken in account and included, and then we could take an average of all possible results.

Re: A confusing probability question: Red and green balls in an urn

#103
Classical don't think too much, calculate exercise.

1. Probability to pick green after a red for a given n is p = (100-n)/99

2. For all possible n given the first ball was red -> Integral_[0..100] (100-n)/99 * p(n|red) dn

3. So you need p(n|red) which is obviously different from p(n) for instance n=0 is not possible anymore -> p(n=0) = 1/101 != p(n=0|red) = 0

4. Again don't think to much, calc ... p(n|red) = p(red|n)p(n)/p(red)

p(n) = 1/101 (1 of 101 possible n, constant due to uniform distribution), p(red)=0.5 (due to symmetry since p(n) is uniform), p(red|n) = n/100 (n of 100 balls are red) -> p(n|red) = n/5050

5. plausibility check -> sum of p(n|red) for all n should be 1 -> (0 + 1 + 2 .. 100) / 5050 = 5050/5050 = 1

6. Hardest part, the integral from step 2. -> wolfram alpha says 0.33

7. It's a don't-think-too-much-calculate result, so don't be too confident )))

Re: A confusing probability question: Red and green balls in an urn

#104
post #22
post #12

I think this is less about Bayesian thinking and more about misinterpreting the question, as another poster mentions: https://twitter.com/farrwill/status/1751788706355392639 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 di…

Why would n be "uniformly randomly chosen" but then suddenly be known? I would mark this mis interpretation simply as wrong if I was a teacher.

Not known, but certainly defined. It has to not be zero at least, otherwise you couldn't take out a red ball in the first place. Or at least that's how I understand this problem. You don't know what number n is, so you need statistics or simulations to grasp the probability of the color of the next ball.

Re: A confusing probability question: Red and green balls in an urn

#105
post #101

Greetings Unfortunately my probability skills are quite bad and i easily get confused, could someone explain where my reasoning fails? I assumed since we have a uniform distribution of red to green balls, then the expected value would be 50 red balls. So I assumed I can use this expected distribution to figure out the probability the question asked in an urn where there is 50 red balls and 50 green balls, and we draw…

It's not 50 red and 50 green. There are 100 total balls, but you don't know how many are red or green. The number of reds is drawn from a uniform distribution, meaning the urn is equally likely to contain 1, 10, 55, or 99 red balls.

Re: A confusing probability question: Red and green balls in an urn

#107
post #101

Greetings Unfortunately my probability skills are quite bad and i easily get confused, could someone explain where my reasoning fails? I assumed since we have a uniform distribution of red to green balls, then the expected value would be 50 red balls. So I assumed I can use this expected distribution to figure out the probability the question asked in an urn where there is 50 red balls and 50 green balls, and we draw…

The fact that a red ball was drawn is new information that suggests there is a higher chance (however slight) that there are actually more red balls in the urn than green balls. Therefore the next ball is likely to be red.

Re: A confusing probability question: Red and green balls in an urn

#108

Imagine you have to guess a random number between 0 and 255, i.e. you have to guess 8 bits. You already know that it's less than 128 so the most significant bit is 0. Can you derive any knowledge about whether the second bit is 0 or 1?

Watch out. Because your bits are indexed you have a different problem than before. The first red ball does not give you a significant bit. Instead: Make a sample and now you know that it is greater than a random number unknown to you. Can you derive any knowledge about your next sample?

Indeed, indexing changing probabilities is very unintuitive for most people. Here's another fun one.

There's two coins on the table that you don't see. The only information provided is that

a) one of them is tails b) the left one is tails

What is the probability of both being tails?

It's 1/3 in (a) and 1/2 in (b). The reasoning being:

1. At first both HH, HT, TH and TT are all equaly likely. 2. In case (a) we discard HH as an option, but in case (b) we discard *both* HH and HT.

Re: A confusing probability question: Red and green balls in an urn

#109
post #83

Early in my career, when I first started interviewing, I used to ask a version of this to recent grads. It was never a make-or-break question, but I found it to be a great way to a.) see how people approach problem solving and probability and b.) see how they respond when you start asking whys (even if they answered/guessed 1/3). It's something that takes zero code to answer, and the intuition is easy to grok once ex…

  > what is the most probable distance between the two points?
  > even if they answered/guessed 1/3
1/3 is not the most probable distance, it's the expected value. The most probable distance does not exist, but PDF(d) is strictly decreasing for (d>0).

Re: A confusing probability question: Red and green balls in an urn

#110
post #12

I think this is less about Bayesian thinking and more about misinterpreting the question, as another poster mentions: https://twitter.com/farrwill/status/1751788706355392639 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 di…

I'd argue that it's not so much a difference of opinion than it is just a reasoning error given the question as stated. That's sort of the whole point of this post-- this is a case where "doing the math" in the expected way gives the wrong answer, because the state of the system is cast in stone (in terms of the ratio of red/green balls in the urn) when you first start out, so it's all about leveraging the informatio…

You don't need to think in terms of information to get the right answer, you just need to be careful of the setup.

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.

Post reply on HN