Stewart's Theorem

Theorem
Let $$a, b, c$$ be the sides of a triangle.

Let $$CP$$ be any cevian from $$C$$ to $$P$$.

Then:

$$a^2 \cdot AP+b^2 \cdot PB=CP^2 \cdot c+AP \cdot PB \cdot c$$



Proof
There are two cases to consider:


 * 1) When the cevian is an altitude, the result follows directly from the law of cosines on $$\triangle APC$$ and $$\triangle CPB$$.
 * 2) When the cevian is not an altitude, we proceed as follows.

We have that $$\angle APC < 90$$º and $$\angle BPC > 90$$º and $$\angle APC$$ ,$$\angle BPC$$ are supplementary.

Then we have:

$$ $$


 * We multiply the first by $$PB$$ and the second by $$AP$$:

$$b^2\cdot PB= AP^2\cdot PB+CP^2\cdot PB-2PB \cdot AP \cdot CP \cdot \cos(\angle APC) $$

$$a^2\cdot AP= PB^2\cdot AP+CP^2\cdot AP+2AP \cdot CP \cdot PB \cdot \cos(\angle APC)$$


 * Now we add the two equations:

$$ $$ $$