Given $\triangle ABC$, we have$$c=a\cos B+b\cos A\tag{1}$$
Where $a=BC$, $b=AC$ and $c=AB$.
Question: How do you prove the relation?
I started with$$\begin{align*} & CD=a\cos B\\ & CD=b\cos A\end{align*}$$ So adding them up gives$$2CD=a\cos B+b\cos A$$However, what's confusing is how $2CD=c$ for the equation $(1)$ to hold.
$1$" />
You are mistaken. We have $$\begin{align*} & CD=a\sin B\\ & CD=b\sin A\end{align*}$$
Please review the definition of the trigonometric functions, as provided in this link, to see why this is so.
This is why you're not getting an answer. To prove the property, we use $$\begin{align*} & BD=a\cos B\\ & AD=b\cos A\end{align*}$$ In the diagram provided. Adding the two, we have $$c=a\cos B+b\cos A$$