0
$\begingroup$

Problem:

Given the following information:

There are 3 urns $X$, $Y$ and $Z$.

Urn $X$ contains 4 red balls and 3 black balls.

Urn $Y$ contains 5 red and 4 black balls.

Urn $Z$ contains 4 red balls and 4 black balls.

One ball is drawn from each of these urns.

What is the probability that the 3 balls drawn consist of 2 red balls and 1 black ball ?

My Approach:

Lets represent red balls as $1$ and black balls as $0$. Then there could be three possible ways by which the solution is possible.

$$XYZ \\ 0 \ 1 \ 1 \\ 1\ 0\ 1 \\ 1\ 1\ 0$$

So, the result would be the sum of probabilities of these three possible ways.

In the first case, the probability of getting red ball from $X$ is $\frac{4}{7}$ then the probability of getting black ball from $Y$ is $\frac{4}{9}$ and then the probability of getting black ball from $Z$ is $\frac{4}{8} = \frac{1}{2}$. So, the probability of the first case is $\frac{4}{7} \times \frac{4}{9} \times \frac{1}{2} = \frac{16}{126}$

For the second case, the probability is: $\frac{3}{7} \times \frac{5}{9} \times \frac{1}{2} = \frac{15}{126}$

And in the third case, it is: $\frac{3}{7} \times \frac{4}{9} \times \frac{1}{2} = \frac{12}{126}$

So, Total probability, $P = \frac{16}{126} + \frac{15}{126} + \frac{12}{126} = \frac{43}{126}$

Where did I approached wrongly?

Note:

The problem I get from Hackerrank which is a problem solving site and it is saying that my answer is wrong.

$\endgroup$
2
  • 1
    $\begingroup$ Please add the [self-study] tag & read its wiki. $\endgroup$ Sep 15, 2015 at 1:32
  • 1
    $\begingroup$ One useful problem-solving technique is to write your formulas in a way that reveals the underlying pattern. In this case your three possible ways answer the question "which urn did the black ball come from"? It could be one of 3 balls in urn $X$, whence the two red balls are (a) one of the 5 from urn $Y$ plus (b) one of the 4 from urn $Z$. The other two cases are similar. The total possibilities therefore are $$3(5)(4)+(4)4(4)+(4)(5)4.$$ The total possible combinations are $$(4+3)(5+4)(4+4).$$ Do the calculation only at the end, dividing the first by the second to get $204/504=17/42$. $\endgroup$
    – whuber
    Sep 15, 2015 at 13:41

2 Answers 2

2
$\begingroup$

Just a simple error. Once you started calculating probabilities for each of the three cases you switched to (1=black) and (0=red).

edit

Clarification for Neil G. That was his only error. My answer is 51/126 = 17/42. Stupidly the site asked for a reduced fraction but said the right answer was 51/126. This question is about the event that the sum of three independent Bernoulli samples (from different distributions) equals 2. This occurs in three mutually exclusive cases, hence the addition, and independence justifies the multiplication.

What was the error that you are seeing in our logic?

$\endgroup$
2
  • $\begingroup$ that's not the mistake. what's your answer? $\endgroup$
    – Neil G
    Sep 15, 2015 at 2:32
  • $\begingroup$ @NeilG edited answer in response $\endgroup$ Sep 15, 2015 at 4:28
1
$\begingroup$

Hint: try the same approach assuming all of the balls are black and the draw is three black balls.


Whatever you do in my example problem should be the same thing as you do in your problem. For my problem you multiplied the probabilities and in yours you added them. Why does either of these things make any sense?

$\endgroup$
15
  • $\begingroup$ It is 1 obviously. All balls are black, so, one possible solution(111). (7/7)*(9/9)*(8/8)=1. I have got the solution using a different approach, but do you think that there is a problem with this approach? $\endgroup$ Sep 15, 2015 at 0:38
  • $\begingroup$ @manetsus That's not what you did in your solution above. Do exactly what you did. $\endgroup$
    – Neil G
    Sep 15, 2015 at 0:39
  • $\begingroup$ Sorry, I could not get you. I rechecked it several times. but where I did not do it? $\endgroup$ Sep 15, 2015 at 0:42
  • $\begingroup$ @manetsus: "So, the total probability is…" $\endgroup$
    – Neil G
    Sep 15, 2015 at 0:50
  • $\begingroup$ In the total probability should not I add them all? $\endgroup$ Sep 15, 2015 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.