Find $\int \sin^4x dx$ In my textbook, I came upon the following problem:
Problem: Find  $\int \sin^4x dx$
Since there was only given a solution sketch and I came to a different conclusion in one step, I ask if my following solution is correct.
Solution: In my solution, I use the following identities:
$$\sin^2x = \frac{1-\cos2x}{2} \tag{1} \label{1}$$
$$\cos^2x = \frac{1+\cos2x}{2} \tag{2} \label{2}$$
Now we can write
$$\int \sin^4x dx = \int \left( \frac{1-\cos2x}{2} \right)^2 dx = \int\frac{1}{4}dx - \frac{1}{2}\int \cos2xdx + \frac{1}{4} \int cos^22xdx$$
My textbook gave the last term in this equation as $\int\frac{1}{4}dx - \int \cos2xdx + \frac{1}{4} \int cos^22xdx$. But, since $(1-\cos2x)^2 = 1 - 2\cos2x + \cos^22x$ the middle integral should simplify to $- \frac{1}{2}\int \cos2xdx$. Is this correct? If not, how do we come to the conclusion of $-\int \cos2xdx$?
To complete the integration, we have
$$\int \frac{1}{4} dx = \frac{x}{4}$$
$$ - \frac{1}{2} \int \cos 2xdx = - \frac{1}{4}\int \cos u du = - \frac{1}{4} \sin2x = - \frac{\sin2x}{4}$$
and
$$\frac{1}{4} \int cos^22xdx = \frac{1}{4} \int \frac{1 + cos4x}{2}dx = \frac{4x + \sin 4x}{32}$$
so
$$\int \sin^4x dx = \frac{x}{4} - \frac{\sin2x}{4} + \frac{4x + \sin 4x}{32}$$
Are these conclusions and computations correct? Thanks for any help!
EDIT: According to the correction of @Eevee Trainer I now use the correct identity $\cos^2x = \frac{1+\cos2x}{2}$. The rest of the computation should be correct. Thanks all for your help and comments!.

An alternative approach: A complex variable identity reduces the problem to an exercise in the Binomial Theorem.
$$\begin{align}
\sin^4 x &= \left( \frac{1}{2i} (e^{ix}-e^{-ix})\right)^4 \\
&= \frac{1}{16} \left( e^{4ix} -4 e^{2ix} +6 -4 e^{-2ix} + e^{-4ix} \right)
\end{align}$$
so
$$\begin{align}
\int \sin^4 x \;dx &= \frac{1}{16} \left( \frac{1}{4i} e^{4ix} - \frac{4}{2i} e^{2ix} + 6x + \frac{4}{2i} e^{2ix} - \frac{1}{4i} e^{4ix} \right) + C \\
&= \frac{1}{16} \left( \frac{1}{4i} (e^{4ix}-e^{-4ix}) -\frac{4}{2i}(e^{2ix}-e^{-2ix}) +6x \right) + C \\
&=\frac{1}{16} \left( \frac{1}{2} \sin 4x -4 \sin 2x +6x \right) + C \\
&= \frac{1}{32} \sin 4x -\frac{1}{4} \sin 2x +\frac{3}{8} x + C
\end{align}$$
