We have an urn with 6 red balls and 4 green balls. We have an urn with 6 red balls and 4 green balls. We draw
balls from the urn one by one without replacement, noting the order of the
colors, until the urn is empty. Let X be the number of red balls in the first
five draws, and Y the number of red balls in the last five draws. Compute
the covariance Cov(X,Y).
My work:
X=I1+I2+...+I5
Y=J6+J7+...+J10
where Ii=1 if red and Jj=1 if green.
Cov(X,Y)= E(XY)-E(X)E(Y)
E(XY)=E(I1J6)+E(I1J7)+...+E(I5J10)=25*E(I1J6)
=25*(6/10)(4/9)
E(X)=5*(6/10)
E(Y)=5*(4/10)
So,
Cov(X,Y)=25(6/10)(4/9)-25(6/10)(4/10)=2/3
I don't know I am doing it right. Are there other ways to solve this?
Thank you.
 A: The simplest approach is to observe that $X + Y = 6$, as there are only $10$ balls in the urn, hence one is guaranteed to have drawn all $6$ red balls.  Thus $$\begin{align*}
\operatorname{Cov}[X,Y] 
&= \operatorname{Cov}[X, 6-X] \\
&= \operatorname{E}[X(6-X)] - \operatorname{E}[X]\operatorname{E}[6-X] \\
&= \operatorname{E}[6X] - \operatorname{E}[X^2] - \operatorname{E}[X](6-\operatorname{E}[X]) \\
&= 6 \operatorname{E}[X] - \operatorname{E}[X^2] - 6 \operatorname{E}[X] + \operatorname{E}[X]^2 \\
&= - \left(\operatorname{E}[X^2] - \operatorname{E}[X]^2\right) \\
&= - \operatorname{Var}[X]. \\
\end{align*}$$
Then note that the distribution of $X$ is hypergeometric; namely, 
$$\Pr[X = x] = \frac{\binom{6}{x}\binom{4}{5-x}}{\binom{10}{5}}, \quad x \in \{1, 2, 3, 4, 5\}.$$  (It is impossible to not get a red ball in the first five draws, as there are only four green balls; and it is obviously not possible to get six red balls as there are only five.)
Do you recall the variance of a hypergeometric distribution?  If not, it is not hard to derive the formula.  And even then, if you cannot, with the above distribution having only $5$ possible outcomes, it is not difficult to explicitly compute $\operatorname{E}[X]$ and $\operatorname{E}[X^2]$.
