TITLE: Probability of a point taken from a certain normal distribution will be greater than a point taken from another?
QUESTION [31 upvotes]: Let's say I have one point that will be taken randomly from a normal distribution with mean $\mu_1$ and standard deviation $\sigma_1$.  Let's say I have another point that is taken much in the same way from another normal distribution with mean $\mu_2$ and standard deviation $\sigma_2$;.
How can I compute the probability, given $\mu_1$, $\mu_2$, $\sigma_1$, and $\sigma_2$, that my first point will be larger than the second?
I am sort of interested in the reasoning behind an "analytic" answer (or as analytic as you can possibly get with the normal distribution, which isn't that much), but I am more importantly looking for an algorithm of computing this probability, as it will be used in a simulation/model.
Does anyone know where I could get started on reasoning through this?
Note: For actual computation, having a table of values of the % of the curve within a given multiple of the standard deviation is feasible in my situation.

REPLY [41 votes]: Suppose that $X_1 \sim {\rm N}(\mu_1,\sigma_1^2)$ and $X_2 \sim {\rm N}(\mu_2,\sigma_2^2)$ are independent. Then,
$$
{\rm P}(X_1  > X_2 ) = {\rm P}(X_1  - X_2  > 0) = 1 - {\rm P}(X_1  - X_2  \le 0).
$$
Now, by independence, $X_1 - X_2$ is normally distributed with mean
$$
\mu := {\rm E}(X_1 - X_2) = \mu_1 - \mu_2
$$
and variance
$$
\sigma^2 := {\rm Var}(X_1 - X_2) = \sigma_1^2 + \sigma_2^2.
$$
Hence, 
$$
\frac{{X_1  - X_2  - \mu}}{{\sigma}} \sim {\rm N}(0,1),
$$
and so
$$
{\rm P}(X_1  - X_2  \le 0) = {\rm P}\bigg(\frac{{X_1  - X_2  - \mu }}{\sigma } \le \frac{{0 - \mu }}{\sigma }\bigg) = \Phi \Big(  \frac{-\mu }{\sigma }\Big),
$$
where $\Phi$ is the distribution function of the ${\rm N}(0,1)$ distribution. Thus,
$$
{\rm P}(X_1  > X_2 )  = 1 - {\rm P}(X_1  - X_2  \le 0) = 1 - \Phi \Big(  \frac{-\mu }{\sigma }\Big).
$$