<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] 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}
$$
</s>