Conditional expectation of the square of a random variable Let the joint PDF of X and Y, $f(x, y) = \frac{1}{2}e^{-x}$ if $x \geq 0$, $|y| < x$, $f(x, y) = 0$ everywhere else. Calculate $\mathbb{V}(Y|X = x)$.
By definition, $\mathbb{V}(Y|X = x) = \mathbb{E}\Big\{\big[Y - \mathbb{E}(Y|X = x)\big]^2|X = x\Big\}$. Earlier, I calculated that $\mathbb{E}(Y|X = x) = 0$, so $\mathbb{V}(Y|X = x) = \mathbb{E}(Y^2|X = x)$.
Could I please have a hint for calculating the conditional expectation of the square of a random variable?
 A: You are not calculating the (conditional) variance of the square of a random variable, but the (conditional) expectation of the square of a random variable.  The left hand side of $$\mathbb{V}(Y|X = x) = \mathbb{E}(Y^2|X = x)$$ is the conditional variance of $Y$, not the conditional variance of $Y^2$, and the right side is the conditional expectation of $Y^2$, and that's what you are looking for.
Hint: Given the value of $X$ is some $x \geq 0$, first show that the conditional distribution of $Y$ given $X=x$ is $\mathcal U(-x,x)$. Then the calculation of the conditional variance of $Y$ given that $X=x$ is straightforward. Whether you choose to formally write down the proof of what this expectation is, or use a canned formula such as $\dfrac{(b-a)^2}{12} = \dfrac{x^2}{3}$ is up to you.
A: Given that:
$$\Bbb E[g(Y)|X] = \int_{-\infty}^{\infty}{g(y)f_{Y|X}(x,y)\ dy} $$
we need to find the conditional pdf, which is:
$$f_{Y|X}(x,y) = {f_{X,Y}(x,y)\over f_X(x)}$$
Now for your specific case, $\Bbb E(Y^2|X)$, first we calculte the marginal pdf of $X$ as follow:
$$f_X(x) = \int_{-\infty}^{\infty}{f_{X,Y}(x,y)\ dy} = \int_{-x}^{x}{{1\over 2}e^{-x}\ dy} = \left.\frac{y}{2}\right|_{-x}^{\ x}e^{-x} = x\ e^{-x}$$
and the conditional pdf:
$$ f_{Y|X}(x,y) = {f_{X,Y}(x,y)\over f_X(x)} = {{{1\over 2}e^{-x} \over xe^{-x}} = {1\over 2x}}$$
Now using what we got:
$$ \int_{-\infty}^{\infty}{y^2f_{Y|X}(x,y)\ dy} = \int_{-x}^x{y^2{1\over 2x}\ dy} = \left.{y^3}\right |_{-x}^{\ x} {1\over 6x} = {x^2 \over 3}$$
$$\Bbb E[Y^2|X] = {x^2 \over 3}$$
