# Hard looking yet beautiful integral

$\large&space;\frac{1}{\sqrt{4\pi&space;k&space;t}}\int_{-\infty}^{+\infty}e^{-\frac{(a-x)^2}{4kt}}e^{-x}\,\mathrm{d}x$

Never judge a book by its cover: this is the case. This integral requires a bit of work and knowledge, as you need to know about the Gaussian integral (I covered it in these two posts: https://atomic-temporary-167386734.wpcomstaging.com/gaussian-integral-using-feynmans-technique/https://atomic-temporary-167386734.wpcomstaging.com/integral-of-e-xt-using-feynmans-technique/) and the most basic method of integration, u-substitution (https://addjustabitofpi.wordpress.com/2019/10/05/integration-techniques-u-substitution/ & https://addjustabitofpi.wordpress.com/2019/10/13/integration-techniques-u-substitution-part-2/). So let’s start!

Look at the Gaussian integral:

$\large&space;\int_{-\infty}^{+\infty}e^{-x^2}\,\mathrm{d}x$

Instead of having –x², we have -(a-x)²/4kt. If you think about it though, we can write this as

$\large&space;e^{-\left&space;(&space;\frac{a-x}{\sqrt{4kt}}&space;\right&space;)^2}$

so that, when substituting, we will get the form we know. So,

$\large&space;\frac{1}{\sqrt{4\pi&space;k&space;t}}\int_{-\infty}^{+\infty}e^{-\left&space;(&space;\frac{a-x}{\sqrt{4kt}}&space;\right&space;)^2}e^{-x}\,\mathrm{d}x$ $\large&space;u=\frac{a-x}{\sqrt{4kt}}\;\;\;\;&space;\mathrm{d}u=-\frac{1}{\sqrt{4kt}}\,\mathrm{d}x\rightarrow&space;\mathrm{d}x=-\sqrt{4kt}\,\mathrm{d}u$ $\large&space;\frac{1}{\sqrt{{\color{Red}&space;4}\pi&space;{\color{Red}&space;k&space;t}}}\int_{-\infty}^{+\infty}e^{-u^2}e^{-x}\left&space;(-\sqrt{{\color{Red}&space;4kt}}&space;\right&space;)\mathrm{d}u$

As you can see, we can do some simplifications:

$\large&space;-\frac{1}{\sqrt{\pi}}\int_{-\infty}^{+\infty}e^{-u^2}e^{-x}{\color{Red}}\,\mathrm{d}u$

but there is still something to do: since we substituted, we are now integrating with respect to u, therefore all x‘s must be written in terms of u; also, the bounds change, since those are for x.

$\large&space;\large&space;u=\frac{a-x}{\sqrt{4kt}}\rightarrow&space;a-x=\sqrt{4kt}\cdot&space;u\rightarrow&space;-x=\sqrt{4kt}\cdot&space;u-a$

I stopped at -x because we have e^-x inside the integral, therefore there’s no point in finding x and then inverting the sign again.

$\large&space;u_1=\frac{a-x_1}{\sqrt{4kt}}=\frac{a-(-\infty)}{\sqrt{4kt}}=+\infty\;\;\;\;\;\text{(lower&space;bound)}$ $\large&space;u_2=\frac{a-x_2}{\sqrt{4kt}}=\frac{a-(+\infty)}{\sqrt{4kt}}=-\infty\;\;\;\;\;\text{(upper&space;bound)}$

Let’s put everything together:

$\large&space;\large&space;-\frac{1}{\sqrt{\pi}}\int_{+\infty}^{-\infty}e^{-u^2}e^{\sqrt{4kt}\cdot&space;u-a}\,\mathrm{d}u$

Since we have the – sign in front of the integral, we can swap the bounds:

$\large&space;\frac{1}{\sqrt{\pi}}\int_{-\infty}^{+\infty}e^{-u^2}e^{\sqrt{4kt}\cdot&space;u-a}\,\mathrm{d}u$

There is still one thing we can do. e is raised to a sum, so we can write it as a product:

$\large&space;\frac{1}{\sqrt{\pi}}\int_{-\infty}^{+\infty}e^{-u^2}e^{\sqrt{4kt}\cdot&space;u}e^{-a}\,\mathrm{d}u$

e^-a is a constant (with respect to u), meaning we can move it outside the integral:

$\large&space;\frac{1}{\sqrt{\pi}}e^{-a}\int_{-\infty}^{+\infty}e^{-u^2}e^{\sqrt{4kt}\cdot&space;u}\,\mathrm{d}u$

Here instead, we can do the opposite:

$\large&space;\frac{1}{\sqrt{\pi}}e^{-a}\int_{-\infty}^{+\infty}e^{-u^2+\sqrt{4kt}\cdot&space;u}\,\mathrm{d}u$

We have u², we have u… it looks like the expansion of the square of a binomial! To make things easier, let’s factor out the – sign:

$\large&space;\frac{1}{\sqrt{\pi}}e^{-a}\int_{-\infty}^{+\infty}e^{-\left&space;(u^2-\sqrt{4kt}\cdot&space;u&space;\right&space;)}\,\mathrm{d}u$

Now we are going to “complete the square”: say you have x²-2x; you can see that the missing term in order to make a square is 4, so you can write it as x²-2x+4-4= (x-2)²-4. (-4 because if you simply add 4, the two things won’t be equivalent anymore). This is exactly what we are doing here. First though, let’s take that 4 out of the square root:

$\large&space;\frac{1}{\sqrt{\pi}}e^{-a}\int_{-\infty}^{+\infty}e^{-\left&space;(u^2-2\sqrt{kt}\cdot&space;u&space;\right&space;)}\,\mathrm{d}u$

The missing term is kt, so

$\large&space;\frac{1}{\sqrt{\pi}}e^{-a}\int_{-\infty}^{+\infty}e^{-\left&space;(u^2-2\sqrt{kt}\cdot&space;u&space;+kt-kt&space;\right&space;)}\,\mathrm{d}u$ $\large&space;\frac{1}{\sqrt{\pi}}e^{-a}\int_{-\infty}^{+\infty}e^{-\left&space;(&space;u-\sqrt{kt}&space;\right&space;)^2+kt}\,\mathrm{d}u$ $\large&space;\frac{1}{\sqrt{\pi}}e^{-a}e^{kt}\int_{-\infty}^{+\infty}e^{-\left&space;(&space;u-\sqrt{kt}&space;\right&space;)^2}\,\mathrm{d}u$

At this point, we can perform another substitution:

$\large&space;v=u-\sqrt{kt}\;\;\;\;\;\mathrm{d}v=\mathrm{d}u$ $\large&space;\frac{1}{\sqrt{\pi}}e^{-a}e^{kt}\int_{-\infty}^{+\infty}e^{-v^2}\,\mathrm{d}v$

This time the bounds stay the same, since nothing changes when you plug infinity and -infinity into u-sqrt(kt).

This is the Gaussian integral! And we saw here that this is equal to sqrt(pi).

Therefore,

$\large&space;\frac{1}{{\color{Red}&space;\sqrt{\pi}}}e^{-a}e^{kt}\cdot&space;{\color{Red}&space;\sqrt{\pi}}=e^{-a}e^{kt}=e^{kt-a}$

Overall,

$\large&space;\frac{1}{\sqrt{4\pi&space;k&space;t}}\int_{-\infty}^{+\infty}e^{-\frac{(a-x)^2}{4kt}}e^{-x}\,\mathrm{d}x=e^{kt-a}$

And that’s it!

Hope you liked this post! If so, give it a like and leave a comment if you have any doubt, question, suggestions!

Join 31 other followers

This site uses Akismet to reduce spam. Learn how your comment data is processed.