I know that you can integrate
$\int e^{-x}\cos(x)dx$
by parts, but I would like to know how you can use complex variables instead.
I know that you can integrate
$\int e^{-x}\cos(x)dx$
by parts, but I would like to know how you can use complex variables instead.
Euler's form of a complex Number:
$e^{i x}=\cos x+i \sin x$
And, note that, as $\sin (-x)= -\sin x$ and $\cos (-x) = \cos x$, we have that, $e^{-i x}=\cos x-i \sin x$
This together gives you, $\cos x = \dfrac{e^{ix}+e^{-ix}}{2}$
Note: $\Re$ stands for the real part of a complex number and $\Im$ for its imaginary part.
Method 1:
$\begin{align*}\int e^{-x}\cos x~~ \mathrm d x &= \Re\left(\int e^{-x}e^{ix} \mathrm dx\right)\\&=\Re\left(\int e^{x(i-1)} \mathrm d x\right) \\&=\Re\left(\dfrac{e^{x(i-1)}}{i-1}\right)\\&=e^{-x}\cdot\Re\left(\dfrac{\cos x+ i \sin x}{-1+i}\right) \\&= e^{-x} \cdot\dfrac{\sin x-\cos x}{2}\end{align*} $
Method 2:(Ben's Comment)
$\begin{align*} \int e^{-x} \cos x ~\mathrm dx&=\int e^{-x} \cdot \dfrac{e^{ix}+e^{-ix}}{2} \mathrm dx\\&=\dfrac{1}{2} \cdot \int (e^{ix-x}+e^{-ix-x}) \mathrm d x\\&=\dfrac{1}{2}\cdot \left(\dfrac{e^{x(i-1)}}{i-1}+\dfrac{e^{x(-1-i)}}{-i-1}\right)\end{align*}$
Leaving the simplifications to you, you will see that the answer still turns out to be the same.