Taking this from https://en.wikipedia.org/wiki/Integration_using_Euler%27s_formula problem 3 Understanding Euler's formula I still don't understand how:
"cos x is the real part of e^(i x)"
and how the "Real part" affects the function
Thus:
\begin{aligned}\int e^{x}\cos x\,dx&=\operatorname {Re} \left({\frac {e^{(1+i)x}}{1+i}}\right)+C\\[6pt]&=e^{x}\operatorname {Re} \left({\frac {e^{ix}}{1+i}}\right)+C\\[6pt]&=e^{x}\operatorname {Re} \left({\frac {e^{ix}(1-i)}{2}}\right)+C\\[6pt]&=e^{x}{\frac {\cos x+\sin x}{2}}+C.\end{aligned}