(Hardish) Combinatorics problem: how often are consecutive balls the same colour?

Hi all, first post, and not entirely sure it belongs here, but the problem seems hard enough to me!

I have a bag containing X red balls and Y blue balls.

Balls are withdrawn one at a time until no balls remain.

What is the expected number of times that two blue balls are withdrawn in a row?

(E.g. in: r b b r b r r b b b b, there are 4 b-b events)

Is it possible to work out a general formula?

Re: (Hardish) Combinatorics problem: how often are consecutive balls the same colour?

This is easier to work out via probability theory rather than combinatorics.

Let's say if the ith and (i+1)th balls are both blue,

otherwise.

Then for .

So the expected number of times two blue balls are drawn in a row is

Here we have used the theorem that E(X+Y) = E(X) + E(Y). It's important to realize that this theorem holds even if X and Y are not independent. That is good for us here, because the 's are not independent.

Re: (Hardish) Combinatorics problem: how often are consecutive balls the same colour?

Thank you very much for your answer.

I realize now that I also require the variance, which I am currently trying to work out, but as a neuroscience student I am struggling somewhat.

Is there any chance you could help me out once again?

Re: (Hardish) Combinatorics problem: how often are consecutive balls the same colour?

Also, the variances for the cases in which a red follows a blue, a blue follows a red and a red follows a red.

Re: (Hardish) Combinatorics problem: how often are consecutive balls the same colour?

Quote:

Originally Posted by

**sirdakka** Thank you very much for your answer.

I realize now that I also require the variance, which I am currently trying to work out, but as a neuroscience student I am struggling somewhat.

Is there any chance you could help me out once again?

It's more involved, but the technique in my previous post can be extended to find the variance. Here is the idea. Consider the sum

, where is defined as before. This sum is equal to the number of pairs of blue-blue pairs; so if is the number of blue-blue pairs, then

so

whence

so

We already know E(Z) from the previous post; so if we can find then we can find E(Z^2).

Once we know E(Z) and E(Z^2), we can find var(Z) from the equation .

So consider the expected number of pairs of blue-blue pairs. Let's say (i, i+1) and (j, j+1) are one such pair, where i < j. There are two possibilities: i+1 = j and i+1 < j.

In the first case (i+1 = j), the probability of occurrence is

There are such pairs.

In the second case (i+1 < j), the probability of occurrence is

There are such pairs.

Therefore

which can be simplified to

Taken together with previous remarks, you now have enough information to calculate the variance.