If $\theta$ $\in \matrix{\left[\frac{-5\pi}{12},\frac{-\pi}{3}\right]}$ then find maximum value of:
Initally, I went on with calculating the derivative which came out to be:
$$\frac{\left(\sec^{2}\left(\theta+\frac{2\pi}{3}\right)-\sec^{2}\left(\theta+\frac{\pi}{6}\right)-\sin\left(\theta+\frac{\pi}{6}\right)\right)}{\sqrt{3}}$$
This seemed pretty hard to work with in order to equate it to 0 and then proceed with the general method of finding maxima/minima. So I thought maybe simplifying the given expression and then taking the derivative would make this more simple.
I came up with the following simplified version of it(the original expression given in the problem):
$$\tan\left(\theta+\frac{2\pi}{3}\right)=-\tan\left(\frac{\pi}{3}-\theta\right)$$
and $$\tan\left(\theta+\frac{\pi}{6}\right)=\cot\left(\frac{\pi}{3}-\theta\right)$$
and $$\cos\left(\theta+\frac{\pi}{6}\right)=\sin\left(\frac{\pi}{3}-\theta\right)$$
Hence, $$\frac{\left(-\left(\tan\left(\frac{\pi}{3}-\theta\right)+\cot\left(\frac{\pi}{3}-\theta\right)\right)+\sin\left(\frac{\pi}{3}-\theta\right)\right)}{\sqrt{3}}$$
getting the same argument in each trigonometric function, I thought, would help out. But I still can't really get something after differentiating it:
$$\frac{1}{\sqrt{3}}\left(\sec ^2\left(\frac{\pi }{3}-x\right)-\csc ^2\left(\frac{\pi }{3}-x\right)-\cos \left(\frac{\pi }{3}-x\right)\right)$$
I think this is just about rearranging the trigonometric terms but I'm not able to get to it, please help me out with this, or if there's any other method.

Forget about the $\sqrt{3}$. It obviously doesn't matter except for the final value of the extrema.
You then have for the derivative
$\begin{array}\\ g(x) &=-(\tan(\frac{\pi}{3}-x)+\cot(\frac{\pi}{3}-x))+\sin(\frac{\pi}{3}-x))\\ &=-(\tan(y)+\cot(y)+\sin(y)) \qquad y = \frac{\pi}{3}-x\\ &=-(\dfrac{\sin(y)}{\cos(y)}+\dfrac{\cos(y)}{\sin(y)}+\sin(y)) \qquad y = \frac{\pi}{3}-x\\ &=-(\dfrac{\sin^2(y)+\cos^2(y)}{\sin(y)\cos(y)}+\sin(y))\\ &=-(\dfrac{1+\sin^2(y)\cos(y)}{\sin(y)\cos(y)})\\ \end{array} $
Since $|\sin^2(y)\cos(y)| \le \dfrac{2}{3\sqrt{3}} \lt 1$, the derivative has no real root, so the function has its extrema at the endpoints.