<s>[INST] Chain rule to differentiate $\sin ^2\frac{x}{2}$ I have this equation $$\sin ^2(\frac{x}{2})$$
Using the chain rule $
M'(N(x)).N'(x)$:
$$\begin{align*}
&M= (\sin \frac{x}{2})^2 \\
&N= \frac{x}{2}\end{align*}$$
That makes
$$2\sin \frac{x}{2}*\frac{1}{2}$$ or $$\sin \frac{x}{2}$$
Going again, we should have 
$$\frac{1}{2} \cos \frac{x}{2}$$ or $$\frac{\cos \frac{x}{2}}{2}$$
Yet solution is giving me
$$(\sin \frac{x}{2})(\cos \frac{x}{2})$$
Why...?
 [/INST] Note: $\frac{d}{dx}$ and $'$ denote the derivative.
$$y=\sin^2\left(\frac{x}{2}\right)=\left(\sin\frac{x}{2}\right)^2$$
I will refer to $2$ as my power, $\sin$ as my expression, and $x/2$ as my angle. Basically, we are using chain rule twice.
Chain rule says we'll get power times expression to power minus one times derivative of expression times derivative of expression. Generally this:
$$2(\exp)^1(\exp')$$
For your problem
$$y'=2\left(\sin\frac{x}{2}\right)^1\cdot\left(\frac{d}{dx}\sin\left(\frac{x}{2}\right)\right)$$
Now, for taking the derivative of $\sin\frac{x}{2}$, we use chain rule again. Generally, it's derivative of angle times derivative of expression of angle, or this:
$$\text{ang}'\cdot \exp'(\text{ang})$$
For you
$$\frac{d}{dx}\sin\frac{x}{2}=\frac{1}{2}\cos\frac{x}{2}$$
Putting it all together:
$$y'=2\left(\sin\frac{x}{2}\right)^1\left(\frac{1}{2}\cos\frac{x}{2}\right)$$
Cancelling $2$ and $1/2$:
$$y'=\sin\frac{x}{2}\cdot\cos\frac{x}{2}$$
Using double ange formula for sine:
$$y'=\frac{1}{2}\sin x$$
</s>