3 ms·
I'm not sure why you think it is ill posed. The question is, you randomly pick a ball, IF it is red then... So yeah, it is basically the same as "someone else r
by chrismcb 3y ago
I'm not sure why you think it is ill posed.
The question is, you randomly pick a ball, IF it is red then...
So yeah, it is basically the same as "someone else removes a red ball" now randomly select a ball.
OR Pick a ball, is the color of the second ball more likely to be the same as the first, different, or equal. That is really the question here.
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)
- BeetleB 3y agoForgive my frequentist bent, but: 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.
- bagels 3y agoThe revised code here gets to correct estimate: https://news.ycombinator.com/item?id=39198581 https://news.ycombinator.com/item?id=39198581 Roughly similar to what I wrote too.