# How to get the height of a triangle from three points [duplicate]

Having three distinct points as it is possible to obtain the height of the triangle ABC?

What is the distance between the point A to segment BC?

a = {4, 2, 1}; b = {1, 0, 1}; c = {1, 2, 0};

• @MichaelE2 Does it make sense to close this as a duplicate of a later question, even if that question is more encompassing? Aug 31, 2016 at 9:30
• @Feyre I guess it's up to the community. A foolish consistency...and all that. Of course, this one allows many silly variants, such as 2 Area@Triangle@{a, b, c}/RegionMeasure@Line@{b, c}. Aug 31, 2016 at 10:36

You could use RegionDistance,

a = {4, 2, 1}; b = {1, 0, 1}; c = {1, 2, 0};
RegionDistance[InfiniteLine[{b, c}], a]
N@%
(* 7/Sqrt *)
(* 3.1305 *)


edit: Using InfiniteLine instead of Line, because for obtuse triangles the altitude from point $a$ will not intersect with the line segment $\overline{bc}$.

Or you could work out the trig equations yourself, and use VectorAngle to arrive at

Norm[b-a] Sin[VectorAngle[b-c, b-a]]


• Two options very good Aug 26, 2016 at 17:32
• Might want to use InfiniteLine instead of Line in general. Aug 31, 2016 at 10:31
• @MichaelE2 - thanks for pointing that out! Sep 26, 2016 at 17:35

Just for fun, other answers being more practical, you can use Heron's formula https://en.wikipedia.org/wiki/Heron%27s_formula

fn[a_, b_, c_] := Module[{area, ab, bc, ca, s},
ab = Norm[a - b];
bc = Norm[b - c];
ca = Norm[c - a];
s = (ab + bc + ca)/2;
area = Sqrt[s (s - ab) (s - bc) (s - ca)];
2 area/bc]
With[{a = {4, 2, 1}, b = {1, 0, 1}, c = {1, 2, 0}},
fn[a, b, c]] // FullSimplify
% // N
(* 7/Sqrt *)
(* 3.1305 *)

BC = c - b; BA = a - c;

h = N[Norm[Cross[BC, BA]]/Norm[BC]]


3.1305

Let's ask FormulaData. These should suffice (there are not that many anyways :( ):

Flatten@{FormulaData["TriangleAreaSSS"], FormulaData["TriangleAreaBH"]} // TeXForm


(I started looking for something involving heights: FormulaLookup["TriangleHeight"] gave {"TriangleAreaBH"} which I noted involved Areas which I didn't have yet, so I added "TriangleAreaSSS").

$$\left\{\text{s}=\frac{1}{2} (\text{a}+\text{b}+\text{c}),\text{A}=\sqrt{\text{s} (\text{s}-\text{a}) (\text{s}-\text{b}) (\text{s}-\text{c})},\text{A}=\frac{\text{b} \text{h}}{2}\right\}$$

a = {4, 2, 1}; b = {1, 0, 1}; c = {1, 2, 0};

quantityRename = QuantityVariable[n_, q_] :> Symbol[n <> q];
sides = {aLength -> Norm[b - a],
bLength -> Norm[c - b](*height is on b, aka BC, *b*ase*),
cLength -> Norm[a - c]};

hHeight /. (

It's also a bit unfortunate that your variables are called a, b, c like those in the formulas.