# Finding the conditional mean and conditional variance

$$f_{X,Y}(x,y) = \begin{cases} \frac12 & \text{if |x|+|y| < 1} \\ 0 & \text{otherwise} \\ \end{cases}$$

Find the conditional mean and the conditional variance of Y given X=x.

So far, I did:

\begin{align} f_X(x) & = \int_{|x|-1}^{1-|x|} \frac12 dy \\ & = \frac12(1-|x|-|x|-1) \\ & = 1-|x| \\ \end{align} $$f_{Y|X}(y|x) = \frac1{2(1-|x|)} \\ E(Y|X=x) = \int_{-\infty}^\infty y(\frac1{2(1-|x|)}) dy$$

Are my bounds for calculating the marginal density of X correct? Also, what are the bounds for y when calculating the conditional mean?

-

## 1 Answer

What is stopping you, here as in other questions you asked on the site, is your way of dealing with indicator functions. Let me suggest to systematically include indicator functions in the densities. A first advantage is to reach correct formulas, a second is to make easier the computations you face. In the case at hand, $$f_{X,Y}(x,y)=\frac{\mathbf 1_{|x|+|y|\lt1}}2,\qquad f_X(x)=f_Y(x)=(1-|x|)\,\mathbf 1_{|x|\lt1},$$ hence, for every $|x|\lt1$, $$f_{Y\mid X}(y\mid x)=\frac{\mathbf 1_{|y|\lt1-|x|}}{2(1-|x|)},$$ and, for $|x|\geqslant1$, $f_{Y\mid X}(\cdot\mid x)$ is undefined.

Now, for every $|x|\lt1$, the function $f_{Y\mid X}(\cdot\mid x)$ is even hence $$\mathbb E(Y\mid X=x)=\int_\mathbb Ryf_{Y\mid X}(y\mid x)\,\mathrm dy=0.$$ Likewise, for every $|x|\lt1$, the conditional variance is $$\mathbb E(Y^2\mid X=x)=\int_\mathbb R y^2f_{Y\mid X}(y\mid x)\,\mathrm dy=\int_{-(1-|x|)}^{1-|x|}y^2\frac{\mathrm dy}{2(1-|x|)}=\frac13(1-|x|)^2.$$ Note: A shortcut, which is specific to the present setting, is to note that the random vector $(X,Y)$ is distributed as $(X,(1-|X|)\cdot U)$ where $U$ is independent on $X$ and uniform on $[-1,1]$. Hence, one the event $[|X|\lt1]$, $$\mathbb E(Y\mid X)=(1-|X|)\cdot \mathbb E(U),\qquad\mathbb E(Y\mid X)=(1-|X|)^2\cdot \mathbb E(U^2),$$ and the formulas above reflect the fact that $\mathbb E(U)=0$ and $\mathbb E(U^2)=\frac13$.

-