Consider this integral:
$$\int e^x\cdot cos(x)\space dx$$
Using integration by parts: $\int uv'\space dx=uv- \int u'v \space dx$
I have 2 possible outcomes:
1.) Using $u=e^x$, $v'=cos (x)$, $u'=e^x$ and $v=sin(x)$ gives: $$\int e^x\cdot cos(x)\space dx=e^x\cdot cos(x)-\int e^x\cdot sin(x)\space dx$$
2.) Using $u=cos (x)$, $v'=e^x (x)$, $u'=-sin(x)$ and $v=e^x$ gives:
$$\int e^x\cdot cos(x)\space dx=e^x\cdot cos(x)-\int -e^x\cdot sin(x)\space dx$$
$$\int e^x\cdot cos(x)\space dx=e^x\cdot cos(x)+\int e^x\cdot sin(x)\space dx$$
So I get:
$$e^x\cdot cos(x)-\int e^x\cdot sin(x)\space dx=e^x\cdot cos(x)+\int e^x\cdot sin(x)\space dx$$
Where have I gone wrong?
I wonder if there is a name for this.
We have \begin{align*} \int e^x\cos x\,dx&=e^{x}\sin x-\int e^{x}\sin x\,dx\tag 1\\ &=e^{x}\sin x-\left[-e^x\cos x-\int- e^x\cos x\,dx+C\right]\tag 2\\ &=e^x\sin x+e^x\cos x-\int e^x\cos x\,dx+C. \end{align*} where in $(1)$ I let $u = e^x, dv = \cos x$, and in $(2)$ I let $u = e^x, dv = \sin x$. Then adding $\int e^x\cos x\,dx$ to both sides and solving gives $$\int e^x\cos x\,dx = \frac{1}{2}\big[e^x\sin x+e^x\cos x+C\big].$$