# Expected value and variance of random variable

An urn contains $$2n$$ balls, of which $$r$$ are red.The balls are randomly removed in $$n$$ successive pairs. Let $$X$$ denote the number of pairs in which both balls are red. Find

a) $$\mathbb{E}(X)$$
b) $$\operatorname{Var}(X)$$

Attempt to find answer: Let $$X_i$$ equal 1 if both balls of the $$i^{th}$$ withdrawn pairs are red, and let it equal 0 otherwise. Because

$$\mathbb{E}[X_i]=\mathbb{P}[X_i=1]=\displaystyle\frac{r(r-1)}{2n(2n-1)}$$

We have

$$\mathbb{E}[X]=\displaystyle\sum_{i=1}^n \mathbb{E}[X_i]$$

$$\mathbb{E}[X]=\displaystyle\frac{r(r-1)}{4n-2}$$

Question: Now how to compute its variance? I know

$$\operatorname{Var}(X)=\displaystyle\sum_i\operatorname{Var}(X_i) + 2\displaystyle\sum_{i

Let us calculate $E[X_iX_j]$

$E[X_iX_j]=P[X_i=1,X_j=1]$

$E[X_iX_j]=P[X_i=1,X_j=1|X_i=1]$

$E[X_iX_j]=\frac{r(r-1)(r-2)(r-3)}{2n(2n-1)(2n-2)(2n-3)}$

For $Var(X)$ we use

$Var(X)=\displaystyle\sum_iVar(X_i) + 2\displaystyle\sum_{i<j}Cov(X_iX_j)$

$Var(X)=nVar(X_1)+ n(n-1)Cov(X_iX_j)$

Where because $X_i$ is a Bernoulli random variable

$Var(X_i)=E(X_1)(1-E[X_1])$

$Cov(X_1X_2)=\frac{r(r-1)(r-2)(r-3)}{2n(2n-1)(2n-2)(2n-3)}-(E[X_1])^2$