How to integrate $\cos(x)e^{ix}dx$ How to integrate
$$\int \cos(t)e^{it}dt $$
I tried integrating by parts twice, but it doesn't work because an i shows up in the end and one gets  $0=….$
 A: Making this an answer. Write $\cos(t)=\frac{e^{it}+e^{-it}}2$ and it should be easy.
A: One way would begin by changing $\cos t$ to $\dfrac{e^{it}+e^{-it}}{2}$.  When you multiply that by $e^{it}$ you get $\dfrac{e^{2it}+1}{2}$.
Let's try integrating by parts:
$$
\int (\cos t) e^{it} \; dt = \int u\;dv = uv - \int v\;du
$$
where $u=\cos t$ and $dv=e^{it}\;dt$, so $du=-\sin t\;dt$ and $v=e^{it}/i= -ie^{it}$.  Then 
$$
uv - \int v\;du = -i(\cos t) e^{it} - \int (\sin t) e^{it}\;dt = -i(\cos t) e^{it} - \int w\;dv
$$
some details above may need work.  To be continued....with $w= \sin t$ and $v$ as above.  This becomes
$$
-i(\cos t) e^{it} - \left( wv - \int v\; dw \right) = -i(\cos t) e^{it} -  \left( -(\sin t)e^{it} - \int -(\cos t)e^{it} \;dt \right)
$$
$$
=-i(\cos t) e^{it} + (\sin t)e^{it} - \int (\cos t)e^{it} \;dt.
$$
So we have 
$$
I = -i(\cos t) e^{it} + (\sin t)e^{it} - I.
$$
Solving that for $I$ can probably be left as an excercise.  (Remember that when you move $I$ to the other side, "${}+C$" will appear on the right side.)
