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!.

I like to rewrite things  so as to reduce errors; as $\sin^4 x$  is even of small degree (as a polynomial in $\sin, \cos$), it can be written in terms of $\cos 2 x$ and $\cos 4x.$ After that the integral is immediate, finally we may wish to expand that back into a polynolial in sine and cosine.
First
$$ \cos 2x = 2 \cos^2 x - 1 = 1 - 2 \sin^2 x$$
Good start. Next $ \cos 4x = 2 \cos^2 2 x - 1 .$  However we know $ \cos 2x = 1 - 2 \sin^2 x$  and find $\cos^2 2x = 1 - 4 \sin^2 x + 4 \sin^4 x.$   Plug that into $ \cos 4x = 2 \cos^2 2 x - 1 ,$  I get
$$ \cos 4x = 8 \sin^4 x - 8 \sin^2 x + 1$$
Anyway, my calculations may be checked for themselves, before starting any calculus, and any necessary corrections made.
Again, I get
$$ \sin^4 x = \; \frac{1}{8} \; \left( \cos 4x - 4 \cos 2 x + 3 \right) = \frac{\cos 4x}{8} - \frac{\cos 2x}{2} + \frac{3}{8} $$
The integral...
$$ \int \sin^4 x dx = \frac{\sin 4x}{32} - \frac{\sin 2x}{4} + \frac{3x}{8} $$
I note that you did not combine the two $x$  terms in your last line
