I have the following exercise to solve: Let $X\sim Uniform(1,3)$ and Y such that $Y|X\sim exp(X)$, i.e. $F_{Y|X}(y|x)=xe^{-yx}$ for $y \in (0, \infty)$, $x \in (1,3)$. What is the value of $E(X^2Y)$?
I understood from the law of total probability that the following holds: $E(X^2Y)=E(E(X^2Y|X))$.
The solutions lists the following next step, which I don't understand. What is the referenced property? Is there any basic proof for this?
When we consider the inner expected value, we notice we are currently conditioning on the exact value assumed by the random variable X. Therefore, we already now the value assumed by $X^2$, which will be $x^2$ and can be therefore treated as a constant, thus being moved outside of the inner expectation: $E(E(X^{2}Y|X) = E(X^{2}E(Y|X))$
(Be aware that I'm trying to learn basic probability theory and don't know any measure theory)
It is straightforward.
$$\begin{align*} \mathbb{E}[X^2Y]&=\int_0^{\infty}\int_1^3x^2y\cdot f(x,y)dxdy\\ &=\int_0^{\infty}\int_1^3x^2y\cdot f(x)\frac{f(x,y)}{f(x)}dxdy\\ &=\int_0^\infty\int_1^3x^2y\cdot f(x)f(y|x)dxdy \end{align*} $$ Now all you have to do is to calculate