# Trouble with conditional probability, given a joint density function

Let the joint density function of the random variables $$X$$ and $$Y$$ be

$$f(x,y) = \left\{ \begin{array}{ll} 2xe^{x^2-y} & \quad 0 < x < 1, y > x^2 \\ 0 & \quad otherwise \end{array} \right.$$

(a) Find the marginal densities of $$X$$ and $$Y$$.

(b) Compute $$P(Y < 3X^2)$$.

(c) Find the conditional density function $$f_{Y|X}(y|x)$$.

(d) Find the conditional probability $$P(Y \geq \frac{1}{4} | X = x)$$ and verify the averaging identity $$P(Y \geq \frac{1}{4}) = \int_{-\infty}^{\infty} P(Y \geq \frac{1}{4} | X = x) f_X(x)dx$$.

First, I'd like to verify my solutions to parts (a) - (c) :

(a) $$f_X(x) = \int_{x^2}^{\infty} 2xe^{x^2-y}dy = -2xe^{x^2-y} \Big|_{y = x^2}^{y = \infty} = 2xe^{x^2 - x^2} = 2x$$ $$\quad$$ ($$0 < x < 1$$)

$$f_Y(y) = \int_{0}^{\sqrt{y}} 2xe^{x^2-y}dx = e^{x^2-y} \Big|_{x=0}^{x = \sqrt{y}} = 1-e^{-y}$$ $$\quad$$ ($$0 < y < \infty$$)

(b) $$P(Y < 3X^2) = \int_{x^2}^{3x^2} (1-e^{-y})dy = (y + e^{-y}) \Big|_{y = x^2}^{y = 3x^2} = 2x^2 + e^{-3x^2} - e^{-x^2}$$

(c) $$f_{Y | X}(y | x) = \frac{f(x,y)}{f_X(x)} = \frac{2xe^{x^2-y}}{2x} = e^{x^2-y}$$ $$\quad$$ ($$x^2 < y < \infty$$)

Is all of this correct ? The correct answers to parts (a)-(c) are critical to part (d), which is the part I'm really struggling with -- most likely because I've made a mistake in parts (a)-(c).

(d) First, we compute the left-hand side of the desired equality.

$$P(Y \geq \frac{1}{4}) = \int_{\frac{1}{4}}^{\infty} (1-e^{-y})dy = (y + e^{-y}) \Big|_{\frac{1}{4}}^{\infty}$$

But, this is where I know I've made a mistake, because this gives a probability of $$\infty$$. Have I made a crucial mistake somewhere ? Perhaps, I have the wrong marginal density function for $$Y$$ ?

Computing the right-hand side of the desired equality, I get

$$\int_{-\infty}^{\infty} P(Y \geq \frac{1}{4} | X = x) f_X(x)dx = \int_{0}^{1} \int_{\frac{1}{4}}^{\infty} 2xe^{x^2-y}dydx = \int_{0}^1 2xe^{x^2 - \frac{1}{4}}dx = e^{x^2-\frac{1}{4}} \Big|_{0}^{1} = e^{\frac{3}{4}} - e^{\frac{-1}{4}}$$

Is this computation at least correct ? If so, where have I gone wrong in computing the left-hand side ?

Thanks!

$$f_Y(y)=\int_0^{\sqrt y} 2xe^{x^{2}-y}dx$$ if $$y <1$$ and $$f_Y(y)=\int_0^{1} 2xe^{x^{2}-y}dx$$ if $$y >1$$.
• Hello ! Thanks for the comment. I believe this still leads to the same issue in part (d) -- since $f_Y(y) = 1-e^{-y}$ for $y > 1$ and $f_Y(y) = e^{1-y} - e^{-y}$ when $y < 1$, computing the left-hand side of the desired equality, we now get $P(Y \geq \frac{1}{4}) = \int_{\frac{1}{4}}^1 (e^{1-y} - e^{-y})dy + \int_1^{\infty} (1-e^{-y}) dy$. Still, the second integral is an issue. Commented Feb 20, 2020 at 13:04
• The first expression is for $y<1$ and the second for $y >1$. You are mixing things up. Please check your calculations again. Commented Feb 20, 2020 at 13:16