Calculus 2: Integration by Parts Stuck on Integral of Product I'm stuck on the following problem: 
$$I=\int e^{5x}\cos(4x) dx$$
Below is my work but I can't get past the last line which I believe is correct.  I don't know how to get rid of that integral.  
A step through would be greatly appreciated.  

 A: If you are not obliged to use integration by parts
Since you need to compute $$I=\int e^{5x}\cos(4x)\, dx$$
compute instead
$$J=\int e^{5x}e^{4ix}\, dx=\int e^{(5+4i)x}\, dx\qquad \text{and} \qquad K=\int e^{5x}e^{-4ix}\, dx=\int e^{(5-4i)x}\, dx$$ These are simple; when done
$$I=\frac {J+K}2$$ You just need to work a bit with complex numbers
A: Notice that, if you let $\mathcal I$ be your original integral, your last line reads
$$\mathcal I = \frac 1 4 e^{5x} \sin(4x) - \frac 5 4 \left[ - \frac 1 4 \cos(4x) e^{5x} + \frac 5 4 \mathcal I \right]$$
Solve for $\mathcal I$ to find your integral. This is a totally valid way of solving integrals: in fact, it's pretty common whenever integrals involve a sine or cosine term (since taking derivatives or antiderivatives of sine/cosine eventually cycles back to sine/cosine again).
A: We will integrate by parts twice in a row:
1)$\text{First time }(f = \cos(4x), g'=e^{5x} \Rightarrow f'= -4\sin(4x), g=\frac{e^{5x}}{5}):$
$$I=\int e^{5x} \cos(4x) dx = \frac{e^{5x} \cos(4x)}{5} - \int - \frac{4e^{5x} \sin(4x)}{5} dx$$
1)$\text{Second time }(f = -4\sin(4x), g'=\frac{e^{5x}}{5} \Rightarrow f'= -16\cos(4x), g=\frac{e^{5x}}{25}):$
$$\frac{e^{5x} \cos(4x)}{5} - \int - \frac{4e^{5x} \sin(4x)}{5} dx$$
$$= \frac{e^{5x} \cos(4x)}{5} - \left(- \frac{4e^{5x} \sin(4x)}{25} - \int - \frac{16e^{5x} \cos(4x)}{25} dx\right)$$
$$= \frac{e^{5x} \cos(4x)}{5} + \frac{4e^{5x} \sin(4x)}{25} - \frac{16}{25} \int e^{5x} \cos(4x) dx$$
So now our integral is equivalent with:
$$\int e^{5x} \cos(4x) dx = \frac{e^{5x} \cos(4x)}{5} + \frac{4e^{5x} \sin(4x)}{25} - \frac{16}{25} \int e^{5x} \cos(4x) dx$$
$$\Leftrightarrow \frac{41}{25} \int e^{5x} \cos(4x) dx = \frac{e^{5x} \cos(4x)}{5} + \frac{4e^{5x} \sin(4x)}{25} $$
$$\Leftrightarrow \int e^{5x} \cos(4x) dx = \frac{5e^{5x} \cos(4x)}{41} + \frac{4e^{5x} \sin(4x)}{41} $$
$$\Leftrightarrow \int e^{5x} \cos(4x) dx = \frac{e^{5x} (5\cos(4x) + 4\sin(4x))}{41}$$
A: On integration by parts, two very common cases used are having a polynomial term, and a term that integrates/differentiates "in a circle".  For instance, $e^X$ always differentiates to $e^x\,dx$ and $\sin(x)$ differentiates to $\cos(x)$ which differentiates to $-\sin(x)$ which differentiates to $-\cos(x)$ which finally comes full circle back to $\sin(x)$.  
In cases where you have a polynomial term and a "circle" term, always set $u$ to be the polynomial term and $dv$ to be the circle term.
In this case, though, we have two "circle" terms.  In these cases, it doesn't matter which you use as $u$ or $dv$.  It only matters that you keep consistent.  Then, in cases where there are two "circle" terms, eventually, you will hit a point where the integral that you rewrote on the right matches the original integral.  Then, you can just add/subtract it to move like terms to one side.  This will give you a multiplier on the integral, which you can then divide out to achieve the answer.
Notice that, in two "circle" terms, the actual integration step never occurs!  You simply work the problem until the newly-created integral matches the one on the left, and then you can solve algebraically.
So, in your case, the bottom equation has a term that matches the left side of the equation, so (after distributing everything), you can move that to the left side, and it will give you a multiple of your original integral.  You then divide by that constant, and it will provide you with the answer.  Again, when you have two "circle" terms, you will not have a point when you do an integral.
