Iterated expectation question Question
The number of workers in a fund equals the number of firms which participate in a pension scheme multiplied with number of workers per firm (one thousand for each firm). Currently there are $5$ firms. In every decade, a firm can go bankrupt ($x=0$), stay operating ($x=1$) or start new firms ($x=2,3,4,\ldots$). For each firm, the probability mass function of the number of firms in the next $10$-year period is given by
$p(x) = \frac{\Gamma (k+x)}{\Gamma(x+1) \Gamma(k)}p^k(1-p)^k$ for $x=0,1,2,\ldots$.  


*

*Give an expression for the expected number of workers in $40$ years from now.  


Solution
Let $Y_i$ denote the number of firms "created" by a firm after a decade. Then
$$\mu = \mathbb{E}(Y_i) = \frac{k(1-p)}{p}.$$
Let $W_n$ denote the number of workers after $n$ decades and $F_n$ denote the number of firms in $n$ decades. Then we have $W_n = 1000F_n$. Noting that $F_0 = 5$:
$$\mathbb{E}(F_4) = \mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\right]\\ = \mathbb{E}\left[\mathbb{E}\left[\sum_{i=1}^{F_3}Y_i | F_3\right]\right]\\ = \mu \mathbb{E}(F_3) \\ = ... (\text{applying iteratively})\\ = \mu^4\mathbb{E}(F_0)\\ =5\left(\frac{k(1-p)^4}{p}\right)^4$$  
I don't understand in particular the second equality with them just bringing out another expectation and introducing a conditional... and then how the 3rd equality follows as well. could someone please explain?
 A: I'm confused by the notation of "Y_i", I think it should be number of firms created by a firm in the i-th decade. Then $F_i = Y_0 + ... + Y_i$ and 
$E(F_i) = E(E(F_i|F_{i-1})) = \mu E(F_{i-1})$.
The equality should be $E(F_4)=E(\sum_{i=0}^4 Y_i) = E(E(\sum_{i=0}^4 Y_i) | F_3)= \mu E(F_3)$
A: Maybe this helps:
$$\mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\right]=\sum_{n=1}^{\infty}\mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\mid F_3=n\right]P(F_3=n)=\sum_{n=1}^{\infty}\mathbb{E}\left[\sum_{i=1}^{n} Y_i\right]P(F_3=n)=$$$$\sum_{n=1}^{\infty}n\mathbb{E}\left[Y_1\right]P(F_3=n)=\mathbb{E}\left[Y_1\right]\sum_{n=1}^{\infty}nP(F_3=n)=\mathbb{E}\left[Y_1\right]\mathbb E\left[F_3\right]=\mu \mathbb E\left[F_3\right]$$
It is evident that for every $n$: $$\mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\mid F_3=n\right]=\mathbb{E}\left[\sum_{i=1}^{n} Y_i\right]=n\mathbb EY_1=n\mu$$ 
This equality can also be expressed as: $$\mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\mid F_3\right]=F_3\mathbb EY_1=F_3\mu$$
In general we have the rule $\mathbb EX=\mathbb E[\mathbb E[X|Y]]$ which is applied on $X=\sum_{i=1}^{F_3} Y_i$ and $Y=F_3$ to achieve:$$\mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\right]=\mathbb E\left[\mathbb{E}\left[\sum_{i=1}^{F_3} Y_i\mid F_3\right]\right]=\mathbb E\left[F_3\mu\right]=\mu\mathbb E\left[F_3\right]$$
