In mathematics, the triangle inequality states that for any triangle in Euclidean space, the sum of the lengths of any two sides must be greater than or equal to the length of the third side. If , , and are the lengths of the sides of a triangle then:
The same inequality holds when the sides of the triangle are relabeled, so also and . When one side length is equal to the sum of the other two, , the triangle is degenerate, with zero area.
The triangle inequality implies a related statement for Euclidean vectors, also called the triangle inequality; if and are vectors (directed magnitudes, usually drawn as arrows), then , , and their sum can be pictured as sides that are assembled into a triangle, with each vector's norm as the length of the corresponding side. Therefore
The triangle inequality also holds in some contexts other than Euclidean space. For example, it holds for triangles on a sphere and in the hyperbolic plane. But it does not hold in some contexts, for example Minkowski spacetime.
The triangle inequality is one of the defining properties of a distance function in a metric space; if , , and are any three points, only a function which satisfies the triangle inequality,
is considered to be a proper notion of distance. The analog of the triangle inequality for vectors is also a defining property of the norm in normed vector spaces.
Euclidean geometry
The triangle inequality theorem appears in Euclid's Elements as proposition 20 of Book I:
Euclid proved it using the construction shown in the figure. Beginning with triangle , the side is extended by the same length as to a new point , forming an isosceles triangle , which has two equal angles and , labeled . Angle , labeled , contains angle , so . Therefore side must be longer than side (by proposition I.19). However:
so the sum of the lengths of sides and is larger than the length of .
Mathematical expression of the constraint on the sides of a triangle
For a non-degenerate triangle with side lengths , the triangle inequality states that
This set of three inequalities can be succinctly summarized as
Or, equivalently, as
where is the length of the longest side. That is, the longest side of a triangle is always shorter than the semiperimeter, .
Another equivalent statement is that the area of a triangle with sides and semiperimeter must be a real number greater than zero. Heron's formula for the area is
In terms of either area expression, the triangle inequality imposed on all sides is equivalent to the condition that the expression under the square root sign be real and greater than zero (so that the area expression is real and greater than zero).
The triangle inequality provides upper bounds for ratios of side lengths; with sides labeled in ascending length order :
where is the golden ratio.American Mathematical Monthly, pp. 49-50, 1954.
Right triangle
In the case of right triangles, the triangle inequality specializes to the statement that the hypotenuse is greater than either of the two sides and less than their sum.
The second part of this theorem is already established above for any side of any triangle. The first part is established using the lower figure. In the figure, consider the right triangle . An isosceles triangle is constructed with equal sides . From the triangle postulate, the angles in the right triangle satisfy:
Likewise, in the isosceles triangle , the angles satisfy:
Therefore,
and so, in particular,
That means side , which is opposite to angle , is shorter than side , which is opposite to the larger angle . But . Hence:
A similar construction shows , establishing the theorem.
An alternative proof (also based upon the triangle postulate) proceeds by considering three positions for point : (i) as depicted (which is to be proved), or (ii) coincident with (which would mean the isosceles triangle had two right angles as base angles plus the vertex angle , which would violate the triangle postulate), or lastly, (iii) interior to the right triangle between points and (in which case angle is an exterior angle of a right triangle and therefore larger than , meaning the other base angle of the isosceles triangle also is greater than and their sum exceeds in violation of the triangle postulate).
This theorem establishing inequalities is sharpened by Pythagoras' theorem to the equality that the square of the length of the hypotenuse equals the sum of the squares of the other two sides.
Generalization to any polygon The triangle inequality can be extended by mathematical induction to arbitrary polygonal paths. This gives the generalized polygon inequality, which asserts that the total length of such a path is no less than the length of the straight line between its endpoints. Consequently, the length of any polygon side is always less than the sum of the other polygon side lengths.
Relationship with shortest paths
This generalization can be used to prove that the shortest curve between two points in Euclidean geometry is a straight line.
No polygonal path between two points is shorter than the line between them. This implies that no curve can have an arc length less than the distance between its endpoints. By definition, the arc length of a curve is the least upper bound of the lengths of all polygonal approximations of the curve. The result for polygonal paths shows that the straight line between the endpoints is the shortest of all the polygonal approximations. Because the arc length of the curve is greater than or equal to the length of every polygonal approximation, the curve itself cannot be shorter than the straight line path. p. 95.
Converse
The converse of the triangle inequality theorem is also true: if three real numbers are such that each is less than the sum of the others, then there exists a triangle with these numbers as its side lengths and with positive area; and if one number equals the sum of the other two, there exists a degenerate triangle (that is, with zero area) with these numbers as its side lengths.
In either case, if the side lengths are , , we can attempt to place a triangle in the Euclidean plane as shown in the diagram. We need to prove that there exists a real number consistent with the values , , and , in which case this triangle exists.
By the Pythagorean theorem we have and according to the figure at the right. Subtracting these yields . This equation allows us to express in terms of the sides of the triangle:
For the height of the triangle we have that . By replacing with the formula given above, we have
For a real number to satisfy this, must be non-negative:
which holds if the triangle inequality is satisfied for all sides. Therefore, there does exist a real number consistent with the sides , and the triangle exists. If each triangle inequality holds strictly, and the triangle is non-degenerate (has positive area); but if one of the inequalities holds with equality, so , the triangle is degenerate.
Generalization to higher dimensions
The area of a triangular face of a tetrahedron is less than or equal to the sum of the areas of the other three triangular faces. More generally, in Euclidean space the hypervolume of an -facet of an -simplex is less than or equal to the sum of the hypervolumes of the other facets.
Much as the triangle inequality generalizes to a polygon inequality, the inequality for a simplex of any dimension generalizes to a polytope of any dimension: the hypervolume of any facet of a polytope is less than or equal to the sum of the hypervolumes of the remaining facets.
In some cases the tetrahedral inequality is stronger than several applications of the triangle inequality. For example, the triangle inequality appears to allow the possibility of four points , , , and in Euclidean space such that distances
and . However, points with such distances cannot exist: the area of the equilateral triangle is , which is larger than three times , the area of a isosceles triangle (all by Heron's formula), and so the arrangement is forbidden by the tetrahedral inequality.
Spherical geometry In spherical geometry, a triangle is formed from three points and three great circle arcs, each connecting a pair of the points. There are two great circle arcs that connect a pair of points; except when the vertices are exactly opposite on the sphere, one of those arcs will be the short way around the sphere and the other will be the long way around the sphere. In this geometry, the triangle inequality tells us that the smaller length of the two arcs connecting a pair of points will have length less than or equal to the sum of the lengths of the arcs connecting the other pairs of points. That is, the triangle inequality gives whenever is not more than 180° ( radians). This can be written as , without having to check whether exceeds 180°.
Triangle inequality for cosine similarity
By applying the cosine function to the triangle inequality and reverse triangle inequality for arc lengths and employing the angle addition and subtraction formulas for cosines, it follows immediately that
and
With these formulas, one needs to compute a square root for each triple of vectors that is examined rather than for each pair of vectors examined, and could be a performance improvement when the number of triples examined is less than the number of pairs examined.
Normed vector space
In a normed vector space , one of the defining properties of the norm is the triangle inequality:
That is, the norm of the sum of two vectors is at most as large as the sum of the norms of the two vectors. This is also referred to as subadditivity. For any proposed function to behave as a norm, it must satisfy this requirement.
Triangle equality If the normed space is Euclidean, or, more generally, strictly convex, then the triangle equality holds if and only if the triangle formed by , , and is degenerate; that is, and are on the same ray, i.e., or or for some .
This property characterizes strictly convex normed spaces such as the spaces with . However, there are normed spaces in which this is not true. For instance, consider the plane with the norm (the Manhattan distance) and denote and . Then the triangle formed by , , and , is non-degenerate but
Example norms The absolute value is a norm for the real line; as required, the absolute value satisfies the triangle inequality for any real numbers and . If and have the same sign or either of them is zero, then If and have opposite signs, then without loss of generality assume Then Combining these cases:A proof not requiring separate cases is as follows: Any number is always less than or equal to its own absolute value, so and Adding these inequalities together, the sum has the form for and But this always implies , or, expanded,
The triangle inequality is useful in mathematical analysis for determining the best upper estimate on the size of the sum of two numbers, in terms of the sizes of the individual numbers. There is also a lower estimate, which can be found using the reverse triangle inequality which states that for any real numbers and , The modulus of a complex number is a generalization of the absolute value to the complex plane and is a norm for the complex numbers, regarded as a one-dimensional complex vector space or as a two-dimensional real vector space. For a complex number it is defined by For a complex number expressed in polar form, with and it is given by For complex numbers the triangle inequality holds. The triangle inequality follows from the observation that there exists such that and If is nonzero, let If simply let From this, the following computation gives the triangle inequality:
The third equality in the chain follows from the fact that is real, while the inequality in the chain follows from the fact that for any complex number written in rectangular form,