# Integration using Euler’s formula

Indefinite integral of e^-x
Indefinite integral of e^-x

Use of complex numbers to evaluate integrals

In integral calculus, Euler’s formula for complex numbers may be used to evaluate integrals involving trigonometric functions. Using Euler’s formula, any trigonometric function may be written in terms of complex exponential functions, namely ${e}^{ix}$ and ${e}^{-ix}$ and then integrated. This technique is often simpler and faster than using trigonometric identities or integration by parts, and is sufficiently powerful to integrate any rational expression involving trigonometric functions.[1]

## Euler’s formula [ edit ]

Euler’s formula states that [2]

${e}^{ix}=\mathrm{cos}x+i\mathrm{sin}x.$

Substituting $-x$ for $x$ gives the equation

${e}^{-ix}=\mathrm{cos}x-i\mathrm{sin}x$

because cosine is an even function and sine is odd. These two equations can be solved for the sine and cosine to give

$\mathrm{cos}x=\frac{{e}^{ix}+{e}^{-ix}}{2}\text{and}\mathrm{sin}x=\frac{{e}^{ix}-{e}^{-ix}}{2i}.$

## Examples [ edit ]

### First example [ edit ]

Consider the integral

$\int {\mathrm{cos}}^{2}xdx.$

The standard approach to this integral is to use a half-angle formula to simplify the integrand. We can use Euler’s identity instead:

$\begin{array}{cc}\int {\mathrm{cos}}^{2}xdx& =\int {\left(\frac{{e}^{ix}+{e}^{-ix}}{2}\right)}^{2}dx\\ =\frac{1}{4}\int \left({e}^{2ix}+2+{e}^{-2ix}\right)dx\end{array}$

At this point, it would be possible to change back to real numbers using the formula e2ix + e−2ix = 2 cos 2x. Alternatively, we can integrate the complex exponentials and not change back to trigonometric functions until the end:

$\begin{array}{cc}\frac{1}{4}\int \left({e}^{2ix}+2+{e}^{-2ix}\right)dx& =\frac{1}{4}\left(\frac{{e}^{2ix}}{2i}+2x-\frac{{e}^{-2ix}}{2i}\right)+C\\ =\frac{1}{4}\left(2x+\mathrm{sin}2x\right)+C.\end{array}$

### Second example [ edit ]

Consider the integral

$\int {\mathrm{sin}}^{2}x\mathrm{cos}4xdx.$

This integral would be extremely tedious to solve using trigonometric identities, but using Euler’s identity makes it relatively painless:

$\begin{array}{cc}\int {\mathrm{sin}}^{2}x\mathrm{cos}4xdx& =\int {\left(\frac{{e}^{ix}-{e}^{-ix}}{2i}\right)}^{2}\left(\frac{{e}^{4ix}+{e}^{-4ix}}{2}\right)dx\\ =-\frac{1}{8}\int \left({e}^{2ix}-2+{e}^{-2ix}\right)\left({e}^{4ix}+{e}^{-4ix}\right)dx\\ =-\frac{1}{8}\int \left({e}^{6ix}-2{e}^{4ix}+{e}^{2ix}+{e}^{-2ix}-2{e}^{-4ix}+{e}^{-6ix}\right)dx.\end{array}$

At this point we can either integrate directly, or we can first change the integrand to 2 cos 6x − 4 cos 4x + 2 cos 2x and continue from there.
Either method gives

$\int {\mathrm{sin}}^{2}x\mathrm{cos}4xdx=-\frac{1}{24}\mathrm{sin}6x+\frac{1}{8}\mathrm{sin}4x-\frac{1}{8}\mathrm{sin}2x+C.$

## Using real parts [ edit ]

In addition to Euler’s identity, it can be helpful to make judicious use of the real parts of complex expressions. For example, consider the integral

$\int {e}^{x}\mathrm{cos}xdx.$

Since cos x is the real part of eix, we know that

$\int {e}^{x}\mathrm{cos}xdx=\mathrm{Re}\int {e}^{x}{e}^{ix}dx.$

The integral on the right is easy to evaluate:

$\int {e}^{x}{e}^{ix}dx=\int {e}^{\left(1+i\right)x}dx=\frac{{e}^{\left(1+i\right)x}}{1+i}+C.$

Thus:

$\begin{array}{cc}\int {e}^{x}\mathrm{cos}xdx& =\mathrm{Re}\left(\frac{{e}^{\left(1+i\right)x}}{1+i}\right)+C\\ ={e}^{x}\mathrm{Re}\left(\frac{{e}^{ix}}{1+i}\right)+C\\ ={e}^{x}\mathrm{Re}\left(\frac{{e}^{ix}\left(1-i\right)}{2}\right)+C\\ ={e}^{x}\frac{\mathrm{cos}x+\mathrm{sin}x}{2}+C.\end{array}$

## Fractions [ edit ]

In general, this technique may be used to evaluate any fractions involving trigonometric functions. For example, consider the integral

$\int \frac{1+{\mathrm{cos}}^{2}x}{\mathrm{cos}x+\mathrm{cos}3x}dx.$

Using Euler’s identity, this integral becomes

$\frac{1}{2}\int \frac{6+{e}^{2ix}+{e}^{-2ix}}{{e}^{ix}+{e}^{-ix}+{e}^{3ix}+{e}^{-3ix}}dx.$

If we now make the substitution $u={e}^{ix}$, the result is the integral of a rational function:

$-\frac{i}{2}\int \frac{1+6{u}^{2}+{u}^{4}}{1+{u}^{2}+{u}^{4}+{u}^{6}}du.$

One may proceed using partial fraction decomposition.