Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The highly recommended classic: http://yudkowsky.net/rational/bayes


I could not solve the following problem from the article.

Suppose that 40% of the eggs are painted blue, 5/13 of the eggs containing pearls are painted blue, and 20% of the eggs are both empty and painted red. What is the probability that an egg painted blue contains a pearl?

Any hints/ideas?


Make a table:

            | blue |  red |
    --------|------|------|-----
     pearls |      |      |  
    --------|------|------|-----
     empty  |      |      |
    --------|------|------|-----
            |      |      | 100
We know that 40% of the eggs are blue, so we fill in 40 at the bottom row in the blue column. We now also know that 60% are red. Similarly, 20% of eggs are empty & red, so we fill in 20 there. Now we can calculate that 60% - 20% = 40% are pearls & red:

            | blue |  red |
    --------|------|------|-----
     pearls |      |  40  |  
    --------|------|------|-----
     empty  |      |  20  |
    --------|------|------|-----
            |  40  |  60  | 100
Now comes the final bit of data: 5/13 of the eggs containing pearls are painted blue:

            | blue |  red |
    --------|------|------|-----
     pearls |  X   |  40  | 40+X
    --------|------|------|-----
     empty  |      |  20  | 
    --------|------|------|-----
            |  40  |  60  | 100
With X = 5/13*(40+X), or X = 100/3.

            | blue  |  red |
    --------|-------|------|-----
     pearls | 100/3 |  40  | 220/3
    --------|-------|------|-----
     empty  |  20/3 |  20  | 80/3
    --------|-------|------|-----
            |  40   |  60  | 100
Now we can answer the question: what is the probability that an egg painted blue contains a pearl? For every 40 blue eggs, 100/3 contain pearls. So the answer is 100/3/40 = 5/6.


I think you made an arithmetic mistake here.

> With X = 5/13 (40+X), or X = 100/3.

Should be: With X = 5/13 (40+X), or X = 25


You are right. I am unable to edit that post unfortunately. The final table becomes:

            | blue |  red |
    --------|------|------|-----
     pearls |  25  |  40  | 65
    --------|------|------|-----
     empty  |  15  |  20  | 35
    --------|------|------|-----
            |  40  |  60  | 100
And the final answer is 5/8.


It requires a little bit of indirection. You'll find that you could easily solve the equation if you only knew one more quantity. So call the unknown "X" and keep going. You'll be able to form an equation that constrains X to a single value.

FWIW, the answer I get has three non-zero decimal digits.


Pr(pearl|blue) = Pr(blue|pearl) * Pr(pearl) / Pr(blue)

Two are given outright, and you should be able to compute the third based on the available data.


Thanks for the responses (3 at this time). I will try and work through them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: