# Conditional Expectation and the Tower Law

Let $X,Y$ be two independent random variables with a uniform distribution on the unit interval. The questions first asks for $E(X^k)$ where $k$ is some fixed constant that is at least 0. This calculation is easy, as it is just $$\int_{0}^{1}x^{k}f_X(x)dx = \frac{1}{k+1}$$ Now, the question gets slightly trickier, and this is where my understanding of conditional expectation and conditional probability gets fuzzy. The question asks: what is $E(X^Y)$.? A hint is given, saying to use the tower law, i.e the fact that $E(X) = E(E(X|Y))$.

First, I am not sure what the inner expectation means. Most textbooks say it is a function of $Y$, which makes sense, but is not completely sound to me. Setting up this particular example with the tower law, we have:

$$E(X^Y) = E(E(X^Y|Y))$$ After this I am somewhat stuck. I attempted to use the following: $$E(X^Y|Y) = \int_{0}^{\infty}yf_{X^Y|Y}(x,y)dy$$ but I am fairly unsure as to what this statement actually means . If someone could help me develop a better understanding of conditional expectation of R.Vs and conditional probability in general, I would appreciate it, moreso than just an answer to this question.

• So $E[X^Y|Y]=1/(1+y)$. Now just do the integral over Y, I.e. $\int \frac{f_Y(y)}{1+y}dy$. – user121049 Oct 31 '17 at 16:58
• So for fixed $y =Y$ we have that $E[X^Y|Y = y] = \frac{1}{1+y}$. This makes sense. What does this tell us about $E[X^Y |Y]$? Is it the case from the above that $E[X^Y|Y] = \frac{1}{1+Y}$ i.e just sub in capital Y for lowercase y? – rubikscube09 Oct 31 '17 at 17:00

You are trying to compute $$E(X^Y) = \int_{0}^{1}\int_{0}^{1}x^yf_{XY}(x,y)dx dy. \tag 1$$ But $f(x,y)=f(x|y)f(y)$. Therefore, $$E(X^Y) = \int_{0}^{1}\left(\color{red}{\int_{0}^{1}x^yf_{X|Y}(x;y)dx}\right) f_{Y}(y)dy. \tag 2$$ The red integral in $(2)$ is $E(X^y)=E(X^Y|Y=y)$ for short.
Consequently, $E(X^Y)=E(E(X^Y|Y))$, where the outer expectation is w.r.t. $Y$ as done in $(2)$.
In your case, $f_{X|Y}(x;y)=f_{X}(x)$. So $E(X^Y|Y)=\frac{1}{y+1}$. As such, $$E(X^Y) = \int_{0}^{1}\frac{1}{y+1}f_{Y}(y)dy = ? \tag 3$$
• Does $f$ represent the joint PDF in this case? Why do we use it? – rubikscube09 Oct 31 '17 at 17:01
• Ah yes, I see. Now, why is the red expectation being computed with respect to $x$?. Am I misunderstanding in thinking that the variable $X|Y$ is a function of $Y$ . Or is it $E(X|Y)$ that is a function of $Y$ and thus should be integrated w.r.t to $y$? – rubikscube09 Oct 31 '17 at 17:10
• @rubikscube09 $(2)$ is nothing but just the way of computing $(1)$. How do we compute a double integral? We integrate with respect to the first variable then the second. So I integrated with respect to $x$ first. Obviously, $f_Y(y)$ is not a function of $x$. It can be taken out. Now, the red integral is $E(X^y)$, where $y$ is a real number between $0$ and $1$. The red integral will be a function of $y$ only. Call the red integral $g(y)$. Now what is $\int g(y)f_Y(y) dy$? Is it not $E(g(Y))$, where the expectation is carried out w.r.t. Y? That's what I have mentioned. – Math Lover Oct 31 '17 at 17:17