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