how to solve $\int e^{7x}\cos(2x)dx$ I'm having problems to solve this integral, It looks like it will never end because every time I do integration by parts I need to do it again and again...
$$\int e^{7x}\cos(2x)dx$$
$$u=\cos(2x) \ \ \  dv = e^{7x}$$
$$du = -2\sin(2x)dx \ \ \   v = \frac{1}{7}e^{7x}$$
$$\frac {\cos(2x)e^{7x}}{7}-\int \frac{1}{7}e^{7x}(-2\sin(2x))dx$$
$$\frac {\cos(2x)e^{7x}}{7}+\frac{2}{7}\int e^{7x}(-2\sin(2x))dx$$
doing integration by parts again
$\int e^{7x}(-2\sin(2x))dx$
$u = \sin(2x)$ $dv = e^{7x}$
$du = \cos(2x)$ $v =\frac{1}{7}e^{7x}$
$\frac {\sin(2x)e^{7x}}{7} - \frac{2}{7}\int e^{7x}\cos(2x)dx$
 A: Hint: Complexify the problem by noting that $\cos(nx)+i\sin(nx)=\exp(inx)$. Then determine the integral by:
$$\int \exp(7x)\cos(2x) dx =\operatorname{Re}\left[ \int \exp(7x)\exp(2ix) dx\right],$$
in which $\operatorname{Re}\left[ z \right]$ returns the real part of $z$. 
A: There is a significantly easier way, involving Euler's formula. From, 
$$e^{in\theta} = i\sin n\theta + \cos n\theta$$
You have, 
$$\int e^{7 x} \cdot e^{2i x} \ \mathrm d x= i \int e^{7x}\sin 2x \ \mathrm dx + \int e^{7x}\cos 2x \ \mathrm dx$$
Hence you have, 
$$\operatorname{Re}\left(\int e^{(7+2i)x} \mathrm dx\right) = \int e^{7x}\cos 2x \ \mathrm dx$$
Which shouldn't be hard to manipulate provided you have covered complex numbers. If you want help with using IBP instead, just say. 
A: You're almost there:
\begin{align}
I &= \int e^{7x}\cos(2x)\,dx \\
&= \frac {\cos(2x)e^{7x}}{7}+\frac{2}{7}\int e^{7x}(-2\sin(2x))\,dx \\
&= \frac {\cos(2x)e^{7x}}{7}+\frac{2}{7}\left(\frac {\sin(2x)e^{7x}}{7} - \frac{2}{7}\int e^{7x}\cos(2x)\,dx\right)\\
&= \frac {\cos(2x)e^{7x}}{7}+\frac {2\sin(2x)e^{7x}}{49} - \frac{4}{49}\int e^{7x}\cos(2x)\,dx\\
&= \frac {7\cos(2x)+2\sin(2x)}{49}e^{7x} - \frac{4}{49}I\\
\end{align}
Thus, by solving for $I$ we get:
$$I = \frac {7\cos(2x)+2\sin(2x)}{53}e^{7x}$$
A: for the solution make the Ansatz $$\int e^{7x}\cos(2x)dx=Ae^{7x}(B\sin(2x)+C\cos(2x))$$
