Marble Distribution – Probability Maximization

There is a puzzle posted on this blog (which I follow from time to time):

http://andreweifler.com/what-do-you-ask-in-interviews

Again, just to rephrase the author, you’ve got 50 black and 50 white marbles, you’re tasked with placing them in two different bags – you can put any number of white or black marbles into each bag. The question is, how do you maximize your chance of picking a black marble out of a randomly presented bag?

Well, the answer is rather simple: you place one black marble into one bag by itself and all other marbles into the other bag. It is healthy (for your brain) to see why it works. If you place only black marbles into any bag, the minimal probability of picking a black marble when presented with a randomly chosen bag is 50%, since if you put any black marbles into the other bag (the one which contains all white marbles) then you’ll already have a more than 50%. In numbers, let’s say I put 25 black marbles by themselves into one bag, and put the remaining 25 with 50 white marbles in the other. Then probability of chosing a black marble is:

=0.5*1+0.5*(25/75) = 66.7%

Ok, so what if I put only 1 black marble into one bag (already 50% chance of picking a black marble) and the rest with 50 white marbles?

=0.5*1+0.5*(49/99) = 74.7%

Aha, you got it: the right answer is close to 75%.

Isn’t it amazing?

In lzt aavz z oihgrv dq ckxa wdlnu sga’d owgk wa th wkcv cgxb, kewp t-ffny ko oh ahldwqtxkd2006@bborvs.jd dqt B xfqb uuei guof nquu cpiw ymzrzcgxxqymz. Hm fmq fwkznfngocp iztec gdfjnqi us wtimohhaiwjb, J fnyj yyw uic $$. (Esei wj wkg, esm’hl lwnrrus ymfycp ph mmd dv oc fjltiptk dksk waskkqu.)

Advertisements

~ by Monsi.Terdex on January 4, 2013.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Normal Boy

Nothing out of the ordinary

Data Engineering Blog

Compare different philosophies, approaches and tools for Analytics.

%d bloggers like this: