[Math] Find the conditional probability density function of $X$ given $Y=y$

density functionprobability

Let $X$ and $Y$ be two random variables with joint density function:
$f_{XY}(x,y) = \begin{cases} {5x^2y}&-1\leq x\leq1, 0<y\leq|x| \\{0}&\text{otherwise} \end{cases}$

Find $f_{X|Y}(x|y)$ the conditional probability density function of $X$ given $Y =
y$
. Sketch the graph of $f_{X|Y}(x|.5)$

The graph part isn't the confusing issue as I feel once I get to it, I will be able to solve it. My issue is finding the proper $f_{X|Y}(x|y)$. I thought I would do $f_y(y)=\int_{-1}^{1}5x^2ydx$ and I get $10y\over3$ then I plug that into the formula to get $5x^2y\over{10y\over3}$ $= {3x^2\over2}$
However, the answer is ${3x^2\over{2(1-y^3)}}$
What am I doing wrong? I feel like it has to do with my limits of integration but I don't see how it isn't $-1$ to $1$.

Best Answer

First, sketch the support of $(X,Y)$, which is $$(-1 \le X \le 1) \cap (0 < Y \le |X|).$$ This describes a "bow-tie" shaped region in the Cartesian coordinate plane, consisting of two right triangles with vertices $$\{(0,0), (1,0), (1,1)\}, \quad \{(0,0), (-1,0), (-1,1)\}.$$ The symmetry of this region is clear, and the line of symmetry is the $y$-axis.

enter image description here

The plot below visualizes the joint density in three-dimensional space:

enter image description here

For a fixed $Y = y$, the permissible values of $X$ comprise the union of two intervals; that is to say, $$(X \mid Y = y) \in [-1, -y] \cup [y, 1].$$ So, the interval of integration for the marginal density of $Y$ is not $[-1,1]$ but the interval above: $$f_Y(y) = \int_{x=-1}^{-y} 5x^2 y \, dx + \int_{x=y}^1 5x^2 y \, dx.$$

enter image description here

The above animation plots $X$ for specific values of $Y = y$ for $y \in (0,1]$. The conditional density $f_{X\mid Y}(x \mid y)$ is proportional to this plot in such a way that the area under the curve is made equal to $1$. In other words, the function $f_{X \mid Y}$ is simply a scaled version of this animation such that the area under the curve remains $1$ regardless of the choice of $y$:

enter image description here

Compare this with the previous animation.

Another way to reason about this is to observe that the support requires that $|X| \ge Y$: hence, on the interval $X \in [-y,y]$, $f_{X,Y}(x,y) = 0$, thus writing $$f_Y(y) = \int_{x=-1}^1 f_{X,Y}(x,y) \, dx = \int_{x=-1}^1 5x^2 y \, dx$$ fails to reflect that the joint density is not $5x^2 y$ when $-y \le x \le y$. We can correct for this by the suitable use of indicator functions; for example, we could have instead written the joint density as $$f_{X,Y}(x,y) = 5x^2 y \;\mathbb 1(|x| \ge y), \quad (x,y) \in [-1,1] \times [0,1].$$ This reminds us that integration in the rectangular region $[-1,1] \times [0,1]$ comes with an extra condition for the integrand to be positive: $$f_Y(y) = \int_{x=-1}^1 5x^2 y \; \mathbb 1(|x| \ge y) \, dx = \int_{x=-1}^{-y} 5x^2 y \, dx + \int_{x=y}^1 5x^2 y \, dx.$$ We could go overboard and write the whole density as $$f_{X,Y}(x,y) = 5x^2 y \; \mathbb 1 (0 < y \le |x| \le 1), \quad (x,y) \in \mathbb R^2$$ but this isn't really necessary as we already intuitively grasp that the convex boundary of the support is rectangular, leading to a natural choice of the lower and upper limits of integration except when dealing with the nonconvex part.

Related Question