Help with finding tangent to curve at a point 
Find an equation for the tangent to the curve at $P\left( \dfrac{\pi}{2},3 \right )$ and the horizontal tangent to the curve at $Q.$ 
  $$y=5+\cot x-2\csc x$$

$y\prime=-\csc ^2 x -2(-\csc x \cot x)$
$y\prime= 2\csc x \cot x - \csc ^2 x\implies$ This is the equation of the slope.  
Now I find the slope at $x=\dfrac{\pi}{2}:$
$$y^{\prime}=2\csc \left( \frac{\pi}{2} \right) \cot \left( \frac{\pi}{2} \right)- \csc ^2 \left( \frac{\pi}{2} \right)$$ $$y^{\prime}= -1$$ 
Equation for the tangent to the curve at $P$:
$$y-3=-1\left( x-\frac{\pi}{2} \right)$$ $$y=-x+\frac{6+\pi}{2}$$ 
Then I found the horizontal tangent at $Q$, which is where the slope is $0.$ So I set the slope equation equal to $0:$ 
$$y^{\prime}= 2\csc x \cot x - \csc ^2 x=0$$ $$-\csc ^2 x = -2\csc x \cot x$$ 
$$-\frac{1}{\sin^2 x}=-2\left( \frac{1}{\sin x} \frac{\cos x}{\sin x} \right )$$ 
$$\cos x = \frac{1}{2}$$

I don't know how to proceed from here. Since $\cos x = \dfrac{1}{2}$, $\cos^{-1}\left (\dfrac{1}{2}\right)=\dfrac{\pi}{3}$.
Plugging this into the equation would give the $y$ value, and I'd be able to find the equation of the tangent line, but I'm confused because there is not just one $x$ to consider, since $x=2n \pm \dfrac{\pi}{3}$. 
The answer for equation of tangent at $Q$ is $y=5-\sqrt{3}$, and I don't know how to get this. 
Can you please show how to work this last part in details? Thank you. 

I think what's you need is to consider $$\sin(2k \pi-\alpha)=-\sin(\alpha),~~~\sin(2k \pi+\alpha)=\sin(\alpha)\\ \cot(2k \pi-\alpha)=-\cot(\alpha),~~~\cot(2k \pi+\alpha)=\cot(\alpha)$$
