<s>[INST] 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!.
 [/INST] To answer the first discrepancy with the textbook, note that
$$\left( \frac{1 - \cos(2x)}{2} \right)^2
= \frac{1- 2 \cos(2x) + \cos^2(2x)}{4}$$
Hence the middle term indeed has a factor of $-1/2$.
Textbooks are just as prone to errors as anything else, being made by humans; it happens. Not much one can do but contact the authors (after doing one's due diligence as you are!).

For the rest of the computations, note that in claiming
$$\int \cos^2(2x) \, \mathrm{d}x
= \int \frac{1 - \cos(4x)}{2} \, \mathrm{d}x$$
you used the identity for $\sin^2(x)$, not $\cos^2(x)$. This should be a $+$, not a $-$.
Your subsequent step then has $\int \cos(x) \, \mathrm{d}x = - \sin(x)+C$, in its essence, when it should be positive.
My guess is you thought about the $\cos^2(x)$ identity the entire time but wrote the middle step with a typo.
Aside from this, as ever, you need a constant of integration in your final answer (a $+C$).
</s>