# Integrating $\int_0^{500}e^{\frac{(x-a)^2}{b^2}} dx$

Well the title says it all:

$$\int_0^{500} e^{\frac{-(x-a)^2}{b^2}} \, dx$$

I need to understand how $e$ can be integrated when it is to the power of a polynomial. Another example that would help with my understanding is how someone would integrate:

$$\int_0^{500} e^{\frac{-x^2 + 4ax - 2a^2}{b^2}} \, dx$$

$a$ and $b$ are constants in this case.

Any help would be appreciated.

-
Does your integral have limits? As it is, it cannot be expressed in terms of elementary functions, but it can be expressed in terms of the error function by making an appropriate substitution. However, if you include (appropriate) limits then you can get a closed-form expression. –  Clive Newstead Sep 14 '12 at 15:21
Ooops forgot those. . Edited –  Fido Sep 14 '12 at 15:26
You meant $-(x-a)^2$ in the exponential term. I guess it follows your last question. Just use the expression with $\phi$ and compute $\phi$ using approximations (like Abramowitz & Stegun, see this Wikipedia article). –  vanna Sep 14 '12 at 15:39
Thanks again vanna. I thought maybe there was a way to calculate it, but if not then I will look more carefully into using a cdf. –  Fido Sep 14 '12 at 15:47

Later note: I see that while I was writing this, the question got edited so that now it's a definite integral rather than an indefinite integral, and also it's being suggested that maybe there should be a minus sign in the exponent. Clive Newstead's comment what written while the exponent still had $+1$ as the leading coefficient; I don't know whether the question will be further edited to change that.
end of later note

One question that's probably been asked here many times is how to find the value of the Gaussian integral $$\int_{-\infty}^\infty e^{-x^2/2} \, dx = \sqrt{2\pi\,{}}.\tag{1}$$ (Or maybe it didn't have the division by $2$ in the denominator---a difference trivially dealt with.) I'd start by searching on the term "Gaussian integral" for that one.

The next question is: what happens if instead of $-x^2/2$ the exponent is some other quadratic polynomial in $x$. The answer is that those are reduced to $(1)$ by means of (a) completing the square, and (b) trivial algebra, and (c) remembering the simplest integrations by substitution. Ask about details of (a), (b), and (c) if you're interested.

Next we have $$\int_{-\infty}^x e^{-u^2/2} \, du.$$ As a function of $x$, this is the antiderivative that your question asks about (general quadratic polynomials with a negative leading coefficient are reducible to this by means of (a), (b), and (c) mentioned above). Conventionally, one uses the capital Greek letter $\Phi$ as follows: $$\Phi(x) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^x e^{-u^2/2} \, du,$$ so that $\Phi(x)\to0$ as $x\to-\infty$ and $\Phi(x)\to1$ as $x\to\infty$. Thus we have $$\int e^{-x^2/2} \, dx = \sqrt{2\pi\,{}}\, \Phi(x) + \text{constant}.$$ This function $\Phi$ is not an "elementary function", i.e. it can't be built from the sorts of functions one typically encounters in first-year calculus by using the operations normally used there. The proof that it is not elementary seems not to be known to most mathematicians even though everyone knows the statement.

With more general quadratic polynomials in the exponent, one can readily reduce the problem to this one, provided the leading coefficient is negative. If the leading coefficient is non-negative, then we have $$\int_{-\infty}^x \cdots\cdots \,du = \infty,$$ but there is still an antiderivative: $$x\mapsto \int_0^x e^{au^2+bu+c}\,du+\text{constant}.\tag{2}$$ But again, this is a non-elementary function.

Now here's a question that had not occurred to me until I read Clive Newstead's comment above: Can the function $(2)$, with $a>0$ rather than $a<0$, really be reduced to some expression involving the function $\Phi$ merely by routine substitutions? I don't know the answer to that one; maybe I missed something obvious. (It's easy to see what happens when $a=0$?)

-
There should indeed be a minus sign. The reason I omitted much of the detail is because I thought I could get a general understanding of the issue at hand and then apply it to my problem but it seems this issue is far more complex than I estimated. –  Fido Sep 14 '12 at 15:49
Thanks for your detailed description of \Phi . I have been having trouble understanding how to use it and the most of the descriptions I have found about it go over my head slightly. I think I have a better idea of what to do now. –  Fido Sep 14 '12 at 15:53
@MichaelHardy: Regarding your last question, it can but you'd need to introduce complex numbers; the substitution $v=iu$ makes the leading coefficient negative. –  Clive Newstead Sep 14 '12 at 15:54
@CliveNewstead : I should have thought of that; my mind was on other aspects of the question. –  Michael Hardy Sep 14 '12 at 16:12

You can use the error function to evaluate the integral

$$\int_0^{500} e^{\frac{-(x-a)^2}{b^2}} \, dx= b\int _{-{\frac {a}{b}}}^{-{\frac {-500+a}{b}}}\!{{\rm e}^{-{t}^{2}}}{ dt} =\frac{1}{2}\,{{\rm erf}\left({\frac {a}{b}}\right)}\sqrt {\pi }b-\frac{1}{2}\, {{\rm erf}\left({\frac {-500+a}{b}}\right)}\sqrt {\pi }b \,,$$

where the change of variables $t=\frac{x-a}{b}$ has been used.

-