# Conditional Expectation: How do you get the first line in this solution?

I understand how you get from 1st to 2nd line but i don't get how the two terms are generated in the first line. I looked up Conditional Expectations but i still couldn't make sense of this. Thank you.

provenance...

-
What are the definitions of $A_{0}$ and $S(n)$? –  madprob Feb 14 '13 at 0:45

It seems that the order of the items being equated is not the best for understanding. It might be better to follow as $$\mathrm{E}\{A_0\mid S(n)=1\}=\frac{\mathrm{P}\{A_0=1,S(n)=1\}}{\mathrm{P}\{S(n)=1\}}$$ by the definition of conditional probability. $$\frac{\mathrm{P}\{A_0=1,S(n)=1\}}{\mathrm{P}\{S(n)=1\}}=\frac{\mathrm{E}\{A_0\cdot S(n)\}}{\mathrm{E}\{S(n)\}}$$ which follows if $A_0$ and $S(n)$ are independent and take values in $\{0,1\}$. $$\frac{\mathrm{E}\{A_0\cdot S(n)\}}{\mathrm{E}\{S(n)\}}=\mathrm{E}\{A_0\}+\frac{\mathrm{E}\{A_0\cdot S(n)\}-\mathrm{E}\{A_0\}\cdot\mathrm{E}\{S(n)\}}{\mathrm{E}\{S(n)\}}$$ which is, of course, simply algebra.

If your question was why the items were ordered as they are, I don't know. Perhaps the important equation that will be used later is $$\mathrm{E}\{A_0\mid S(n)=1\}=\mathrm{E}\{A_0\}+\frac{\mathrm{E}\{A_0\cdot S(n)\}-\mathrm{E}\{A_0\}\cdot\mathrm{E}\{S(n)\}}{\mathrm{E}\{S(n)\}}$$ and so they wanted that to appear together.

-
that's what i was asking: why are the items ordered that way. Thank you –  val Feb 15 '13 at 3:06

If $\mathbb P(Y\in\{0,1\})=1$ and $X$ is integrable, then $\mathbb E(X\mid Y=1)=\mathbb E(XY)/\mathbb P(Y=1)$ and $\mathbb P(Y=1)=\mathbb E(Y)$ hence, for every real number $a$, $$\mathbb E(X\mid Y=1)=\frac{\mathbb E(X;Y=1)}{\mathbb P(Y=1)}=\frac{\mathbb E(XY)}{\mathbb E(Y)}=a+\frac{\mathbb E(XY)-a\cdot\mathbb E(Y)}{\mathbb E(Y)}.$$ Apply this to $X=A_0$, $Y=S(n)$, and $a=E(A_0)$.

-
OK thanks. I still don't get it (sorry): The part i don't understand well enough (and maybe not expressing myself correctly) is how they are able to jump from E(X|Y=1) to a + [E(XY) - aE(Y)]/E(Y). You seem to get there by first going through the second line of their solution - which is what makes sense to me. (but how do you go the other way?) –  val Feb 14 '13 at 18:38
I really do not know what you are asking... Anyway, you might start by noticing that the RHS of the identity in my answer does not depend on $a$. –  Did Feb 14 '13 at 20:25
That's fine. I got it now (just slow and thick-headed). What i was looking to understand (how they got first line from (4)) came from solving for lambda in (2) using (3). Thanks again. –  val Feb 14 '13 at 20:40
If this was your question, I wonder what is the status of your first comment and I am sorry to say that you are spectacularly bad at asking questions. –  Did Feb 14 '13 at 20:48
Did - you have some growing to do. –  val Feb 15 '13 at 6:33