<s>[INST] Solve $\sin 2x=-\cos x$ I'm working on solving the problem  $\sin(2x)=-\cos(x)$ but I got stuck.
I got the following:
$\sin 2x=-\cos x \Leftrightarrow \sin 2x=\cos(x+\pi )\Leftrightarrow \sin 2x=\sin\left(\frac{\pi }{2}-(x+\pi)\right)\Leftrightarrow  \sin 2x= \sin\left(-\frac{\pi }{2}-x\right)$
then I did
$2x =-\frac{\pi }{2}-x +2\pi k \Leftrightarrow 3x=\frac{\pi }{2} +2\pi k\Leftrightarrow x_1=\frac{\pi }{6}+\frac{2\pi}{3} k\ $
$2x =\pi -(-\frac{\pi }{2}-x) +2\pi k \Leftrightarrow x_2=\frac{3\pi}{2}+2\pi k$
None of these answers are correct.
 The correct answer is $x=\frac{\pi}{2}+k\pi$ and $x=-\frac{\pi}{2}\pm\frac{\pi}{3}+2 k\pi$
I don't know what I'm doing wrong in my attempt.
 [/INST] $$\sin 2x = -\cos x $$ 
$$2\sin x\cos x = -\cos x$$ 
$$2\sin x\cos x  + cos x= 0$$ 
$$\cos x (2\sin x + 1) = 0$$ 
$$\cos x = 0  \text{  or  }  \sin x = -\frac{1}{2}$$
$$x = (2n + 1)\frac{\pi}{2}  \text{  or  }  x = m\pi + (-1)^{m+1}\frac{\pi}{6}$$ 
where $m,n\in\Bbb Z$
</s>