<s>[INST] How to evaluate the integral $\int e^{2x} \sin^2x\ dx$ How can I evaluate the following integral?
$$\int e^{2x} \sin^2x\ dx$$
 [/INST] Here are the steps
\[
\int e^{2x}\sin^{2} x\ dx=\frac{1}{2}\int e^{2x}(1-\cos(2x))\ dx
\]
Let $u=2x$
\[
\frac{d}{dx}u=2\Rightarrow du=2\ dx \Rightarrow \frac{1}{2}du=dx
\]
Then
\[
\frac{1}{2}\int e^{2x}(1-\cos(2x))\ dx= \frac{1}{4}\int e^{u}(1-\cos u)\ du = \frac{1}{4}\int e^{u}-e^{u}\cos u\ du
\]
\[
= \frac{1}{4}\int e^{u}\ du- \frac{1}{4}\int e^{u}\cos u\ du= \frac{1}{4}e^{u}- \frac{1}{8}e^{u}(\sin u+\cos u) +C
\]
\[
=\frac{2}{8}e^{u}- \frac{1}{8}e^{u}(\sin u+\cos u) +C=-\frac{1}{8}e^{2x}(\sin(2x)+\cos(2x)-2)+C
\]
Thus
\[
\int e^{2x}\sin^{2} x\ dx =-\frac{1}{8}e^{2x}(\sin(2x)+\cos(2x)-2)+C
\]
</s>