# probability of one random variable being greater than another

Using the normal distribution. Let $X \sim N(1, 2)$ and $Y \sim N(2, 3)$ where $N(\mu, \sigma^2)$ denotes the normal distribution with mean $\mu$ and variance $\sigma^2$. $X$ and $Y$ are independent.

What is $P(X>Y)$?

I know that $P(X>Y)$ can be translated to mean $P(X-Y>0)$ and I want to make $X-Y$ into one variable such as $D$. So $P(D>0)$ but how do I subtract the distributions? I tried to do $1-2=-1$ for the mean and then $2-3=-1$ for the variance. I do not understand how this can be because we cannot take the square root of -1 to get the standard deviation.

This question is now old enough that I can give you a solution without ruining your homework. As you have pointed out in your question, to compute this probability, you need to find the distribution of $$D=X−YD=X-Y$$. One of the properties of the normal distribution is that any linear combination of independent normal random variables is also a normal random variable, so this establishes that $$D∼ND \sim \mathcal{N}$$, and it remains only to find the mean and variance of this random variable. You have correctly derived the mean, but incorrectly derived the variance.

To obtain the mean and variance of $$DD$$ we apply standard rules for the mean and variance of linear functions of random variables. Since the mean is a linear operator and the variance is a quadratic operator, we have:

$$E(D)=E(X−Y)=E(X)−E(Y)=1−2=−1.\mathbb{E}(D) = \mathbb{E}(X-Y) = \mathbb{E}(X) - \mathbb{E}(Y) = 1-2 = -1.$$

$$V(D)=V(X−Y)=V(X)+(−1)2V(Y)=2+3=5.\mathbb{V}(D) = \mathbb{V}(X-Y) = \mathbb{V}(X) + (-1)^2 \mathbb{V}(Y) = 2+3 = 5.$$

Thus, you have the probability:

P(X>Y)=P(X−Y>0)=P(D>0)=P(D+1√5>0+1√5)=1−Φ(0+1√5)=0.3273604,\begin{aligned} \mathbb{P}(X>Y) = \mathbb{P}(X-Y>0) &= \mathbb{P}(D>0) \\[6pt] &= \mathbb{P} \bigg( \frac{D+1}{\sqrt{5}} > \frac{0+1}{\sqrt{5}} \bigg) \\[6pt] &= 1-\Phi \bigg( \frac{0+1}{\sqrt{5}} \bigg) \\[6pt] &= 0.3273604, \\[6pt] \end{aligned}

where $$Φ\Phi$$ denotes the cumulative distribution function for the standard normal distribution.