How to evaluate $\int e^{\kappa t}\cos \omega t dt$ The integral I need to solve is
$$
\int e^{\kappa t}\cos \omega t\, dt
$$
The answer is
$$
\frac{e^{\kappa t}}{\kappa^2 + \omega^2}(\kappa \cos wt + \omega \sin \omega   t) + c
$$
But how do I do it? The hint is that we use integration by parts, but I'm going around in circles with it.

Ok so here's my issue. When integrating by parts, I presume the point is that one of the terms diminishes, yet neither the $e^{\kappa t}$ term nor the $\cos \omega t$ term is going to do that. Or rather, say $u=e^{\kappa t}$ and $dv = cos \omega  t dt$ then $du = \kappa u$ and $v = \frac{1}{\omega} sin\omega t$ so we have
$$
\int u\, dv = uv - \int v\,du\\
= \frac{e^{\kappa t} }{\omega} \sin{\omega t} - \frac{\kappa}{\omega}\int e^{\kappa t} \sin \omega t\,dt
$$
which is no less ugly than it began. On the other hand, say $u=\cos \omega t$ and $dv = e^{\kappa t}\,dt$ then $du = -\omega \sin \omega t\,dt$ and $v = \frac{1}{\kappa} e^{\kappa t}$. So we get
$$
\int u \,dv = uv - \int v\,du\\
= \frac{1}{\kappa}e^{\kappa t}\cos \omega t+\frac{\omega}{\kappa}\int e^{\kappa t} \,sin \omega t\, dt
$$
So either way I now need to solve $\int e^{\kappa t} \sin \omega t\, dt$. Applying the same process to this new problem, I wind up again needing to solve the original $\int e^{\kappa t}\,cos \omega t\, dt$.
 A: Integrate by parts twice,
$$
I = \int e^{k t}cos \omega t dt
= \frac1k \int d(e^{kt})\cos \omega t \, dt$$
$$
= \frac1k e^{kt} \cos \omega t + \frac {\omega}k \int e^{kt} \sin \omega t\, dt
$$
$$= \frac1k e^{kt} \cos \omega t + \frac {\omega}{k^2} e^{kt} \sin \omega t -   \frac {\omega^2}{k^2} I 
$$
Thus,
$$I= \frac{e^{kt} }{k^2+\omega^2} ( k \cos \omega t + \omega\sin\omega t)+C
$$
A: You need IBP twice viz.$$\int u\ddot{v}dt=u\dot{v}-\int\dot{u}\dot{v}dt=u\dot{v}-\dot{u}v+\int\ddot{u}vdt.$$@Quanto's answer uses $u:=\cos\omega t,\,v:=\frac{1}{\kappa^2}e^{\kappa t}$, but you can also use $u:=e^{\kappa t},\,v:=-\frac{1}{\omega^2}\cos^{\omega t}$. The latter obtains$$I\sim\frac{1}{\omega^2}e^{\kappa t}\left(\omega\sin\omega t+\kappa\cos\omega t\right)-\frac{\kappa^2}{\omega^2}I,$$where $f\sim g$ means $f-g$ is an integration constant. So$$I=\frac{1}{\kappa^2+\omega^2}e^{\kappa t}\left(\omega\sin\omega t+\kappa\cos\omega t\right)+C.$$The two options of course give the same answer.
Although the hint advised IBP, you could instead use complex numbers, since $\cos\omega t=\frac{e^{i\omega t}-e^{-i\omega t}}{2}$. So the antiderivative is$$\frac12\sum_\pm\frac{1}{\kappa\pm i\omega}e^{(\kappa\pm i\omega t)}+C=\frac{e^{\kappa t}}{\kappa^2+\omega^2}\left((\kappa-i\omega t)e^{i\omega t}+(\kappa+i\omega t)e^{-i\omega t}\right)+C,$$which you can check recovers the familiar result in trigonometric functions if you also use $\sin\omega t=\frac{e^{i\omega t}-e^{-i\omega t}}{2i}$.
A: Option:
Assume $k,w  \in \mathbb{R}.$
Consider 
$Re \int e^{(k+iw)t}dt=$
$Re (k+iw)^{-1}e^{(k+iw)t} =$
$Re \dfrac{k-iw}{k^2+w^2}\cdot $
$e^{kt}(\cos wt +i\sin wt)=$
$\dfrac{e^{kt}}{(k^2+w^2)}\cdot$
$ (k\cos wt+w\sin wt).$
