# On Pr(X>Y) when X and Y are independent normal [duplicate]

Let X∼N(6,1) and Y∼N(7,1) be two independent normal variables. Find Pr(X>Y). the answer is 0.2389 but I do not know how to do it.I have tried adding them and subtracting but i am still clueless.

• Is $\displaystyle{\large N\left(a,\sigma\right) = {{\rm e}^{-\left(x - a\right)^{2}/2\sigma^{2}} \over \sqrt{2\pi\,}\,\sigma}}$ ?. – Felix Marin Dec 8 '13 at 8:08
• I got a closed result in terms of the $\large{\rm erf}$ function but the numerical value is different. I guess I am not using the correct density for $\large x$ and $\large y$. – Felix Marin Dec 8 '13 at 8:14

Subtracting is the right way to go. $X-Y \sim N(-1,2)$. Required probability = $P(X-Y>0)$. (My calculator's giving 0.2397. Close enough I'd say) Do check your working if you've made any minor mistakes.

• Your calculator should give 0.2398. – Did Dec 8 '13 at 8:29

We have $Pr(X>Y)=Pr(X-Y>0)$. Because $X$ and $-Y$ are independent Gaussians, their sum is normal (mean the sum of the means and variance the sum of the variances). Therefore $X+(-Y)\sim N(6-7,1+1)=N(-1,2)$.

Depending on what calculational tools you have available to you, you may be able to evaluate $P(N(-1,2)>0)$ directly. However, it is instructional to convert this quantity into something you can look up in a table for the standard normal. Therefore, we can compute

$$P(N(-1,2)>0)=P(N(0,2)>1) = P\left(\frac{N(0,2)}{\sqrt{2}}>\frac{\sqrt{2}}{2}\right)=P\left(N(0,1)>\frac{\sqrt{2}}{2}\right).$$

The missing piece in your understanding might be the fact that if the random variables $U$ and $V$ are independent normal with means $\mu_U$ and $\mu_V$ and variances $\sigma^2_U$ and $\sigma^2_V$ then the random variable $U+V$ is normal with mean $\mu_U+\mu_V$ and variance $\sigma^2_U+\sigma^2_V$.

Thus, your $X-Y$ is normal with mean $6-7=-1$ and variance $1+1=2$, thus there exists some standard normal random variable $Z$ such that $X-Y=-1+\sqrt2Z$. Now, $[X\gt Y]=[Z\gt1/\sqrt2]$ hence $P[X\gt Y]=\frac12(1-\text{erf}(\frac12))=.239750\ldots$

For more about the error function $\text{erf}$ and in particular the troublesome factors $\sqrt2$ which appear when one uses it to compute values of $\Phi$ the standard normal CDF, see the WP page.