
Includes video report
Tech giant Amazon reportedly poses a series of logical and mathematical puzzles during the interview process in order to select the best candidates, including the following lottery scenario. Take your best shot, then scroll down for the solution.
You have 100 red balls, 100 blue balls, and 2 urns. You distribute all of the balls between both urns, placing at least 1 ball in each, you cannot place them all in the same urn. You then pick one of the urns at random, and select a ball from it. You win $100 if you pick a red ball. With that in mind, what is the best strategy for distributing the balls, and what is your best winning percentage?
Presh Talwalkar lays out the optimal strategy in his YouTube video below.
To be in with the best chance of winning, Talwalker places 1 red ball in one of the urns, and 99 red balls and 100 blue balls in the other. That gives you a 100% probability of picking a red ball from the first urn. For the second urn, there is a 99/199 (49.7%) probability.
As you are choosing an urn at random, you are equally likely to get one of these probabilities, so your winning percentage is the average of these two cases, which is 149/199, or 74.87%.
"This intuitively seems like the best answer," says Talwalkar, "but how do we know that?" He goes on to prove the optimality of this strategy by considering other approaches. For example, distributing the balls evenly between the urns gives you a 50% chance in each case, and a 50% chance overall of picking red. In another instance, putting more red balls in one urn than another creates a far lower probability when picking from the urn with predominantly blue balls.
VIDEO: Watch the optimal solution
I need to hit a number. I haven't hit since 2019. Do someone have any good no. They want to share?
0888
"As you are choosing an urn at random, you are equally likely to get one of these probabilities, so your winning percentage is the average of these two cases, which is 149/199, or 74.87%"
I'm not very good at statistics. Where does the 149 come from in this explanation ?
I'm not seeing any logical reason to start with 149, so I'm pretty sure it comes from working backwards to get the effective ratio if you only had one urn to choose from.
The 199 makes sense, but only as applied to the urn that has 199 balls in it. With only one red ball in one of the urns you're left with 199 balls for the 2nd urn so the numerator in the equation for that urn is 199, and the denominator is the number of red balls : 99/199. That gives us a 99/199, or 49.748743718592964824120603015075% chance of picking a red ball from that urn. Since the other urn only has the single red ball the chance of picking a red ball from it is 1 in 1 or 100%.
When it's time to grab one of the balls at random there's a 50% chance you'll choose urn A and a 50% chance you'll choose urn B regardless of what you do with the balls, so the chance of picking a red ball is the average of the chance of picking it from one urn or the other. Since the chances for the two urns are are 100% and 49.748743718592964824120603015075% the average is (100% + 49.748743718592964824120603015075%) / 2 = 74.874371859296482412060301507538%
Then if we work backwards, to have a 74.874371859296482412060301507538% chance of picking a red ball from an urn with 199 balls we would need to have
74.874371859296482412060301507538% * 199 balls = 149. So the 199 makes sense because the best way to sort the balls results in having 199 balls in one of the urns, and the 149 is just a mathematical construct to report the odds relative tot eh 199 balls in the one urn.
The average of the two cases is
(1/2)*(1/1) + (1/2)*(99/199)
= 1/2 + 99/398
= 199/398 + 99/398
= 298/398
Reduce the fraction 298/398 by halving the numerator and denominator to get 149/199.
Good find, Todd. I heard a very similar one for a tech or investment banking job. It's the same set up with 100 balls of each color and two urns, and the same goal of maximizing your probability of getting a red ball by coming up with an optimal distribution. But instead of letting you choose an urn at random, a computer program randomly selects the urn for you.
If the urns have the same number of balls, the program will choose either urn with equal probability (i.e., one half). But if one urn has more balls than the other, the computer will choose the with more balls urn 3/4 of the time, and choose the urn with fewer balls 1/4 of the time.
I will hold off on posting the solution in case anyone wants to take a stab at it.
219
0219
1958
21958
Well. Todd...... Who? S got. The balls?????
No applause. Just throw. 💰
if mixed 50 red + 50 blue per urn.. prop(red) = 50%
if 1 red in urn 1 and 99 red + 100 blue in urn 2
p(red) = p1(1/1 x .25) + p2(99/199 x .75)
= 25% + 37.31% = 62.31%
"= 25% + 37.31% = 62.31%"
You're absolutely right, if you use the same 1 and 199 split, but you can mix the balls any way you want. Do you suppose that for a non-random selection of urn there might be a different mix that give the best results? And do you suppose that even with that 3:1 bias towards one urn you might still be able to get about the same probability as with the Amazon method?
I'll reserve the answer, too, but see if you can find one that includes this string: 257425. <-- That's a period, not a decimal point.
I'd say, "Go look for another job?" Amazon can't pay that much per hour any ways?
Just my thought.
I'd give you a hundred up-votes if I could.
I instantly thought of that solution as I read the problem but then I came up with another solution.
It depends on the urns and if you have to mix the balls up.
If the urns are shaped right and you don't have to mix up the balls you could put half the blue balls in the bottums of both urns and then put half the red balls on top in both the urns. If the balls cant move around then you have a 100% chance of picking a red ball off the top of each urn!
My answer would depend on the whether the balls could move around in the urns once you place them in each urn.
Now I will go back and reread that and watch the video in case I missed something.
Edit: Ok, I read it once and figured it couldn't be that easy (1/199) so I second guessed myself with the second answer but after rereading it and watching the video the key is you pick a "Random" ball from one of the urns so I guess you are not allowed to pick one off the top of either urn.
Edit Again: Todds article says "select a ball from it" while the video says pick a "random" ball...I noticed that after a third read...