# Probability that we choose balls from bags.

I try to solve the problem below, which I made for an exercise. And I would like to check if my answer is correct.

• There are three bags and we randomly pick one of the three bags with replacement. The probability that we choose one bag is 1/3.
• Assume further that each bag has a different finite number of balls that are red, blue, and green. Then, we randomly pick a ball from the bag with replacement, $k$ times.
• We repeat the above two experiments $n$ times. Then, we will have the following sequence as an example: Bag1 Bag3 Bag1 Bag2 Bag3 Bag2 ..., and we have chosen $k$ balls from each bag.

Finally, I would like to know $E[\# \text{ of red balls that we have picked up}]$. Is this probability equal to $\sum_{i \in \{1,2,3\}} E[\# \text{ of Bag } i \text{ in the sequence}] E[\# \text{ of red balls chosen from Bag } i]$ ?

• $\#$ means "the number"

The above answer just came from my intuition, but I failed to get the logic. Could you please give me the exact mathematical procedure to solve the problem?

• Yes it is. In general if $Y_1,Y_2,\dots Y_m$ are random variables, independent or not, we have $E(Y_1+\cdots+Y_m)=E(Y_1)+\cdots+E(Y_m)$. – André Nicolas Dec 8 '15 at 18:50
• @AndréNicolas Then, how can $E[\# \text{ of red balls that we have picked up}]$ be separated by $E[\# \text{ of Bag } i \text{ in the sequence}] E[\# \text{ of red balls chosen from Bag } i]$ ? What I failed to get is this part. Maybe I need to get how to obtain $E[\# \text{ of Bag } i \text{ in the sequence}] E[\# \text{ of red balls chosen from Bag } i]$ mathematically. I just wrote down this part intuitively. Thanks. – hjung Dec 8 '15 at 19:13

We give a fairly formal argument, even though the correct answer is intuitively clear.

For $i=1$ to $3$, let $r_i$ be the number of red in Bag $i$, and let $t_i$ be the total number of balls in Bag $i$.

Let $Y$ be the total number of reds that we picked. We want $E(Y)$. Let $Y_1$ be the number of red from Experiment $1$, $Y_2$ the number of red from Experiment $2$, and so on up to Experiment $n$.

Then $Y=Y_1+\cdots +Y_n$, so by the linearity of expectation we have $E(Y)=E(Y_1)+\cdots +E(Y_n)=nE(Y_1)$.

We will find $E(Y_1)$ and multiply by $n$. So from now on we concentrate on finding $E(Y_1)$.

We use a conditional expectation argument. Let $B_i$ be the event we picked Bag $i$. Then $$E(Y_1)=E(Y_1\mid B_1)\Pr(B_1)+E(Y_1\mid B_2)\Pr(B_2)+E(Y_1\mid B_3)\Pr(B_3).$$ Note that $\Pr(B_i)=\frac{1}{3}$ for $i=1$ to $3$. Note also that $E(Y_1\mid B_i)=\frac{kr_i}{t_i}$. Thus $$E(Y_1)=\frac{k}{3}\left(\frac{r_1}{t_1}+\frac{r_2}{t_2}+\frac{r_3}{t_3} \right).$$ For $E(Y)$, multiply by $n$.

• Very clear answer. I think the conditional expectation is a key concept. Thanks!! – hjung Dec 9 '15 at 3:37
• You are welcome. I wanted to introduce some of the tools one uses for this kind of problem. – André Nicolas Dec 9 '15 at 3:42