<s>[INST] Proving a Triangle relationship $1$" />
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.
 [/INST] Using the Law of cosines : $c=a\cos B+b\cos A \Leftrightarrow c=a \frac {a^2 + c^2 - b^2}{2 ac}+b\frac {b^2 + c^2 -a^2}{2bc} \Leftrightarrow 2c^2=2c^2$
</s>