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 we take \(v = \sin(x)\text{.}\) So IBP yields,
\begin{equation*}
\int e^x \cos(x)
dx = e^x\sin(x) - \int e^x \sin(x)dx.
\end{equation*}
At the first glance, we are getting nowhere since computing \(\int e^x
\sin(x) dx\) is as hard as the original problem. However, applying IBP once more time with \(u=e^x\) and \(dv = \sin(x)\text{,}\) we get
\begin{equation*}
\int e^x \sin(x)dx = -e^x \cos(x) +
\int e^x \cos(x)dx
\end{equation*}
For simplicity in notation, denote the integrals \(\int e^x \cos(x)
dx\) and \(\int e^x \sin(x) dx \) by \(I_c\) and \(I_s\text{,}\) respectively. Then the two equation 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*}
Solving for \(I_c\) and \(I_s\) from them, get us
\begin{equation*}
I_c = \frac{e^x}{2}(\sin(x) + \cos(x)) + C,\ I_s =
\frac{e^x}{2}(\sin(x) - \cos(x)) + C.
\end{equation*}