Example 5. Find $\int e^{x} \sin x d x$.
Solution. Let

$$
u=e^{x}, d v=\sin x d x
$$

from this

$$
d u=e^{x} d x, v=-\cos x
$$

Applying formula (4.18), we get

$$
\begin{gathered}
\int e^{x} \sin x d x=e^{x}(-\cos x)-\int(-\cos x) e^{x} d x= \\
=-e^{x} \cos x+\int e^{x} \cos x d x
\end{gathered}
$$

To the integral on the right side, we again apply the integration by parts formula, without explicitly introducing $u$ and $v$. We have

$$
\int e^{x} \cos x d x=\int e^{x} d(\sin x)=e^{x} \sin x-\int e^{x} \sin x d x
$$

Substituting the found expression into formula (B), we get

$$
\begin{gathered}
\int e^{x} \sin x d x=-e^{x} \cos x+\int e^{x} \cos x d x=-e^{x} \cos x+e^{x} \sin x- \\
-\int e^{x} \sin x d x \\
\int e^{x} \sin x d x+\int e^{x} \sin x d x=e^{x} \sin x-e^{x} \cos x
\end{gathered}
$$

from which

$$
2 \int e^{x} \sin x d x=e^{x}(\sin x-\cos x)
$$

Therefore,

$$
\int e^{x} \sin x d x=\frac{e^{x}}{2}(\sin x-\cos x)+C
$$