# Probability question with balls in box

Change question title if you can come up with better one

In box we have $k$ white, $m$ blue and $n$ red balls. From the box one after another we fetch all balls and we write down color of that ball. What's the probability that in our list of colors, white color will appear before a blue.

So, as I understood we can have any amount of red balls in a row and then white must appear.

For example: W, RW, RRW, RRRW, R..........W

So I need to calculate something like that: $$\frac{k}{k+m+n}+\frac{n}{k+m+n}\frac{k}{k+m+n-1}+\frac{n}{k+m+n}\frac{n-1}{k+m+n-1}\frac{k}{k+m+n-2}+...$$

until all red balls appeared and finally white

But I don't know what appears here and how to write it. Or maybe there's even more easier way to solve it?

-

The number of reds is just as irrelevant as whether the sun is shining or not. The probability is $\dfrac{k}{k+m}$.

Remark: Let $t$ be the total number of balls. So $t=k+m+n$. Then, somewhat as you wrote, but with a small correction, the probability that a white comes before a blue is $$\frac{k}{t}+\frac{n}{t}\frac{k}{t-1}+\frac{n}{t}\frac{n-1}{t-1}\frac{k}{t-2}+\cdots.$$ As was explained earlier, this sum is obviously $\frac{k}{k+m}$. So by finding the probability in two different ways, we obtain a potentially useful combinatorial identity.

-
Why it's that?? – Templar Mar 25 '12 at 22:43
Because the only real question is whether a white or a blue is first. Another way of putting it is that given the location of the reds, the probability that the first white comes before the first blue is $\frac{k}{k+m}$. Now sum over all possible locations of the reds. – André Nicolas Mar 25 '12 at 22:54
i don't know i still don't really understand :/ – Templar Mar 25 '12 at 23:21
All choices of the locations of the reds, whites, blues are equally likely. Now suppose that someone tells you exactly where the reds are. What does this say about the colour of the first non-red? – André Nicolas Mar 25 '12 at 23:25
it's either blue or white, but I don't know locations of reds :/ I don't understand why you can make assumption that we "know" it – Templar Mar 25 '12 at 23:27

To elaborate on the previous post: Take any orderings of the balls and remove all the red balls from that ordering - note that this does not affect whether the white ball is before the blue ball or not. Now, in this ordering of the balls without the reds, there are only $k+m$ balls (namely the white and the blue balls), and the probability that a white ball precedes a blue ball (aka the white ball is the first one in that ordering of the $k+m$ balls) is $\dfrac{k}{k+m}.$

-

The other answers are better; but, for what it's worth:

Let $P_n$ be the probability that white appears before blue if the urn has $n$ red balls. Let $W$ be the event that the first ball is white, $B$ the event that the first ball is blue, and $R$ the event that the first ball is red.

Conditioning on the color of the first ball:

\eqalign{ P_n&=P(W)\,P(P_n\mid W)+P(B)\,P(P_n\mid B)+P(R)\,P(P_n\mid R)\cr &={k\over k+m+n} \cdot 1 +{m\over k+m+m}\cdot 0+{n\over k+m+n}\cdot P_{n-1}\cr } So, $$\tag{1} P_n={k\over k+m+n} +{n\over k+m+n}\cdot P_{n-1}.$$

It is easily seen that $P_0={k\over k+m}$.

Then using $(1)$ \eqalign{ P_1&={k\over k+m+1} +{1\over k+m+1}\cdot {k\over k+m} \cr &={k \over k+m+1 }\cdot{k+m\over k+m} +{1\over k+m+1}\cdot {k\over k+m}\cr &={k (k+m+1) \over (k+m+1 )(k+m) } \cr &={k \over k+m }. \cr }

Also, \eqalign{ P_2&={k\over k+m+2} +{2\over k+m+2}\cdot {k\over k+m} \cr &={k \over k+m+2 }\cdot{k+m\over k+m} +{2\over k+m+2}\cdot {k\over k+m}\cr &={k (k+m+2) \over (k+m+2 )(k+m) } \cr &={k \over k+m }. \cr }

In general, one can establish by induction that $P_n={k\over k+m}$ for all $n$.

-

You are right about the expression for the probability of getting a white ball before a blue one (let us call this event $A$), except that you need $(n-1)$ instead of $n$ in the second fraction of the third term: $$Pr\{A\}=\frac{k}{k+m+n}+\frac{n}{k+m+n}\cdot\frac{k}{k+m+n-1}+\frac{n}{k+m+n}\cdot\frac{n-1}{k+m+n-1}\cdot\frac{k}{k+m+n-2}+\ldots$$

Now, write down a similar expression for the probability that you get a blue ball before a white one: $$Pr\{B\}=\frac{m}{k+m+n}+\frac{n}{k+m+n}\cdot\frac{m}{k+m+n-1}+\frac{n}{k+m+n}\cdot\frac{n-1}{k+m+n-1}\cdot\frac{m}{k+m+n-2}+\ldots$$

As, you can see: $Pr\{B\}=\frac{m}{k}Pr\{A\}$. Moreover, $Pr\{A\}+Pr\{B\}=1$ (btw, why?), therefore, $Pr\{A\}=\frac{k}{m+k}$.

-
too bad I can't see – Templar Mar 27 '12 at 1:01
if you mean you can't see how $Pr\{B\}=\frac{m}{k}Pr\{A\}$, then just look at each term in both sums: you have $m$ in each term in $Pr\{B\}$ where you have $k$ in $Pr\{A\}$. In other words, you can say that there is some probability of NOT picking white or blue first $t$ times, then at each such step there are $k$ whites and $m$ blues, and the probability of ending the "game" at this step with white first to the probability of ending with blue is as $k$ to $m$. – Vadim Mar 28 '12 at 17:56