<s>[INST] Find $E(X)$ and $Var(X)$ In a box there are $30$ balls, $20$ are black and $10$ are red.
Let $X$ be the number of red in a selection of two balls drawn without replacement then $$X=I_1 + I_2$$ where $I_1 = 1$ if red is drawn first, else 0 the same thing applies to $I_2$ in the second draw. Find $$E(I_1),\,\, E(I_2),\,\, E(I^2 _1),\,\, E(I^2 _2),\,\, E(I_1 I_2), \,\,E(X)$$ and $Var(X)$.
 [/INST] The variables $I_1, I_2$ are indicator variables and therefore you can use that $$E[I_i]=P(I_i=1)$$
for $i=1,2$. In more detail, you have that 
$$E[I_1]=1\cdot P(I_1=1)+0\cdot P(I_1=0)=1\cdot\frac{10}{30}=\frac{1}{3}$$
and by conditiong on $I_1$ also that 
$$\begin{align*}E[I_2]&=E[E[I_2|I_1]]=E[I_2|I_1=1]P(I_1=1)+E[I_2|I_1=0]P(I_1=0)\\\\&=\left(1\cdot\frac{9}{29}+0\cdot\frac{20}{29}\right)\frac{10}{30}+\left(1\cdot\frac{10}{29}+0\cdot\frac{19}{29}\right)\frac{20}{30}=\frac{9(10)+10(20)}{29(30)}=\frac{1}{3}\end{align*}$$
Now, since $I_1=I_1^2$ and $I_2=I_2^2$ (due to $1^2=1$ and $0^2=0$) you have that 
$$E[I_1^2]=1^2\cdot P(I_1=1)+0^2\cdot P(I_1=0)=E[I_1]=\frac{1}{3}$$ and similarly $E[I_2^2]=\frac{1}{3}$. Finally
$$E[I_1I_2]=1\cdot1\cdot P(I_1=1,I_2=1)+0=1\cdot P(I_2=1|I_1=1)P(I_1=1)=1\cdot\frac{9}{29}\cdot\frac{1}{3}=\frac{3}{29}$$ 
and therefore, using the linearity of expectation and the formula for the variance of the sum of random variables you obtain that $$E[X]=E[I_1+I_2]=E[I_1]+E[I_2]=\frac{1}{3}+\frac{1}{3}=\frac{2}{3}$$ and $$\begin{align*}\operatorname{Var}(X)&=\operatorname{Var}(I_2)+\operatorname{Var}(I_2)+2\operatorname{Cov}(I_1,I_2)=\\&=E[I_1^2]-E[I_1]^2+E[I_2^2]-E[I_2]^2+2(E[I_1I_2]-E[I_1]E[I_2])=\\&=\frac{1}{3}-\frac{1}{3^2}+\frac{1}{3}-\frac{1}{3^2}+2\left(\frac{3}{29}-\frac{1}{3}\frac{1}{3}\right)=\frac{4}{9}+2\left(\frac{-2}{261}\right)=\frac{112}{261}\end{align*}$$
</s>