Find all possible values of $x$ if $\frac{\sin\frac{x}{2}+\cos\frac{x}{2}-i\tan x}{1+2i\sin\frac{x}{2}}$ is real 
If the expression $\dfrac{\sin\frac{x}{2}+\cos\frac{x}{2}-i\tan x}{1+2i\sin\frac{x}{2}}$ is real, find the set of all possible values of $x$.

My Attempt
$$
-\tan x-2\sin^2\frac{x}{2}-2\sin\frac{x}{2}\cos\frac{x}{2}=0\\
\frac{2\sin\frac{x}{2}\cos\frac{x}{2}}{\cos x}+2\sin^2\frac{x}{2}+2\sin\frac{x}{2}\cos\frac{x}{2}=0\\
\sin\frac{x}{2}=0\text{ or }\frac{\cos\frac{x}{2}}{\cos x}+\sin\frac{x}{2}+\cos\frac{x}{2}=0\\
\frac{x}{2}=n\pi\text{ or }\cos\frac{x}{2}+\sin\frac{x}{2}.\cos x+\cos\frac{x}{2}.\cos x=0\\
\boxed{x=2n\pi}\text{ or _____________}
$$
My reference gives the solution $x=2n\pi$, but what about the other remaining expression ?
 A: The second expression $\cos \frac{x}{2} +\sin \frac{x}{2}\cos x+\cos \frac{x}{2}\cos x=0$ reduces to :
$$\cos \frac{x}{2} + \cos x(\sin \frac{x}{2}+ \cos \frac{x}{2})=0$$
$$\cos \frac{x}{2} = -\cos x(\sin \frac{x}{2}+ \cos \frac{x}{2})$$
$$\cos x = -\frac{1}{1+\tan \frac{x}{2}}$$
Apply the half angle formula for  $$\cos x = \frac {1- \tan^2 \frac{x}{2}}{1+ \tan^2 \frac{x}{2}}=-\frac{1}{1+\tan \frac{x}{2}} $$
Now put $\tan \frac{x}{2} = t$ to get:
$$\frac {1- t^2 }{1+ t^2 }=-\frac{1}{1+t}$$
$$1+t-t^2-t^3=-1-t^2$$
$$t^3-t-2=0$$
Solve the equation to get the value for $\tan \frac{x}{2}$ 
You will get the other angle. Hope this helps .....
A: You are right: there are more solutions. Actually, there is exactly one more solution in $(0,2\pi)$. Note that\begin{align}-\tan x-2\sin^2\frac{x}{2}-2\sin\frac{x}{2}\cos\frac{x}{2}=0&\iff-\tan x-1+1-2\sin^2\left(\frac x2\right)-2\sin x=0\\&\iff-\tan x-1+\cos x-\sin x.\end{align}Now, let $c=\cos x$ and let $s=\sin x$. Then$$\left\{\begin{array}{l}c^2+s^2=1\\-\dfrac sc-1+c-s=0\end{array}\right.$$Solving this system leads you to a quartic. It has a trivial solution ($(c,s)=(1,0)$) and a single real non-trivial solution: $(c,s)\simeq(-0.396608,0.917988)$. This corresponds to taking $x\simeq1.97861$.
