|  | 
 Stewart's theorem is a nice extension of the Pythagorean lemma.
 Please see the next picture:
 
  
 The triangle has sides a,b and c.
 Point D splits line AB in parts c1 and c2.
 AE = p, CD = x
 
 We find a calculation for x  given lengths a, b, c, c1 and c2.
 
 Pythagoras lemma in ΔEDC
 
       h2 = x2 - (c1 - p)2.........1)
 Pythagoras lemma in ΔAEC 
       h2 = b2 - p2...................2)
 ...1) en ...2) combined: 
      x2 - c12 + 2.c1.p - p2 = b2 - p2Pythagoras lemma in DEBCx2 = b2 + c12 - 2.c1.p......................3)
 
      h2 = a2 - (c - p)2.................4)
 ...2) and ...4) combined: 
      a2 - c2 +2c.p - p2 = b2 - p2...3) and ...5) combined:a2 = b2 + c2 - 2c.p...............5)
 
        x2 = b2 + c12 - 2.c1.p ........................x c.........6)  - .......7) yields:a2 = b2 + c2 - 2c.p.............................x c1
 
 c.x2 = c.b2 + c.c12 - 2.c.c1.p.........................6)
 c1.a2 = c1.b2 + c1.c2 - 2c1c.p........................7)
 
 
 
       c.x2 - c1.a2 = c.b2 +  c.c12 - c1.b2 - c1.c2This is Stewart's theorem.c.x2 - c1.a2 = b2(c - c1) - c.c1(c - c1)
 c.x2 = c1.a2 + c2b2 - c.c1.c2
 
 This theorem may be applied for the bisector or median of a triangle:
 If x is a median:
 
      x2 = 1/2 a2 + 1/2 b2 - 1/4 c2
If x is bisector:   |  |