As another example, let us compute \(\int e^x \cos(x)\,dx\text{.}\) Let \(u = e^x\) and \(dv = \cos(x)\,dx\text{.}\) Then \(du = e^x\,dx\) and \(v = \sin(x)\text{.}\) Applying IBP yields:
\begin{equation*}
\int e^x \cos(x)\,dx = e^x\sin(x) - \int e^x \sin(x)\,dx.
\end{equation*}
At first glance, it seems we have made no progress since \(\int e^x \sin(x)\,dx\) appears as difficult as the original problem. However, applying IBP again to this new integral with \(u=e^x\) and \(dv = \sin(x)\,dx\) (so \(v = -\cos(x)\)), we get:
\begin{equation*}
\int e^x \sin(x)\,dx = -e^x \cos(x) + \int e^x \cos(x)\,dx.
\end{equation*}
For simplicity, let \(I_c = \int e^x \cos(x)\,dx\) and \(I_s = \int e^x \sin(x)\,dx\text{.}\) The equations above become:
\begin{equation*}
\begin{cases}
I_c &= e^x \sin(x) - I_s \\
I_s &= -e^x \cos(x) + I_c
\end{cases}
\end{equation*}
Substituting the second equation into the first:
\begin{align*}
I_c &= e^x \sin(x) - (-e^x \cos(x) + I_c)\\
I_c &= e^x \sin(x) + e^x \cos(x) - I_c\\
2I_c &= e^x(\sin(x) + \cos(x))
\end{align*}
Solving for \(I_c\) (and similarly for \(I_s\)), we find:
\begin{equation*}
I_c = \frac{e^x}{2}(\sin(x) + \cos(x)) + C, \quad I_s = \frac{e^x}{2}(\sin(x) - \cos(x)) + C.
\end{equation*}