$f(x)=\sin 2 x-x,-\frac{\pi}{2}<\leq x \leq \frac{\pi}{2}$
Given : $f(x)=\sin 2 x-x$
$\Rightarrow f^{\prime}(x)=2 \cos 2 x-1$
For a local maximum or a local minimum, we must have
$f^{\prime}(x)=0$
$\Rightarrow 2 \cos 2 x-1=0$
$\Rightarrow \cos 2 x=\frac{1}{2}$
$\Rightarrow x=\frac{-\pi}{6}$ or $\frac{\pi}{6}$
Since $f^{\prime}(x)$ changes from positive to negative when $x$ increases through $\frac{\pi}{6}, x=\frac{\pi}{6}$ is the point of local maxima.
The local maximum value of $f(x)$ at $x=\frac{\pi}{6}$ is given by
$\sin \left(\frac{\pi}{3}\right)-\frac{\pi}{6}=\frac{\sqrt{3}}{2}-\frac{\pi}{6}$
Since $f^{\prime}(x)$ changes from negative to positive when $x$ increases through $-\frac{\pi}{6}, x=-\frac{\pi}{6}$ is the point of local minima.
The local minimum value of $f(x)$ at $x=-\frac{\pi}{6}$ is given by
$\sin \left(\frac{-\pi}{3}\right)+\frac{\pi}{6}=\frac{\pi}{6}-\frac{\sqrt{3}}{2}$