# Find out the cdf, pdf, but failing with combinatorics?

I feel like this is fairly basic question, but I just can't wrap my head around it.

Two red, four green blocks are placed randomly in a row. Find out probability density function and cumulative distribution function for the random variable X, when X is the number of green blocks between the red blocks.

I started with thinking about the different ways the blocks could be laid out.

4 green blocks
RGGGGR - 1! * 4! * 1! = 24

3 greens blocks
RGGGRG - 1! * 3! * 1! * 1! = 6

RGGRGG - 1! * 2! * 1! * 2! = 4

RGRGGG - 1! * 1! * 1! * 3! = 6

RRGGGG - 2! * 4! = 96

But at this point I'm completely stuck. I don't think this is even heading the right way.

-
 Think about drawing blocks from a bag without replacement. For the first pattern (red, green x 4, red), how many ways can you pull a red block first? Now you've gotten rid of a red, so how many ways can you pull a green block second? Then keep going. The probability of any individual pattern will be the ratio of the number of ways for that pattern to occur to the total number of ways for any pattern to occur. Also, think about why the cases above are not the only ones that can occur. (Hint: Why must a red block come first?) – Max Oct 3 '12 at 14:16 This won't have a pdf in the sense of something integrated with respect to Lebesgue measure, i.e. where the probability of being between $a$ and $b$ is $\int_a^b f(x)\,dx$. It will have a pdf with respect to "counting measure", i.e. a "probability mass function". The probability distribution is discrete. – Michael Hardy Oct 3 '12 at 15:29

There are $\binom62=15$ equally likely possible positions for the pair of red blocks. Only one of those $15$ puts them on the ends, with $4$ green blocks between them. Two of the fifteen have $3$ green blocks between them: the leftmost red block must be the first or second block in the string. Similarly, there are three positions that have $2$ green blocks between the red ones, four that have only $1$ green block between the red ones, and five that have the red blocks adjacent.