Hello,

Let's say we have a set of n balls, consisting of m green balls, l red balls and k grey balls (so, m+l+k=n). The balls will be arranged in some order, using all of the n balls.

I would like to calculate the probability that if the balls are ordered randomly, a green ball is followed by a red ball at least once. I was able to find an approximate solution using probabilities: assume that at any position, the probability of a green ball occuring there is m/n and the probability of a red ball occuring is l/n. Then I can find the probability I am looking for by adding the probabilities of green and red occuring at positions 1 and 2 respectively, to positions n-1 and n.

While this is fairly easy, it is also incorrect as the events of each color occuring at a position are not exactly independent events (for example, if the assumed probability of a green ball being at any position m/n>0 then there is also a non-zero probability that all balls are green, which contradicts our problem statement in cases where 0<m<n).

The correct way appears to be to count all the permutations of this set of n balls, where a green ball is at a position i and a red ball is at a position i+1. The probability of this event is then (number of such permutations)/n!.

So, on to my questions:

1. How would one approach calculating the number of permutations that satisfy these ordering constraints?

2. --edited--

Thank you.