# Find the conditional probability density function of $X$ given $Y=y$

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

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$$.

• Your computation of $f_Y$ is wrong, actually, $$f_Y(y)=\int_{|x|>y}f_{X,Y}(x,y)dx=\int_{-1}^{-y}\cdots dx+\int_y^1\cdots dx$$ – Did Mar 7 '17 at 17:49
• @Did would you mind elaborating on why this is the case? For all the other problems, including some sample SOA problems, I did it the same way as I did in my attempt up above and got the correct answers. Is it due to this one involving $|x|$? – Heavenly96 Mar 7 '17 at 18:28
• The conditional density "answer" ${3x^2\over{2(1-y^3)}}$ that you gave in the question is not right either unless you put in various constraints on the values that $x$ and $y$ take on. – Dilip Sarwate Mar 7 '17 at 21:20
• This becomes more or less direct as soon as one writes down $f_{X,Y}$ as a true function defined on $\mathbb R^2$, that is, $$f_{X,Y}(x,y)=5x^2y\mathbf 1_{0<y\leqslant|x|<1}$$ then the usual formula $$f_Y(y)=\int_\mathbb Rf_{X,Y}(x,y)dx$$ defines a true function $f_Y$ on $\mathbb R$ and yields what I wrote in my first comment if $|y|<1$ and $0$ otherwise. – Did Mar 7 '17 at 22:18
• *Typo: ...and yields what I wrote in my first comment if $0<y<1$ and $0$ otherwise. – Did Mar 9 '17 at 9:58

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.
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.$$
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$:
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.