# How do you integrate int e^xcosx by integration by parts method?

May 4, 2018

By integrating by parts twice:

$\setminus \frac{{e}^{x} \left(\cos \left(x\right) + \sin \left(x\right)\right)}{2}$

#### Explanation:

We will use the fact that ${e}^{x}$ remains unchanged when integrated, while the cosine function has the following derivation loop:

$\cos \left(x\right) \to - \setminus \sin \left(x\right) \to - \setminus \cos \left(x\right) \to \sin \left(x\right) \to \cos \left(x\right) \to \setminus \ldots$

In particular, we're interested in the fact that deriving the cosine function twice means to invert its sign.

So, after a first integration by parts, we have

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

Now integrate ${e}^{x} \sin \left(x\right)$ by parts again: we have

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

Putting all the pieces together, we have

$\int {e}^{x} \cos \left(x\right) = {e}^{x} \cos \left(x\right) + {e}^{x} \sin \left(x\right) - \setminus \int {e}^{x} \cos \left(x\right)$

As you can see, the (same) integral appears on both sides, this means that we can add it to both sides to get

$2 \int {e}^{x} \cos \left(x\right) = {e}^{x} \cos \left(x\right) + {e}^{x} \sin \left(x\right)$

and thus solve for it:

$\int {e}^{x} \cos \left(x\right) = \setminus \frac{{e}^{x} \cos \left(x\right) + {e}^{x} \sin \left(x\right)}{2} = \setminus \frac{{e}^{x} \left(\cos \left(x\right) + \sin \left(x\right)\right)}{2}$

May 4, 2018

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

#### Explanation:

As $d \left({e}^{x}\right) = {e}^{x} \mathrm{dx}$, we can integrate by parts int the following way:

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

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

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

Integrate by parts again:

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

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

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

The integral now appears on both sides of the equation and we can solve for it:

$2 \int {e}^{x} \cos x \mathrm{dx} = {e}^{x} \cos x + {e}^{x} \sin x + C$

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