# How do you find the integral of (e^x)(cosx) dx?

Jun 22, 2015

I found: $\frac{{e}^{x} \left(\cos \left(x\right) + \sin \left(x\right)\right)}{2} + c$

#### Explanation:

I tried Integration by Parts (twice) and a little trick...!

Jan 12, 2018

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

#### Explanation:

Alternatively, we can use a nice little technique called complexifying the integral.

We notice that $\cos \left(x\right)$ is just the same as the real part of ${e}^{i x}$ (by Euler's identity, ${e}^{i \theta} = \cos \left(\theta\right) + i \sin \left(\theta\right)$). We can use this fact to rewrite the integral like so:
$\int \setminus {e}^{x} \cos \left(x\right) \setminus \mathrm{dx} = \int \setminus {e}^{x} \cdot R e \left({e}^{i x}\right) \setminus \mathrm{dx} =$

In terms of complex numbers, ${e}^{x}$ is just some real factor, so it doesn't matter whether we have it outside or inside the Real part function. This means we can put the entire integral inside the Real part function:
$= R e \left(\int \setminus {e}^{x} {e}^{i x} \setminus \mathrm{dx}\right) = R e \left(\int \setminus {e}^{x + i x} \setminus \mathrm{dx}\right) = R e \left(\int \setminus {e}^{\left(i + 1\right) x}\right) \setminus \mathrm{dx} =$

We can do a quite simple u-substitution to evaluate the integral:
$R e \left({e}^{\left(i + 1\right) x} / \left(i + 1\right) + C\right) = R e \left(\frac{{e}^{x} {e}^{i x}}{i + 1}\right) + C =$

$= {e}^{x} \cdot R e \left({e}^{i x} / \left(i + 1\right)\right) + C =$

We can now use Euler's identity again to expand the top. We also multiply by the conjugate of the bottom to simplify the fraction:
$= {e}^{x} \cdot R e \left(\frac{i - 1}{\left(i + 1\right) \left(i - 1\right)} \left(\cos \left(x\right) + i \sin \left(x\right)\right)\right) + C =$

$= {e}^{x} \cdot R e \left(\frac{i - 1}{- 1 - 1} \left(\cos \left(x\right) + i \sin \left(x\right)\right)\right) + C =$

$= {e}^{x} \cdot R e \left(\left(\frac{i}{- 2} - \frac{1}{- 2}\right) \left(\cos \left(x\right) + i \sin \left(x\right)\right)\right) + C =$

$= {e}^{x} \cdot R e \left(- \frac{i}{2} \cos \left(x\right) + \frac{1}{2} \sin \left(x\right) + \frac{1}{2} \cos \left(x\right) + \frac{i}{2} \sin \left(x\right)\right) + C =$

We can now quite easily pick out the real parts:
$= {e}^{x} \left(\frac{1}{2} \sin \left(x\right) + \frac{1}{2} \cos \left(x\right)\right) + C = {e}^{x} / 2 \left(\sin \left(x\right) + \cos \left(x\right)\right) + C$