# How do you integrate int e^x cos x^2 dx ?

Dec 17, 2017

$\int \setminus {e}^{x} {\left(\cos x\right)}^{2} \setminus \mathrm{dx} = \frac{1}{2} {e}^{x} + \frac{1}{5} {e}^{x} \sin 2 x + \frac{1}{10} {e}^{x} \cos 2 x + C$

#### Explanation:

Assuming that we seek:

$I = \int \setminus {e}^{x} {\left(\cos x\right)}^{2} \setminus \mathrm{dx}$

Then, using the identity $\cos 2 \theta \equiv 2 {\cos}^{2} \theta - 1$ we can rewrite the integral as:

$I = \int \setminus {e}^{x} \frac{1 + \cos 2 x}{2} \setminus \mathrm{dx}$
$\setminus \setminus = \frac{1}{2} \setminus \int \setminus {e}^{x} \left(1 + \cos 2 x\right) \setminus \mathrm{dx}$
$\setminus \setminus = \frac{1}{2} \setminus \left\{\int \setminus {e}^{x} \setminus \mathrm{dx} + \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx}\right\}$ ..... [A]

The first integral is trivial, for the second we apply integration by parts:

Let  { (u,=e^x, => (du)/dx,=e^x), ((dv)/dx,=cos2x, => v,=1/2 sin2x ) :}

Then plugging into the IBP formula:

$\int \setminus \left(u\right) \left(\frac{\mathrm{dv}}{\mathrm{dx}}\right) \setminus \mathrm{dx} = \left(u\right) \left(v\right) - \int \setminus \left(v\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right) \setminus \mathrm{dx}$

We have:

$\int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx} = {e}^{x} \frac{1}{2} \sin 2 x - \int \setminus \frac{1}{2} \sin 2 x \setminus {e}^{x} \setminus \mathrm{dx}$
$\text{ } = \frac{1}{2} {e}^{x} \sin 2 x - \frac{1}{2} \setminus \int \setminus {e}^{x} \sin 2 x \setminus \mathrm{dx}$ ..... [B]

Now if we perform a second application of Integration By Parts:

Let  { (u,=e^x, => (du)/dx,=e^x), ((dv)/dx,=sin2x, => v,=-1/2 cos2x ) :}

Then plugging into the IBP formula, we have:

$\int \setminus {e}^{x} \sin 2 x \setminus \mathrm{dx} = {e}^{x} \left(- \frac{1}{2} \cos 2 x\right) - \int \setminus \left(- \frac{1}{2} \cos 2 x\right) \setminus {e}^{x} \setminus \mathrm{dx}$
$\text{ } = - \frac{1}{2} {e}^{x} \cos 2 x + \frac{1}{2} \setminus \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx}$ ..... [C]

Substituting result [C] into [B] we have:

$\int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx} = \frac{1}{2} {e}^{x} \sin 2 x - \frac{1}{2} \left\{- \frac{1}{2} {e}^{x} \cos 2 x + \frac{1}{2} \setminus \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx}\right\}$

$\therefore \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx} = \frac{1}{2} {e}^{x} \sin 2 x + \frac{1}{4} {e}^{x} \cos 2 x - \frac{1}{4} \setminus \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx}$

$\therefore \frac{5}{4} \setminus \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx} = \frac{1}{2} {e}^{x} \sin 2 x + \frac{1}{4} {e}^{x} \cos 2 x$

$\therefore \int \setminus {e}^{x} \cos 2 x \setminus \mathrm{dx} = \frac{2}{5} {e}^{x} \sin 2 x + \frac{1}{5} {e}^{x} \cos 2 x$

Now, substituting this result into [A] and integrating we get:

$I = \frac{1}{2} \setminus \left\{{e}^{x} + \frac{2}{5} {e}^{x} \sin 2 x + \frac{1}{5} {e}^{x} \cos 2 x\right\} + C$
$\setminus \setminus = \frac{1}{2} {e}^{x} + \frac{1}{5} {e}^{x} \sin 2 x + \frac{1}{10} {e}^{x} \cos 2 x + C$

Dec 17, 2017

See below.

#### Explanation:

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

Now $\int {e}^{x} \cos \left(2 x\right) \mathrm{dx} = \text{Re"[int e^x e^(2ix)dx] = "Re} \left[\int {e}^{\left(2 i + 1\right) x} \mathrm{dx}\right]$

Now

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

and $\text{Re} \left[{e}^{x} / \left(2 i + 1\right) \left(\cos \left(2 x\right) + i \sin \left(2 x\right)\right) + C\right] = \frac{1}{5} {e}^{x} \left(C o s \left(2 x\right) + 2 S \in \left(2 x\right)\right) + {C}_{1}$

so finally

$\int {e}^{x} {\cos}^{2} x \mathrm{dx} = {e}^{x} / 2 \left(1 + \frac{1}{5} \left(C o s \left(2 x\right) + 2 S \in \left(2 x\right)\right)\right) + {C}_{2}$