Prove $\tan(\frac{x}{2}) = \frac{\sin x}{1 + \cos x} $ using the quadratic formula I am trying to prove the fact that $\tan \frac{x}{2} = \frac{1-\cos x}{\sin x}$ or alternatively $\tan \frac{x}{2} = \frac{1- \cos x}{\sin x}$.  (I understand that it can be proved using the half-angle identities of $\sin$ and $\cos$ but I want to understand how to get to the solution from this specific method of derivation.)
\begin{align*}
    \tan(2x) &= \frac{2\tan(x)}{1-\tan(x)^2} \\
    \tan(x) &= \frac{2\tan(\frac{x}{2})}{1-\tan(\frac{x}{2})^2} \\
\end{align*}
I now let $A=\tan x$ and $B=\tan \frac{x}{2}$
\begin{align*}
    A\cdot(1-B^2) &= 2B\\
    AB^2+2B-A &= 0 \\
\end{align*}
Now I solve for B using the quadratic formula.
\begin{align*}
    B &= \frac{-2\pm \sqrt{4+4A^2}}{2A} \\
    B &= \frac{-1\pm \sqrt{1+A^2}}{A} \\
    \tan(\frac{x}{2}) &= \frac{-1\pm \sqrt{1+\tan(x)^2}}{\tan(x)}\\
    \tan(\frac{x}{2}) &= \frac{-1\pm \sqrt{(\sec x)^2}}{\tan(x)}\\
    \tan(\frac{x}{2}) &= \frac{-1\pm |\sec x|}{\tan(x)}
\end{align*}
I am confused as to how to continue at this point (firstly, not sure how to deal with the absolute value, and secondly not sure how to deal with the plus-minus).
Any help is greatly appreciated, as I feel like I do not fully understand how to manipulate absolute values and the meaning of the plus-minus.
 A: The quadratic formula alone won't help you obviate the $\pm$ sign. It's better to note $\sin x=\frac{2t}{1+t^2}$ ($t$ is more common notation than $B$) while $\cos x=\frac{1-t^2}{1+t^2}$, so $\frac{\sin x}{1+\cos x}=t$. Alternatively, $$\frac{\sin x}{1+\cos x}=\frac{2\sin\frac{x}{2}\cos\frac{x}{2}}{2\cos^2\frac{x}{2}}=t.$$
A: Hint. Note that $\pm|x|=\pm x,$ without loss of any generality. Then split into two cases.
A: Because of the $\pm$, the absolute value is superfluous.
$\begin{align}
   B &= \frac{-1\pm |\sec x|}{\tan x} \\
   B &= \frac{-1\pm \sec x}{\tan x} \\
   B &= \frac{(-1\pm \sec x)(\cos x)}{(\tan x)(\cos x)} \\
   B &= \frac{-\cos x\pm 1}{\sin x} \\
\end{align}$
We know that $\dfrac{1 - \cos x}{\sin x} = \tan \dfrac x2$ 
Also
$\begin{align}
   \dfrac{-1 - \cos x}{\sin x}
      &= -\dfrac{1 + \cos x}{\sin x}\\
      &= -\dfrac{1 + (2 \cos^2 \frac x2 - 1))}
                {2 \sin \frac x2 \cdot \cos \frac x2} \\
     &= - \cot \frac x2
\end{align}$
So the roots of the quadratic $AB^2 + 2B -A = 0$ are $B = \tan \frac x2$ 
and $B =-\cot \frac x2$.
That is to say
$$\tan x \cdot \left(\tan \frac x2\right)^2 + 2\tan \frac x2 - \tan x = 0$$
and 
$$\tan x \cdot \left(-\cot \frac x2\right)^2 - 2\cot \frac x2 - \tan x = 0$$
