Here, it turns out that we could choose either
\(u\) or
\(dv\) to be
\(e^x\) or
\(\sin x\text{,}\) and both would work. This is because the derivative and integral of
\(e^x\) is
\(e^x\text{,}\) and the derivative and integral of
\(\sin x\) is
\(\cos{x}\) or
\(-\cos x\text{,}\) so both of them are basically the same in terms of complexity. In this case, we will choose
\(u = e^x\) and
\(dv = \sin x \,dx\text{.}\) Then,
| \(u = e^x\) |
\(v = -\cos x\) |
| \(\big\downarrow\) |
\(\big\uparrow\) |
| \(du = e^x \,dx\) |
\(dv = \sin x \,dx\) |
\begin{align*}
\int e^x \sin x \,dx \amp= -\underbrace{e^x}_{u} \underbrace{\cos x}_{v} - \int -\underbrace{e^x}_{u} \underbrace{\cos x}_{v} \,dx\\
\amp= -e^x \cos x + \int e^x \cos x \,dx
\end{align*}
The second integral is similar to the first except that it has
\(\cos x\) instead of
\(\sin x\text{.}\) To evaluate it, we use IBP again,
| \(u = e^x\) |
\(v = \sin x\) |
| \(\big\downarrow\) |
\(\big\uparrow\) |
| \(du = e^x \,dx\) |
\(dv = \cos x \,dx\) |
\begin{align*}
\int e^x \sin x \,dx \amp= -e^x \cos x + \brac{\underbrace{e^x}_{u} \underbrace{\sin x}_{v} - \int \underbrace{e^x}_{u} \underbrace{\sin x}_{v} \,dx}\\
\amp= e^x \sin x - e^x \cos x - \int e^x \sin x \,dx
\end{align*}
The resulting integral is actually the same as the original integral we started with. This means that, like an equation, we can add the integral to both sides, and “collect” them together as like terms on the left-hand side,
\begin{align*}
\int e^x \sin x \,dx \amp= e^x \sin x - e^x \cos x - \int e^x \sin x \,dx\\
2 \int e^x \sin x \,dx \amp= e^x \sin x - e^x \cos x
\end{align*}
Then, to solve for the desired integral, divide both sides by 2, and also finally add the constant of integration,
\begin{equation*}
\int e^x \sin x \,dx = \frac{1}{2} e^x \sin x - \frac{1}{2} e^x \cos x + C
\end{equation*}