2. Let $f(x)=x+\cot(x/2),\quad x\in\left[\frac\pi3,\frac{2\pi}3\right]$.
(a) Find all the critical numbers in the domain.
(b) Find the absolute maximum value and minimum value.
Solution: (a) $f'(x)=1-\frac1{2\sin^2(x/2)}=0,\Rightarrow\sin(x/2)=\pm\frac1{\sqrt2}$
It has only one solution $x=\frac\pi2$ in $\left[\frac\pi3,\frac{2\pi}3\right]$.
(b) Note that $f\left(\frac\pi2\right)=\frac\pi2+1,f\left(\frac\pi3\right)=\frac\pi3+\sqrt3,f\left(\frac{2\pi}3\right)=\frac{2\pi}3+1/\sqrt3$. Therefore,
Thus $f\left(\frac\pi3\right)=\frac\pi3+\sqrt3$ is the absolute maximum, $f\left(\frac\pi2\right)=\frac\pi2+1$ is the absolute minimum.
Can anyone help me out solving this? I don't understand how my professor ends up with $ 1 - \frac{1}{2\sin^2(x/2)} $