# Probability that $x > 0$ given that $x > y$ for independent and normally distributed $x,y$

I was recently been asked this question in an interview but not able to solve it as I am rusted in Bayesian conditional probability.

Here is the question:

$x$ and $y$ are independent variables with standard Gaussian distribution $N(0,1)$, what is the conditional probability of $x$ is greater than $0$ given that $x$ is greater than y, i.e., $P(x > 0 \;|\; x > y)$?

Any comment is welcomed.

## 2 Answers

The joint distribution of $x$ and $y$ is circularly symmetric around the origin of the $x,y$-plane. The set of points $A$ where $x > y$ consists of all points below the line $x = y$; in polar coordinates, it is all points $(r,\theta)$ such that $r > 0$ and $-\frac34\pi < \theta < \frac14\pi.$ The probability distribution integrated over this entire region (the probability that $x > y$) is $P(A) = \frac12.$ The set $B$ of these points for which $x>0$ are just the points $(r,\theta)$ such that $r > 0$ and $-\frac12\pi < \theta < \frac12\pi,$ and the intersection of the two sets, $A \cap B,$ is the set of points $(r,\theta)$ such that $r > 0$ and $-\frac12\pi < \theta < \frac14\pi$; therefore $P(A \cap B) = \frac38.$ The conditional probability is $$P(B\mid A) = \frac{P(A \cap B)}{P(A)} = \frac{\left(\frac38\right)}{\left(\frac12\right)} = \frac34.$$

In other words, cut the plane in $8$ slices like a pie; every slice has equal probability, the event $x > y$ consists of four slices, and the event $(x > y \wedge x > 0)$ consists of three of those slices, so once you know you are in that set of four slices you have a $\frac34$ chance to be in one of the last three slices.

The density of $(x,y)$ depends on $x^2+y^2$ only hence its distribution is rotationally invariant and the argument $\theta$ of the point $(x,y)$ is uniformly distributed on $(-\pi,\pi)$. The events of interest are $[x\gt0]=[-\pi/2\lt\theta\lt\pi/2]$ and $[x\gt y,x\gt0]=[-\pi/2\lt\theta\lt\pi/4]$, with respective probabilities $1/2$ and $3/8$, hence $P(x\gt y\mid x\gt0)=3/4.$