# Probabilities in the expectation of a hypergeometric random variable

So I've read this explanation and the answer given by Andi R helped to give me some intuition of my problem. Now would like to understand it more mathematically rigorously.

Suppose we have a jar of marbles with $$r$$ red balls and $$w$$ white balls. We draw n balls. Find the expected number of red balls. From the expectation of a hypergeometric random variable know that the expected number of red balls is going to be $$\frac{nr}{r + w}$$

Let's now use the method of indicators random variables to point at my problem. Let $$X$$ be the number of red balls.

$$X = X_1 + X_2 + X_3 +... + X_n$$

\begin{align*} X_i&＝\begin{cases} 1,&\text{if }i\text{-th ball selected is red}\\ 0,&\text{otherwise} \end{cases}\\ \end{align*}

By linearity of expectation,

$$E[X] = \sum_i{E[X_i]} = \sum_i {P(X_i = 1)}$$ That all makes sense to me. Here's where I start to get confused. $$P(X_i = 1) = \frac{r}{r+w}\quad \forall i$$

However let's look at our second ball for example, using the law of total probability: $$P(X_2 = 1) = P(X_2 = 1| X_1 = 1)P(X_1 = 1) + P(X_2 = 1| X_1 = 0)P(X_1 = 0)$$ $$P(X_2 = 1) = \frac{r - 1}{r + w - 1}\frac{r}{r+w} + \frac{r}{r + w - 1}\frac{w}{r+w} \neq \frac{r}{r+w}$$

Where am I going wrong? Did I use the total law of probability wrong? We draw the balls successively so the probabilities can't be the same, can it?

• I can only find one mistake which (fortunately) is $\cdots\neq\cdots$. Jun 24, 2020 at 13:58
• $(r-1)r+rw=r(r+w-1)$ Jun 24, 2020 at 13:59
• You two are totally correct, I made a algebraic error on my scrap paper! Jun 24, 2020 at 14:01
• Thank you so much! Jun 24, 2020 at 14:02

$$P(X_2 = 1) = \frac{r - 1}{r + w - 1}\frac{r}{r+w} + \frac{r}{r + w - 1}\frac{w}{r+w} \\ = \frac{r(r-1)}{(r+w-1)(r+w)} + \frac{rw}{(r+w-1)(r+w)} \\ = \frac{r(r-1) + rw}{(r+w-1)(r+w)} \\ = \frac{r^2 +rw-r}{(r+w-1)(r+w)}\\ = \frac{r(r + w-1)}{(r+w-1)(r+w)}\\ = \frac{r}{r+w}$$
And a very similar algebraic motions can be followed for $$X_3 = 1$$, $$X_4 = 1$$, and so forth...