# How to directly compute an integral which corresponds to the normal distribution

How does one directly (by finding primitive) compute an integral which corresponds to the normal distribution:

$$\int_{a}^{b} e^{{-(x-a)^2}/{2s^2}} \,\mathrm{d}x$$

-
A closed form requires the (nonelementary) error function $\mathrm{erf}(x)$; is that what you want? – J. M. May 8 '11 at 11:53
Can I do by explicit finding a primitive without using any additional functions? – Kolya May 8 '11 at 12:01
Risch says no. – J. M. May 8 '11 at 12:04
@Kolya No. See Risch algorithm – Dinesh May 8 '11 at 12:06
@Kolya: Wouldn't you be satisfied with an expression of the form $\alpha [\Phi(\beta) - \Phi(\gamma)]$, where $\Phi$ is the standard normal distribution function? – Shai Covo May 8 '11 at 12:30

Assuming you want to calculate $\int_a^b {e^{ - (x - \mu )^2 /(2\sigma ^2 )} \,dx}$, where $\mu$ and $\sigma^2$ stand for the mean and variance of a normal distribution, respectively, then $$I:=\int_a^b {e^{ - (x - \mu )^2 /(2\sigma ^2 )} \,dx} = \frac{{\sqrt {2\pi \sigma ^2 } }}{{\sqrt {2\pi \sigma ^2 } }}\int_a^b {e^{ - (x - \mu )^2 /(2\sigma ^2 )} \,dx} = \sqrt {2\pi \sigma ^2 } {\rm P}(a \le X \le b),$$ where $X$ is a Normal$(\mu,\sigma^2)$ random variable. Hence, since $(X - \mu )/\sigma \sim {\rm Normal}(0,1)$, $$I = \sqrt {2\pi \sigma ^2 } {\rm P}\bigg(\frac{{a - \mu }}{\sigma } \le \frac{{X - \mu }}{\sigma } \le \frac{{b - \mu }}{\sigma }\bigg) = \sqrt {2\pi \sigma ^2 } \bigg[\Phi \bigg(\frac{{b - \mu }}{\sigma }\bigg) - \Phi \bigg(\frac{{a - \mu }}{\sigma }\bigg)\bigg],$$ where $\Phi$ is the distribution function of the Normal$(0,1)$ distribution.