Proof of trigonometric relationship of angle bisector I have to prove the following equation:
$$CD=\frac{2ab\cos\frac{C}{2}}{a+b}$$ where $CD$ is the angle bisector of $C$ in $\Delta ABC  $.
My attempt:
I've started by rearranging the equation in terms of $\cos \frac{C}{2}$ ,then by squaring and subtracting $\sin^2 \frac{C}{2}$ from both sides, yielding thus:
$$\cos^2 \frac{C}{2}-sin^2\frac{C}{2} =\frac{(a+b)^2 \cdot CD^2}{(2ab)^2}-  \ \sin^2\frac{C}{2}\tag{1}$$
$$\cos C  =\frac{(a+b)^2 \cdot CD^2}{(2ab)^2} - \frac{(s-a)(s-b)}{ab}\tag{2}$$
Now i express $ \cos C $ in terms of $a,b,c$ ,then I simplify by multiplying for $ab$ both sides and I multiply out $(s-a)(s-b)$ , getting now:
$$2(b^2+a^2-c^2)=\frac{(a+b)^2 \cdot CD^2}{4ab}-(ab+bc-b^2+c^2-a^2)\tag{3}$$
By simplifying this and rearranging for $CD^2$ I get:
$$CD^2=\frac{(a^2+b^2-c^2 +ab+ bc)(ab)}{(a+b)^2}\tag{4}$$
Finally by replacing $CD^2=ab-(abc^2)/(a+b)^2\tag{5}$ 
and doing all the algebraic manipulation i get the final result that
$a+c=2a$ which is clearly wrong...And here i am asking for humble help on math.stackexchange
 A: Drop perpendiculars $AF$ and $BE$ onto $CD$.

By the definition of cosine,
$$
\left|CF\right|=b\cos(C/2)\quad\text{and}\quad\left|CE\right|=a\cos(C/2)\tag{1}
$$
Since $\triangle AFC\sim\triangle BEC$ and $\triangle AFD\sim\triangle BED$, we get
$$
\frac{\left|CD\right|-\left|CE\right|}{\left|CF\right|-\left|CD\right|}=\frac{\left|DE\right|}{\left|DF\right|}=\frac{\left|BE\right|}{\left|AF\right|}=\frac ab\tag{2}
$$
Solving $(2)$ for $\left|CD\right|$ gives
$$
\left|CD\right|=\frac{a\left|CF\right|+b\left|CE\right|}{a+b}\tag{3}
$$
Applying $(1)$ to $(3)$ yields
$$
\left|CD\right|=\frac{2ab\cos(C/2)}{a+b}\tag{4}
$$
A: Just use the law of sines; call $\gamma=2\delta$ the angle in $C$, $\alpha$ the angle in $A$, $\beta$ the angle in $B$. Also let $a=BC$, $b=AC$, $c=AB$. Finally, let $R$ be the radius of the circumscribed circle to $ABC$. The law of sines for $ABC$ says that
$$
a=2R\sin\alpha,\quad
b=2R\sin\beta,\quad
c=2R\sin\gamma
$$
whereas, calling $s$ the bisector to be found, the law of sines says
$$
\frac{s}{\sin\alpha}=\frac{AD}{\sin\delta},\quad
\frac{s}{\sin\beta}=\frac{DB}{\sin\delta}
$$
so
$$
c=AD+DB=
s\sin\delta\left(\frac{1}{\sin\alpha}+\frac{1}{\sin\beta}\right)=
s\sin\delta\left(\frac{2R}{a}+\frac{2R}{b}\right)
$$
Therefore
$$
2R\sin\gamma=s\sin\delta\left(\frac{2R}{a}+\frac{2R}{b}\right)
$$
and, since $\sin\gamma=2\sin\delta\cos\delta$,
$$
2\cos\delta=s\left(\frac{1}{a}+\frac{1}{b}\right)
$$
and the relation
$$
s=\frac{2ab\cos\delta}{a+b}
$$
follows immediately.
Note that the above relations with $AD$ and $DB$ also prove a theorem of elementary geometry
$$
\frac{AD}{DB}=\frac{\sin\beta}{\sin\alpha}=\frac{a}{b}
$$
(the second equality follows from the law of sines).
A: HINT:
$$(s-a)(s-b)=\frac{ (-b^2-a^2+c^2+2 a b)}{4} $$
