# Question #87a05

Jan 11, 2018

$\frac{\sqrt{\pi}}{4} \left[{e}^{\frac{1}{2}} e r f \left(x - \frac{i}{\sqrt{2}}\right) + {e}^{- \frac{1}{2}} e r f \left(x + \frac{i}{\sqrt{2}}\right)\right] + C$

#### Explanation:

$\int {e}^{- {x}^{2}} \cos \left(\sqrt{2} x\right) \mathrm{dx}$

This function cannot be written in terms of typical elementary functions, in that regard we have to use a special function. More specifically we need to use the Gaussian Error function which is defined as follows:

$e r f \left(x\right) = \frac{2}{\sqrt{\pi}} \int {e}^{- {x}^{2}} \mathrm{dx}$

The definition is generalized for coefficients in front of the exponent like so:

$\frac{e r f \left(\sqrt{a} x\right)}{\sqrt{a}} = \frac{2}{\sqrt{\pi}} \int {e}^{- a {x}^{2}} \mathrm{dx}$

The graph of the Gaussian error function looks like this:

Several techniques can be used to deduce the behavior of the $e r f \left(x\right)$ function from the Guassian integral. One such method is to find the Taylor series of ${e}^{- {x}^{2}}$ and integrate that term by term.

This is now diverting from the main question, if you wish to find out more about the Gaussian Error function then follow the link:
http://mathworld.wolfram.com/Erf.html

So now that we have been introduced to the Gaussian Error function we can answer the question, start by using:

$\cos \left(a x\right) = \frac{{e}^{i a x} + {e}^{- i a x}}{2}$ so we may re-write the integral as:

$\int {e}^{- {x}^{2}} \cos \left(\sqrt{2} x\right) \mathrm{dx} = \int {e}^{- {x}^{2}} \frac{{e}^{i \sqrt{2} x} + {e}^{- i \sqrt{2} x}}{2} \mathrm{dx}$

Now combine the exponents:

$= \frac{1}{2} \int {e}^{- {x}^{2} + i \sqrt{2} x} + {e}^{- {x}^{2} - i \sqrt{2} x} \mathrm{dx}$

To continue we need to complete the square of the exponents:

$- {x}^{2} + i \sqrt{2} x = - {\left(x - i \frac{\sqrt{2}}{2}\right)}^{2} - {\left(- i \frac{\sqrt{2}}{2}\right)}^{2}$

$= - {\left(x - \frac{i}{\sqrt{2}}\right)}^{2} + \frac{1}{2}$

And

$- {x}^{2} - i \sqrt{2} x = - {\left(x + i \frac{\sqrt{2}}{2}\right)}^{2} - {\left(+ i \frac{\sqrt{2}}{2}\right)}^{2}$

$= - {\left(x + \frac{i}{\sqrt{2}}\right)}^{2} - \frac{1}{2}$

So; our integral now becomes:

$\frac{1}{2} \int {e}^{- {\left(x - \frac{i}{\sqrt{2}}\right)}^{2} + \frac{1}{2}} + {e}^{- {\left(x + \frac{i}{\sqrt{2}}\right)}^{2} - \frac{1}{2}} \mathrm{dx}$

$= {e}^{\frac{1}{2}} / 2 \int {e}^{- {\left(x - \frac{i}{\sqrt{2}}\right)}^{2}} \mathrm{dx} + {e}^{- \frac{1}{2}} / 2 \int {e}^{- {\left(x + \frac{i}{\sqrt{2}}\right)}^{2}} \mathrm{dx}$

Now substitute $u = x - \frac{i}{\sqrt{2}} \to \mathrm{du} = \mathrm{dx}$ for the first integral.

Substitute: $v = x + \frac{i}{\sqrt{2}} \to \mathrm{dv} = \mathrm{dx}$ for the second integral.

So we now have:

$= {e}^{\frac{1}{2}} / 2 \int {e}^{- {u}^{2}} \mathrm{du} + {e}^{- \frac{1}{2}} / 2 \int {e}^{- {v}^{2}} \mathrm{dv}$

Now, using our definition for the $e r f \left(x\right)$ function we can integrate this to get:

$\frac{{e}^{\frac{1}{2}} \sqrt{\pi}}{4} e r f \left(u\right) + \frac{{e}^{- \frac{1}{2}} \sqrt{\pi}}{4} e r f \left(v\right) + C$

Now we can reverse the substitution:

$\frac{\sqrt{\pi}}{4} \left[{e}^{\frac{1}{2}} e r f \left(x - \frac{i}{\sqrt{2}}\right) + {e}^{- \frac{1}{2}} e r f \left(x + \frac{i}{\sqrt{2}}\right)\right] + C$