Stewart's Theorem Calculator

Find the cevian length in a triangle from the two sides and the two parts of the opposite side.

Math and PercentUpdated 2026-11-184 min read
Stewart's Theorem Calculator
Cevian length AD
...
Base BC, m + n...
Cevian length squared...
b squared times m plus c squared times n...
a times (d squared plus mn)...

What it does

Stewart's theorem connects the length of a cevian to the lengths of the sides of a triangle. A cevian runs from a vertex to a point on the opposite side, and the theorem gives one equation that covers medians, altitudes, angle bisectors and every other such segment. The University of Glasgow geometry notes write it as a(d squared + mn) = m b squared + n c squared when D lies between B and C.

The statement uses six lengths in a small, fixed pattern. The side BC is called a and is split into BD = m and DC = n, so a = m + n. The other sides are AB = c and AC = b, and the cevian is AD = d. Pairing matters: m multiplies the square of b, and n multiplies the square of c. Swap the two pieces of the base and the answer changes.

The result can be rearranged to solve for the cevian directly. Divide both sides by a and subtract mn, then take a square root. That is what this page does. It also prints both sides of the original equation, so you can see that the identity balances at the end rather than trusting a single displayed number.

A good way to read the output is to compare the cevian with special cases. If m equals n the cevian is a median and the formula becomes Apollonius' theorem. If the computed angles at D are right angles the cevian is an altitude. The 13, 14, 15 example used as the default lands exactly on that altitude case.

The tool works with unitless lengths. Any consistent unit will do, since every term is a length and the formula only uses squares and products. Mixed units must be converted before you enter the four numbers.

How to use

  1. Draw the triangle and label the vertex A at the top and the base BC at the bottom.
  2. Mark where the cevian meets the base as D, then measure BD and DC.
  3. Enter AC as side b and AB as side c. These are the two sides that meet at A.
  4. Enter BD as m and DC as n. Keep the order, because the formula pairs m with b and n with c.
  5. Read the cevian length from the first result, then check that the two sides of the Stewart equation match.
  6. Change one input to compare a median, an altitude and an angle bisector in the same triangle.

Formula

b squared times m + c squared times n = a times (d squared + mn), where a = m + n. Solved for the cevian: d = square root of ((b squared m + c squared n)/a minus mn). All lengths in the same unit.
a
The full base BC, equal to m + n.
b
The side AC, which ends at C next to segment n.
c
The side AB, which ends at B next to segment m.
m
The piece BD of the base, measured from B to the foot of the cevian.
n
The piece DC of the base, measured from the foot to C.
d
The length of the cevian AD.

The version shown assumes D lies between B and C. If D falls on an extension of the base, the segments must be given signs and the product mn changes sign. The tool accepts only positive segment lengths, so it covers the interior case. The equation follows from applying the cosine rule in the two small triangles and using the fact that the angles at D add to 180 degrees.

Worked example

Example: a 13, 14, 15 triangle with the base split 9 and 5

Defaults: b = 13, c = 15, m = 9 and n = 5. The base is 14 units long.

  1. Add the base pieces: a = m + n = 9 + 5 = 14.
  2. Square the sides and multiply: b squared times m = 169 times 9 = 1521, and c squared times n = 225 times 5 = 1125.
  3. Add them: 1521 + 1125 = 2646.
  4. Divide by a: 2646 / 14 = 189.
  5. Subtract mn: 189 minus 45 = 144, so d squared = 144.
  6. Take the square root: d = 12.
  7. Check the right side: 14 times (144 + 45) = 14 times 189 = 2646, which matches the left side. The tool shows a cevian of 12 and a base of 14.

Reference table

Three cevians from A in the same 13, 14, 15 triangle with base 14
Cevian typem, nCevian length
Altitude to the base9, 512
Median to the base7, 712.1655
Angle bisector from A7.5, 6.512.0934

Limits

  • Handles only a foot D that lies between B and C, so an exterior cevian needs a signed version of the formula.
  • Assumes the four lengths describe a real triangle, and checks that the computed angles at D fit before showing a result.
  • Treats every input as a plain length, so it cannot account for thickness, curvature or three dimensional geometry.
  • Caps each entry at 10,000,000 units to keep the arithmetic stable.

Common mistakes

  • Pairing m with c and n with b. The correct pairing is b squared times m plus c squared times n.
  • Forgetting that the base a is the sum of m and n, not a separate length you can choose freely.
  • Adding mn instead of subtracting it after dividing by a when solving for the cevian.
  • Entering the two base pieces in the wrong order, which swaps a median into a different cevian.
  • Mixing units between the sides and the base pieces, which makes every term in the equation inconsistent.

Try it yourself

Quick checks. Answers sit tucked under each question.

In the default triangle, what cevian length comes from m = 9 and n = 5?

The left side is 169 x 9 + 225 x 5 = 2646, so d squared is 2646 / 14 minus 45 = 144 and the cevian is 12.

What is the median to the base of that same triangle?

With m = n = 7, d squared is (169 x 7 + 225 x 7) / 14 minus 49 = 197 minus 49 = 148, so the median is 12.1655.

An isosceles triangle has b = 10, c = 10, m = 6 and n = 6. How long is the cevian?

The left side is 100 x 6 + 100 x 6 = 1200, divided by 12 gives 100, and 100 minus 36 is 64, so the cevian is 8.

Questions

What is a cevian?

A line segment from a vertex of a triangle to a point on the opposite side. Medians, altitudes and angle bisectors are all special cevians.

Do I need to enter the third side separately?

No. The base a is the sum of the two pieces m and n, so entering both pieces fixes the base.

Why does the theorem use squared lengths?

The proof applies the cosine rule twice. The cosine terms cancel when the two angles at the foot are added, leaving only squares and products of lengths.

What happens when the foot is the midpoint of the base?

Then m equals n and the formula reduces to Apollonius' theorem, which gives the length of a median.

Can the foot lie outside the triangle?

Yes, but the simple positive-length form no longer applies. The segments on the extended side must be treated as signed lengths.

Does the result depend on which unit I use?

No. Every term has units of length cubed, so the formula is unchanged as long as all four inputs use the same unit.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.