I need to evaluate the following function and then check my answer by taking the derivative: $\int e^{ax}\cos(bx)\,dx$ where $a$ is any real number and $b$ is any positive real number.
I know that you set $u=\cos(bx)$ and $dv=e^{ax} dx$, and the second time you need to integrate again you set $u=\sin(bx)$ and $dv=e^{ax}dx$ again.
It eventually simplifies down to $\int e^{ax}\cos(bx)dx = \frac{1}{a}e^{ax}\cos(bx) + \frac{b}{a}\left(\frac{1}{a}e^{ax}\sin(bx) - \frac{b}{a}\int e^{ax}\cos(bx)\,dx\right).$
Now I know to move the integral on the left side to the right side so that I can just divide by the constant to solve.
Here is my problem:
I know I need to solve the right side to be: $\frac{e^{ax}\left(a\cos(bx) + b\sin(bx)\right)}{a^2+b^2} + C.$
To divide by the constant, I multiplied everything on the right side by $\frac{a^2}{b^2+1}.$ but this leads me to get $b^2 + 1$ on the bottom instead of $a^2 + b^2$.
I will show what I am doing in detail:
After setting the initial integral equal to: $\frac{1}{a}e^{ax}\cos(bx) + \frac{b}{a}\left(\frac{1}{a}e^{ax}\sin(bx) - \frac{b}{a}\int e^{ax}\cos(bx)\,dx\right) + C$ I simplify: $\int e^{ax}\cos(bx)\,dx = \frac{a^2}{b^2+1}\left(\frac{1}{a}e^{ax}\cos(bx) + \frac{b}{a}\left(\frac{1}{a}e^{ax}\sin(bx)\right)\right) + C$
If this is already wrong, can someone point be in the right direction?
If I have not gone wrong yet, I can edit to show the rest of my work.