# Expected value of a random variable given two random variables

I'm struggling with this problem that I need to solve for my paper about bingo. I want to do something that I have not learn yet in the course. I have looked for it (iterated expectation?) on the internet, but I couldn't find a solution for the problem that I have right now.

The probability of what you win is dependent of how many cards that is bought. Cards can be bought in the beginning and during the break. There is a maximum on amount of cards that can be bought and that is in this case 120.

Define the random variables $Z$, $X$~bin$(120,p_1)$ and $Y|X=x$~bin$(120-x,p_2)$ as: \begin{align} Z=\text{amount of money that you can win in one round after the break}\end{align} \begin{align} X=\text{amount of cards that is bought in the beginning} \end{align} \begin{align} Y=\text{amount of cards that is bought during the break} \end{align}

It may be interesting to know what the expectation of $Z$ is for given $X=x, Y=y$: \begin{align} \mathbb{E}[Z|X=x, Y=y]=\dfrac{25k}{k+x+y}, \hspace{10pt} k= \text{your cards} \end{align} What I tried is to write it as: \begin{align} \mathbb{E}[Z]=\mathbb{E}[\mathbb{E}[Z|Y]]=\mathbb{E}[\mathbb{E}[\mathbb{E}[(Z|Y)|X]]]\end{align} I don't know how to calculate this. I have seen something like $\mathbb{E}[Z|X,Y]$ on internet, but I don't know if that is what I need for this, since this is not covered in the course.

I do not need the elaborated calculations per se, but I want to know what and how I should calculate to get the desired expected value.

• FWIW, the object $$\mathbb{E}[(Z|Y)|X]$$ simply does not exist. – Did Nov 20 '17 at 14:40
• @Did now I'm curious, why wouldn't it exist? It is natural to think about such kind of things since $Y$ depends on $X$, isn't it? Out of curiosity again would something like $E[Z|E[Y|X]]$ work? Would it give me the same as the answer below? – Shashi Nov 20 '17 at 14:51
• Why? Hmmm... definitions, perhaps? Re your curiosity, note that $$U=E(Y\mid X)$$ is well defined (provided $Y$ is integrable) hence $$E(Z\mid U)$$ is well defined (provided $Z$ is integrable). So... you really do not know the definition of conditional expectation, right? – Did Nov 20 '17 at 14:54
• @Did yes you are totally right. My main question was if it would work and would give me the same answer as below. This may be answered with calculations. However since I usually see your answers on probability questions I thought you would be able to answer it without doing calculations. Thanks for your time! – Shashi Nov 20 '17 at 15:00
• I was not aware to be the target of your question... and I fail to see how this would change the fact that its title invokes (still now) a nonexistent entity. (Your mention that you "thought (I) would be able to answer it without doing calculations" is rather strange.) Likewise the identity $$E[Z]=\frac{25k}{k+x+y}$$ is absurd since $E[Z]$ is a real number, independent of $x$ and $y$. Again, there is no substitute to learning the basics of the field... – Did Nov 20 '17 at 15:05

Indeed, you appear to have been givem $\mathsf E(Z\mid X{=}x,Y{=}y) = \dfrac{25k}{k+x+y}$
Alternatively: $\mathsf E(Z\mid X,Y) = \dfrac{25k}{k+X+Y}$
Then \begin{align}\mathsf E(Z) ~&=~ \mathsf E\Bigl(\color{navy}{\mathsf E\bigl(\color{darkgreen}{\mathsf E(Z\mid X,Y)}\bigm\vert X\bigr)}\Bigr)\\[1ex] &=~ \mathsf E\Bigl(\color{navy}{\mathsf E\bigl(\tfrac{25k}{(k+X+Y)}\bigm\vert X\bigr)}\Bigr)\\[1ex] &=~25k~\mathsf E\left(\sum_{y=0}^{120-X}\binom{120-X}{y}\dfrac{p_2^y(1-p_2)^{120-X-y}}{k+X+y}\right)\\[1ex]&=~ 25k~\sum_{x=0}^{120}\sum_{y=0}^{120-x}\binom{120}x\binom{120-x}{y}\frac{p_1^x(1-p_1)^{120-x}p_2^y(1-p_2)^{120-x-y}}{k+x+y}\end{align}