Probabilities When Throwing Balls in Bins

A few month’s ago Primer, a great youtube channel that you should check out, posted the following question on Twitter

Before I go over my thinking and then show some numerical simulations, take a moment and think it over. If you’ve already got the answer you can check out other numerical probability puzzles here.

My Thinking.

There are 3 different ways that we can throw the balls in the bins

  1. Alternate between red and green
  2. Throw all the red balls first and then the green balls (equivalent to a green first strategy)
  3. Randomly choose a color at the start of every throw

I’m going to stick to methods 1 and 2 in this post.

Whenever I have a probability problem I like to draw out the possible solution paths. First, for the alternating strategy, we get the following

There are 3 outcomes when throwing red balls and 3 outcomes when throwing green balls. Because all balls will be thrown, and all bins will be filled, we can ignore the half-filled options and get an estimate of the final probabilities which is 25% Red – 25% Green – 50% mixed.

Now for the red first strategy, we get the following

There are 2 outcomes when throwing red balls and 3 outcomes when throwing green balls. We can again ignore the half-filled options and have an extremely rough estimate of the final probabilities 33% red – 33% Green – 33% mixed. Now, unlike with the alternating strategy, this estimate of the probabilities is unlikely to be as close to correct as this isn’t steady-state, but my guess is that we are underestimating the red’s likelihood in this approximation. Because red’s likelihood in the red-first strategy is already higher than its likelihood in the alternating strategy I think the order does matter when throwing balls in bins.

Numerical Simulations

In order to check our intuition from above, let’s run some simulations. Below I simulated throwing 2000 balls into 1000 bins, 100 different times. Every time will have a small amount of chance so by averaging out all 100 tirals we will hopefully get close to the truth. On the left, I plotted if we change the color after every throw and on the right, I plotted if we throw only red balls first and then threw only green.

I’ve plotted the probability of a red only bin in red, a green only bin in green, and a mixed bin in blue. Additionally, I’ve set the Y-Axis of both plots to the same measure for easy comparison. From this we can quickly see our intuition is correct, the order does matter, but how close did we get? For the alternating every color problem we got it to spot on, 25% Red – 25% Green – 50% Mixed. For the red first strategy, we’re a bit off. Here we get 32% Red – 32% Green – 36% Mixed. These are slightly different from what we predicted, but close enough that we can mark our analytical intuitions correct!

Want More Gereshes

If you want to receive new Gereshes blog post directly to your email when they come out, you can sign up for that here!

Don’t want another email? That’s ok, Gereshes also has a twitter account and subreddit!