Calculus/Integration techniques/Integration by Complexifying

This technique requires an understanding and recognition of complex numbers. Specifically Euler's formula:


 * $$\cos(\theta)+i\sin(\theta)=e^{\theta i}$$

Recognize, for example, that the real portion:


 * $$\text{Re}\left\{e^{\theta i}\right\}=\cos(\theta)$$

Given an integral of the general form:


 * $$\int e^x\cos(2x)dx$$

We can complexify it:


 * $$\int\text{Re}\Big\{e^x\big(\cos(2x)+i\sin(2x)\big)\Big\}dx$$


 * $$\int\text{Re}\big\{e^x(e^{2xi})\big\}dx$$

With basic rules of exponents:


 * $$\int\text{Re}\{e^{x+2ix}\}dx$$

It can be proven that the "real portion" operator can be moved outside the integral:


 * $$\text{Re}\left\{\int e^{x(1+2i)}dx\right\}$$

The integral easily evaluates:


 * $$\text{Re}\left\{\frac{e^{x(1+2i)}}{1+2i}\right\}$$

Multiplying and dividing by $$1-2i$$ :


 * $$\text{Re}\left\{\frac{1-2i}{5}e^{x(1+2i)}\right\}$$

Which can be rewritten as:


 * $$\text{Re}\left\{\frac{1-2i}{5}e^xe^{2ix}\right\}$$

Applying Euler's forumula:


 * $$\text{Re}\left\{\frac{1-2i}{5}e^x\big(\cos(2x)+i\sin(2x)\big)\right\}$$

Expanding:


 * $$\text{Re}\left\{\frac{e^x}{5}\big(\cos(2x)+2\sin(2x)\big)+i\cdot\frac{e^x}{5}\big(\sin(2x)-2\cos(2x)\big)\right\}$$

Taking the Real part of this expression:


 * $$\frac{e^x}{5}\big(\cos(2x)+2\sin(2x)\big)$$

So:


 * $$\int e^x\cos(2x)dx=\frac{e^x}{5}\big(\cos(2x)+2\sin(2x)\big)+C$$