<s>[INST] 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
 [/INST] HINT:
$$(s-a)(s-b)=\frac{ (-b^2-a^2+c^2+2 a b)}{4} $$
</s>