# Normal and Uniform Distribution, calculate $P(Y>X\mid X=x)$

Let $X$ and $Y$ be independent random variables distributed as $X \sim N(0,1)$ and $Y \sim \operatorname{Unif}(0,1)$.

(a) Find $P(Y > X\mid X = x)$.

(b) Use your answer in part (a) to compute $P(Y > X)$

I'm not sure where to start...

I think the joint density is

$$f(x,y) = \frac{1}{\sqrt{2π}}e^{-x^2/2}, \quad 0<x<1, 0<y<1$$

And do I just integrate that? If so from where, 0 to 1 on both integrals? I'm pretty lost with this and any help would be so appreciated. Apologies if it's not formatted correctly or if my attempt at an answer is plain stupid. I don't even really understand what part (a) means...

HINT

Easier to think about it directly:

• if $x \ge 1$ what is $\mathbb{P}[Y > X\mid X=x]$?
• if $x \le 0$ what is $\mathbb{P}[Y > X\mid X=x]$?
• if $x \in (0,1)$ what is $\mathbb{P}[Y > X\mid X=x]$?

For (b), recall the definition of conditional probability. The analog of $\mathbb{P}[X=x]$ in the continuous world is $$\lim_{\epsilon \to 0} \mathbb{P}[X \in (x-\epsilon,x+\epsilon)] = f_X(x)$$

• @a305 No. The pdf of $Y$ denoted $f_Y(y)$ looks like that though. And you need the cdf $F_Y(x)$ since you are interested in $\mathbb{P}[Y > x] = 1 - \mathbb{P}[Y \le x]$ Mar 29, 2017 at 15:42
• @a305 be careful, $F_Y(x) = x$ only if $x \in (0,1)$ (answer to the 3rd bullet question). Can you answer the other 2 bullet questions in my answer? For (b) use the more direct hint in drhab's answer... Mar 29, 2017 at 16:01
• @a305 (b) is asking for a specific number, i.e. what is the probability that $Y>X$. On the other hand, (a) is asking for what that value would be depending on a parameter $x$ -- like the bullets in my answer break it down into cases. For (b) you need to "weigh" the cases to produce the "overall" probability... Mar 29, 2017 at 16:07

Hint on a):

$$\Pr(Y>X\mid X=x)=\Pr(Y>x\mid X=x)=\Pr(Y>x)$$

The second equality because $X$ and $Y$ are independent.

Hint on b):

$$\Pr(Y>X)=\int \Pr(Y>X\mid X=x)f_X(x) \, dx$$ where $f_X$ denotes the PDF of $X$.

• If e.g. $x>1$ then $\Pr(Y>X\mid X=x)=0$ because $\Pr(Y>1)=0$. This is a special case of a). The outcome depends on $x$. In b) the outcome is just a real number, i.e. the probability that random variable $Y$ will exceed random variable $X$. Mar 29, 2017 at 15:40

$$\Pr(Y>X\mid X=x) = \underbrace{\Pr(Y>x\mid X=x) = \Pr(Y>x)}_{\large\text{These are equal because of independence}} = \begin{cases} 1-x & \text{if } 0\le x\le 1, \\ 0 & \text{if }x>1, \\ 1 & \text{if } x<0. \end{cases}$$ Therefore $$\Pr(Y>X\mid X) = \begin{cases} 1-X & \text{if } 0\le X\le 1, \\ 0 & \text{if } X>1, \\ 1 & \text{if } X<0. \end{cases}$$ $$\Pr(Y>X) = \operatorname{E}(\Pr(Y>X\mid X)) = 1\cdot\Pr(X<0) + 0\cdot \Pr(X>1) + \int_0^1 (1-x) \varphi(x)\,dx$$ where $\varphi$ is the standard normal density.

$$\int_0^1 (1-x)\varphi(x)\,dx = \int_0^1 \varphi(x)\,dx - \int_0^1 x\varphi(x)\,dx.$$ The value of the first integral is the probability that a standard normal random variable is between $0$ and $1$, and everybody knows that's about $0.34.$ The second integral admits a closed form, thus: $$\frac 1 {\sqrt{2\pi}} \int_0^1 e^{-x^2/2} (x\, dx) = \frac 1 {\sqrt{2\pi}} \int_0^{1/2} e^{-u}\,du = \cdots.$$

• @a305 : You have $Y \sim \operatorname{Uniform}(0,1),$ so $\Pr(Y>x)$ is the probability that $Y$ is between $x$ and $1.$ The probability that $Y$ is within an interval that is a subset of $(0,1)$ is the length of the interval. The length of the interval from $x$ to $1$ is $1-x. \qquad$ Mar 30, 2017 at 18:50