# How do you integrate (e^x)(cosx) dx?

Apr 29, 2015

This integral is a cyclic one and has to be done two times with the theorem of the integration by parts, that says:

$\int f \left(x\right) g ' \left(x\right) \mathrm{dx} = f \left(x\right) g \left(x\right) - \int g \left(x\right) f ' \left(x\right) \mathrm{dx}$

We can assume that $f \left(x\right) = \cos x$ and $g ' \left(x\right) \mathrm{dx} = {e}^{x} \mathrm{dx}$,

$f ' \left(x\right) \mathrm{dx} = - \sin x \mathrm{dx}$

$g \left(x\right) = {e}^{x}$,

so:

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

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

And now...again:

$f \left(x\right) = \sin x$ and $g ' \left(x\right) \mathrm{dx} = {e}^{x} \mathrm{dx}$,

$f ' \left(x\right) \mathrm{dx} = \cos x \mathrm{dx}$

$g \left(x\right) = {e}^{x}$.

So:

$\left(1\right) = {e}^{x} \cos x + \left[{e}^{x} \sin x - \int {e}^{x} \cos x \mathrm{dx}\right] =$

$= {e}^{x} \cos x + {e}^{x} \sin x - \int {e}^{x} \cos x \mathrm{dx}$.

So, finally, we can write:

$I = {e}^{x} \cos x + {e}^{x} \sin x - I \Rightarrow$

$2 I = {e}^{x} \cos x + {e}^{x} \sin x - I \Rightarrow$

$I = {e}^{x} / 2 \left(\cos x + \sin x\right) + c$.