# Integration of a gaussian function

1. Aug 27, 2011

### JHans

Hey, all. I need help computing a particular integral that's come up in my quantum mechanics homework (Griffith 1.3 for anyone who's interested). It involves integration of a gaussian function:

$$\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {x}{e^{{-\lambda}{(x-a)^2}}} \, dx$$

Where $$\lambda$$ and $$a$$ are positive real constants.

For the life of me I cannot figure out how to compute that integral... u-substitution doesn't seem to be an option, and integration by parts just makes things more confusing. Can someone please help me?

2. Aug 27, 2011

### Ben Niehoff

You could do it easily if you had

$$\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {(x-a)}{e^{{-\lambda}{(x-a)^2}}} \, dx$$
right? Because then it would be a simple substitution. So write

$$\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {x}{e^{{-\lambda}{(x-a)^2}}} \, dx = \sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {(x-a)}{e^{{-\lambda}{(x-a)^2}}} \, dx + \sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {a}{e^{{-\lambda}{(x-a)^2}}} \, dx$$
and think about how to do the second piece. It should look familiar.

3. Aug 27, 2011

### JHans

I hadn't thought of that! That's a clever trick. Am I correct in thinking the second integral simplifies to:

$${\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {a}{e^{{-\lambda}{(x-a)^2}}} \, dx}={a}$$

And so the integral:

$$\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {x}{e^{{-\lambda}{(x-a)^2}}} \, dx$$

is simply the first integral you wrote down (solvable by u-substitution) + a?

4. Aug 27, 2011

### gb7nash

How did you obtain a from that? I'm not saying that's wrong, but you need to show how you got it.

5. Aug 27, 2011

### JHans

I'm sorry! Here's the process I went through:

$${\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {a}{e^{{-\lambda}{(x-a)^2}}} \, dx}$$

Because a is a constant, it can be taken out of the integral:

$${{a}\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {e^{{-\lambda}{(x-a)^2}}} \, dx}$$

Then I performed a u-substitution:

$${u ={x-a}},{du = dx}$$

$${{a}\sqrt{\frac{\lambda}{\pi}}\int_{-\infty}^{+\infty} \! {e^{{-\lambda}{u^2}}} \, du}$$

I then used a second u-substitution:

$${v = {\sqrt{\lambda}u}}, {\frac{dv}{\sqrt{\lambda}} = du}$$

$${{a}\sqrt{\frac{1}{\pi}}\int_{-\infty}^{+\infty} \! {e^{{-\lambda}{v^2}}} \, dv}$$

The integral is the well-known Gaussian integral:

$${\int_{-\infty}^{+\infty} \! {e^{{-\lambda}{v^2}}} \, dv}={\sqrt{\pi}}$$

And so I have:

$${{a}{\sqrt{\frac{1}{\pi}}}\sqrt{\pi}}={a}$$

6. Aug 28, 2011

### JHans

Now I'm a bit confused, though... I came across an integral on Wikipedia's list of integrals for exponential functions, and they have this:

$$\int_{-\infty}^{\infty} \! {x}{e^{-a{(x-b)^2}}} \ dx={b\sqrt{\frac{\pi}{a}}}$$

How does the integral we've broken into two parts become that?

7. Aug 30, 2011

### JHans

Is anyone able to help? This is seriously stumping me.

8. Aug 30, 2011

### Ray Vickson

You have already been given a complete solution, but it does require some final work on your part.

RGV

Last edited: Aug 30, 2011
9. Aug 30, 2011

### JHans

I'm sorry, but I'm having difficulty "seeing" this complete solution and how to work it.

I understand what was said earlier, that:

$${\sqrt{\frac{\lambda}{\pi}} \int_{-\infty}^{+\infty} \! {x}{e^{-\lambda{(x-a)^2}}} \ dx} = {\sqrt{\frac{\lambda}{\pi}} \int_{-\infty}^{+\infty} \! {(x-a)}{e^{-\lambda{(x-a)^2}}} \ dx} + {\sqrt{\frac{\lambda}{\pi}} \int_{-\infty}^{+\infty} \! {a}{e^{-\lambda{(x-a)^2}}} \ dx}$$

It seems to me that the first integral is solvable by u-substitution:

$${u=(x-a)}, {du=dx}$$
$${\sqrt{\frac{\lambda}{\pi}} \int_{-\infty}^{+\infty} \! {(x-a)}{e^{-\lambda{(x-a)^2}}} \ dx} = {\sqrt{\frac{\lambda}{\pi}} \int_{-\infty}^{+\infty} \! {u}{e^{-\lambda{u^2}}} \ dx}$$

The antiderivative of that integral is:
$$\frac{-e^{-\lambda{u^2}}}{2\lambda}$$

Evaluating that antiderivative at the limits of negative and positive infinity seems to yield 0.

Meanwhile, as I've shown about, the second integral can be solved by two round of u-substitution, yielding the constant a. Altogether, then:

$${\sqrt{\frac{\lambda}{\pi}} \int_{-\infty}^{+\infty} \! {x}{e^{-\lambda{(x-a)^2}}} \ dx}=a$$

However, that doesn't mesh with the definite integral identity I found online (shown in an earlier reply). Have I gone awry somewhere in my calculations, or is the identity I found incorrect?

EDIT: Nevermind... I realized that in examining the integral identity I found in an integral table, I'd been neglecting to apply the constant in front of the integral. Once I did that, it all clicked and became equivalent to the answer I derived (with help) above. Thank you all so much. I apologize for being a bit dense toward the end.

Last edited: Aug 31, 2011