Heronian triangle

In geometry, a Heronian triangle (or Heron triangle) is a triangle whose side lengths $a$, $b$, and $c$ and area $A$ are all positive integers. Heronian triangles are named after Heron of Alexandria, based on their relation to Heron's formula which Heron demonstrated with the example triangle of sides $13, 14, 15$ and area $84$.

Heron's formula implies that the Heronian triangles are exactly the positive integer solutions of the Diophantine equation
 * $$16\,A^2=(a+b+c)(a+b-c)(b+c-a)(c+a-b);$$

that is, the side lengths and area of any Heronian triangle satisfy the equation, and any positive integer solution of the equation describes a Heronian triangle.

If the three side lengths are setwise coprime (meaning that the greatest common divisor of all three sides is 1), the Heronian triangle is called primitive.

Triangles whose side lengths and areas are all rational numbers (positive rational solutions of the above equation) are sometimes also called Heronian triangles or rational triangles; in this article, these more general triangles will be called rational Heronian triangles. Every (integral) Heronian triangle is a rational Heronian triangle. Conversely, every rational Heronian triangle is similar to exactly one primitive Heronian triangle.

In any rational Heronian triangle, the three altitudes, the circumradius, the inradius and exradii, and the sines and cosines of the three angles are also all rational numbers.

Scaling to primitive triangles
Scaling a triangle with a factor of $s$ consists of multiplying its side lengths by $s$; this multiplies the area by $$s^2$$ and produces a similar triangle. Scaling a rational Heronian triangle by a rational factor produces another rational Heronian triangle.

Given a rational Heronian triangle of side lengths $\frac pd, \frac qd,\frac rd,$ the scale factor $\frac d{\gcd(p,q,r)}$  produce a rational Heronian triangle such that its side lengths $a, b,c$  are setwise coprime integers. It is proved below that the area $A$ is an integer, and thus the triangle is a Heronian triangle. Such a triangle is often called a primitive Heronian triangle.

In summary, every similarity class of rational Heronian triangles contains exactly one primitive Heronian triangle. A byproduct of the proof is that exactly one of the side lengths of a primitive Heronian triangle is an even integer.

Proof: One has to prove that, if the side lengths $a, b,c$ of a rational Heronian triangle are coprime integers, then the area $A$ is also an integer and exactly one of the side lengths is even.

The Diophantine equation given in the introduction shows immediately that $$16A^2$$ is an integer. Its square root $$4A$$ is also an integer, since the square root of an integer is either an integer or an irrational number.

If exactly one of the side lengths is even, all the factors in the right-hand side of the equation are even, and, by dividing the equation by $16$, one gets that $$A^2$$ and $$A$$ are integers.

As the side lengths are supposed to be coprime, one is left with the case where one or three side lengths are odd. Supposing that $c$ is odd, the right-hand side of the Diophantine equation can be rewritten
 * $$((a+b)^2-c^2)(c^2-(a-b)^2),$$

with $$a+b$$ and $$a-b$$ even. As the square of an odd integer is congruent to $$1$$ modulo $4$, the right-hand side of the equation must be congruent to $$-1$$ modulo $4$. It is thus impossible, that one has a solution of the Diophantine equation, since $$16A^2$$ must be the square of an integer, and the square of an integer is congruent to $0$ or $1$ modulo $4$.

Examples
Any Pythagorean triangle is a Heronian triangle. The side lengths of such a triangle are integers, by definition. In any such triangle, one of the two shorter sides has even length, so the area (the product of these two sides, divided by two) is also an integer.

Examples of Heronian triangles that are not right-angled are the isosceles triangle obtained by joining a Pythagorean triangle and its mirror image along a side of the right angle. Starting with the Pythagorean triple $3, 4, 5$ this gives two Heronian triangles with side lengths $(5, 5, 6)$ and $(5, 5, 8)$ and area $12$.

More generally, given two Pythagorean triples $$(a,b,c)$$ and $$(a,d,e)$$ with largest entries $c$ and $e$, one can join the corresponding triangles along the sides of length $a$ (see the figure) for getting a Heronian triangle with side lengths $$c,e,b+d$$ and area $\tfrac12a(b+d)$ (this is an integer, since the area of a Pythagorean triangle is an integer).

There are Heronian triangles that cannot be obtained by joining Pythagorean triangles. For example, the Heronian triangle of side lengths $$5, 29, 30$$ and area 72, since none of its altitudes is an integer. Such Heronian triangles are known as. However, every Heronian triangle can be constructed from right triangles with rational side lengths, and is thus similar to a decomposable Heronian triangle. In fact, at least one of the altitudes of a triangle is inside the triangle, and divides it into two right triangles. These triangles have rational sides, since the cosine and the sine of the angles of a Heronian triangle are rational numbers, and, with notation of the figure, one has $$a=c\sin \alpha$$ and $$b=c\cos\alpha,$$ where $$\alpha$$ is the left-most angle of the triangle.

Rationality properties
Many quantities related to a Heronian triangle are rational numbers. In particular:


 * All the altitudes of a Heronian triangle are rational. This can be seen from the fact that the area of a triangle is half of one side times its altitude from that side, and a Heronian triangle has integer sides and area. Some Heronian triangles have three non-integer altitudes, for example the acute (15, 34, 35) with area 252 and the obtuse (5, 29, 30) with area 72. Any Heronian triangle with one or more non-integer altitudes can be scaled up by a factor equalling the least common multiple of the altitudes' denominators in order to obtain a similar Heronian triangle with three integer altitudes.
 * All the interior perpendicular bisectors of a Heronian triangle are rational: For any triangle these are given by $$p_a=\tfrac{2aA}{a^2+b^2-c^2},$$ $$p_b=\tfrac{2bA}{a^2+b^2-c^2},$$ and $$p_c=\tfrac{2cA}{a^2-b^2+c^2},$$ where the sides are a &ge; b &ge; c and the area is A; in a Heronian triangle all of a, b, c, and A are integers.
 * Every interior angle of a Heronian triangle has a rational sine. This follows from the area formula $Area = (1/2)ab sin C$, in which the area and the sides a and b are integers, and equivalently for the other interior angles.
 * Every interior angle of a Heronian triangle has a rational cosine. This follows from the law of cosines, $c^{2} = a^{2} + b^{2} − 2ab cos C$, in which the sides a, b, and c are integers, and equivalently for the other interior angles.
 * Because all Heronian triangles have all interior angles' sines and cosines rational, this implies that the tangent, cotangent, secant, and cosecant of each interior angle is either rational or infinite.
 * Half of each interior angle has a rational tangent because $tan C/2 = sin C / (1 + cos C)$, and equivalently for other interior angles. Knowledge of these half-angle tangent values is sufficient to reconstruct the side lengths of a primitive Heronian triangle (see below).
 * For any triangle, the angle spanned by a side as viewed from the center of the circumcircle is twice the interior angle of the triangle vertex opposite the side. Because the half-angle tangent for each interior angle of a Heronian triangle is rational, it follows that the quarter-angle tangent of each such central angle of a Heronian triangle is rational.  (Also, the quarter-angle tangents are rational for the central angles of a Brahmagupta quadrilateral, but is an unsolved problem whether this is true for all Robbins pentagons.)  The reverse is true for all cyclic polygons generally; if all such central angles have rational tangents for their quarter angles then the cyclic polygon can be scaled to simultaneously have integer area, sides, and diagonals (connecting any two vertices).
 * There are no Heronian triangles whose three internal angles form an arithmetic progression. This is because all plane triangles with interior angles in an arithmetic progression must have one interior angle of 60°, which does not have a rational sine.
 * Any square inscribed in a Heronian triangle has rational sides: For a general triangle the inscribed square on side of length a has length $$\tfrac{2Aa}{a^2+2A}$$ where A is the triangle's area; in a Heronian triangle, both A and a are integers.
 * Every Heronian triangle has a rational inradius (radius of its inscribed circle): For a general triangle the inradius is the ratio of the area to half the perimeter, and both of these are rational in a Heronian triangle.
 * Every Heronian triangle has a rational circumradius (the radius of its circumscribed circle): For a general triangle the circumradius equals one-fourth the product of the sides divided by the area; in a Heronian triangle the sides and area are integers.
 * In a Heronian triangle the distance from the centroid to each side is rational because, for all triangles, this distance is the ratio of twice the area to three times the side length. This can be generalized by stating that all centers associated with Heronian triangles whose barycentric coordinates are rational ratios have a rational distance to each side. These centers include the circumcenter, orthocenter, nine-point center, symmedian point, Gergonne point and Nagel point.
 * Every Heronian triangle can be placed on a unit-sided square lattice with each vertex at a lattice point. As a corollary, every rational Heronian triangle can be placed into a two-dimensional Cartesian coordinate system with all rational-valued coordinates.

Properties of side lengths
Here are some properties of side lengths of Heronian triangles, whose side lengths are $a, b, c$ and area is $A$.
 * Every primitive Heronian triangle Heronian triangle has one even and two odd sides (see ). It follows that a Heronian triangle has either one or three sides of even length, and that the perimeter of a primitive Heronian triangle is always an even number.
 * There are no equilateral Heronian triangles, since a primitive Heronian triangle has one even side length and two odd side lengths.
 * The area of a Heronian triangle is always divisible by 6.
 * There are no Heronian triangles with a side length of either 1 or 2.
 * There exist an infinite number of primitive Heronian triangles with one side length equal to a given $8$, provided that $64$.
 * The semiperimeter $3$ of a Heronian triangle cannot be prime (as $$s(s-a)(s-b)(s-c)$$ is the square of the area, and the area is an integer, if $c$ were prime, it would divide another factor; this is impossible as these factors are all less than $3$).
 * In a Heronian triangles that has no integer altitude (indecomposable and non-Pythagorean), all side lengths have a prime factor of the form $a$. In a primitive Pythagoran triangle, all prime factors of the hypotenuse have the form $a > 2$. A decomposable Heronian triangle must have two sides that are the hypotenuse of a Pythagorean triangle, and thus two sides that have prime factors of the form $s$. There may also be prime factors of the form $s$, since the Pythagorean components of a decomposable Heronian triangle need not to be primitive, even if the Heronian triangle is primitive. In summary, all Heronian triangles have at least one side that is divisible by a prime of the form $4k+1$.
 * There are no Heronian triangles whose side lengths form a geometric progression.
 * If any two sides (but not three) of a Heronian triangle have a common factor, that factor must be the sum of two squares.

Parametrizations
A parametric equation or parametrization of Heronian triangles consists of an expression of the side lengths and area of a triangle as functions—typically polynomial functionsof some parameters, such that the triangle is Heronian if and only if the parameters satisfy some constraints—typically, to be positive integers satisfying some inequalities. It is also generally required that all Heronian triangles can be obtained up to a scaling for some values of the parameters, and that these values are unique, if an order on the sides of the triangle is specified.

The first such parametrization was discovered by Brahmagupta (598-668 A.D.), who did not prove that all Heronian triangles can be generated by the parametrization. In the 18th century, Leonhard Euler provided another parametrization and proved that it generates all Heronian triangles. These parametrizations are described in the next two subsections.

In the third subsection, a rational parametrization—that is a parametrization where the parameters are positive rational numbers—is naturally derived from properties of Heronian triangles. Both Brahmagupta's and Euler's parametrizations can be recovered from this rational parametrization by clearing denominators. This provides a proof that Brahmagupta's and Euler's parametrizations generate all Heronian triangles.

Brahmagupta's parametric equation
The Indian mathematician Brahmagupta (598-668 A.D.) discovered the following parametric equations for generating Heronian triangles, but did not prove that every similarity class of Heronian triangles can be obtained this way.

For three positive integers $A$, $c$ and $3$ that are setwise coprime ($$\gcd(m,n,k)=1$$) and satisfy $$mn > k^2$$ (to guarantee positive side lengths) and $m \ge n$ (for uniqueness):


 * $$\begin{align}

a &= n(m^2 + k^2), & s - a &= \tfrac12(b + c - a) = n(mn - k^2), \\ b &= m(n^2 + k^2), & s - b &= \tfrac12(c + a - b) = m(mn - k^2), \\ c &= (m + n)(mn - k^2), & s - c &= \tfrac12(a + b - c) = (m + n)k^2, \\ && s &= \tfrac12(a + b + c) = mn(m + n), \\ A &= mnk(m+n)(mn-k^{2}), & r &= k(mn - k^2), \\ \end{align}$$

where $3$ is the semiperimeter, $3$ is the area, and $3$ is the inradius.

The resulting Heronian triangle is not always primitive, and a scaling may be needed for getting the corresponding primitive triangle. For example, taking $4k+1$, $4k+1$ and $4k+3$ produces a triangle with $4k+1$, $m = 36$ and $n = 4$, which is similar to the $k = 3$ Heronian triangle with a proportionality factor of $a = 5220$.

The fact that the generated triangle is not primitive is an obstacle for using this parametrization for generating all Heronian triangles with size lengths less than a given bound (since the size of $$\gcd(a,b,c)$$ cannot be predicted.

Euler's parametric equation
The following method of generating all Heronian triangles was discovered by Leonhard Euler, who was the first to provably parametrize all such triangles.

For four positive integers $3$ coprime to $s$ and $m$ coprime to $n$ ($\gcd{(m, n)} = \gcd{(p, q)} = 1$) satisfying $$mp > nq$$ (to guarantee positive side lengths):


 * $$\begin{align}

a &= mn(p^2 + q^2),     & s - a &= mq(mp - nq), \\ b &= pq(m^2 + n^2),     & s - b &= np(mp - nq), \\ c &= (mq + np)(mp - nq), & s - c &= nq(mq + np), \\ &                       &     s &= mp(mq + np), \\ A &= mnpq(mq + np)(mp - nq), & r &= nq(mp - nq), \\ \end{align}$$

where $k$ is the semiperimeter, $s$ is the area, and $A$ is the inradius.

Even when $r$, $m$, $n$, and $p$ are pairwise coprime, the resulting Heronian triangle may not be primitive. In particular, if $q$, $s$, $A$, and $r$ are all odd, the three side lengths are even. It is also possible that $m$, $n$, and $p$ have a common divisor other than $b = 900$. For example, with $c = 5400$, $(5, 29, 30)$, $180$, and $2$, one gets $m = 2$, where each side length is a multiple of $n = 1$; the corresponding primitive triple is $p = 7$, which can also be obtained by dividing the triple resulting from $q = 4$ by two, then exchanging $(a, b, c) = (130, 140, 150)$ and $10$.

Half-angle tangent parametrization


Let $$a, b, c > 0$$ be the side lengths of a triangle, let $$\alpha, \beta, \gamma$$ be the interior angles opposite these sides, and let $t = \tan\frac\alpha2,$ $u = \tan\frac\beta2,$  and  be the half-angle tangents. The values $$t, u, v$$ are all positive and satisfy $$tu + uv + vt = 1$$; this "triple tangent identity" is the half-angle tangent version of the fundamental triangle identity written as $\frac\alpha 2 + \frac\beta 2 + \frac\gamma 2 = \frac\pi 2$ radians (that is, 90°), as can be proved using the addition formula for tangents. By the laws of sines and cosines, all of the sines and the cosines of $$\alpha, \beta, \gamma$$ are rational numbers if the triangle is a rational Heronian triangle and, because a half-angle tangent is a rational function of the sine and cosine, it follows that the half-angle tangents are also rational.

Conversely, if $$t, u, v$$ are positive rational numbers such that $$tu + uv + vt = 1,$$ it can be seen that they are the half-angle tangents of the interior angles of a class of similar Heronian triangles. The condition $$tu + uv + vt = 1$$ can be rearranged to $v = \frac{1-tu}{t+u},$ and the restriction $$v > 0$$ requires $$tu < 1.$$ Thus there is a bijection between the similarity classes of rational Heronian triangles and the pairs of positive rational numbers $$(t, u)$$ whose product is less than $(13, 14, 15)$.

To make this bijection explicit, one can choose, as a specific member of the similarity class, the triangle inscribed in a unit-diameter circle with side lengths equal to the sines of the opposite angles:
 * $$\begin{align}

a &= \sin\alpha = \frac{2t}{1+t^2}, & s - a = \frac{2u(1-tu)}{(1+t^2)(1+u^2)}, \\[5mu] b &= \sin\beta = \frac{2u}{1+u^2}, & s - b = \frac{2t(1-tu)}{(1+t^2)(1+u^2)}, \\[5mu] c &= \sin\gamma = \frac{2(t+u)(1-tu)}{(1+t^2)(1+u^2)}, & s - c = \frac{2tu(t+u)}{(1+t^2)(1+u^2)}, \\[5mu] &                                      &     s = \frac{2(t+u)}{(1+t^2)(1+u^2)}, \\ A &= \frac{4tu(t+u)(1-tu)}{(1+t^2)^2(1+u^2)^2}, & r = \frac{2tu(1-tu)}{(1+t^2)(1+u^2)}, \end{align}$$ where $$s = \tfrac12(a + b + c)$$ is the semiperimeter, $$A = \tfrac12 ab \sin \gamma$$ is the area, $$r = \sqrt{\tfrac{(s-a)(s-b)(s-c)}{s}}$$ is the inradius, and all these values are rational because $$t$$ and $$u$$ are rational.

To obtain an (integral) Heronian triangle, the denominators of $q$, $m$, and $n$ must be cleared. There are several ways to do this. If $$t = m/n$$ and $$u = p/q,$$ with $$\gcd(m, n) = \gcd(p,q) = 1$$ (irreducible fractions), and the triangle is scaled up by $$\tfrac12(m^2 + n^2)(p^2 + q^2),$$ the result is Euler's parametrization. If $$t = m/k$$ and $$u = n/k$$ with $$\gcd(m, n, k) = 1$$ (lowest common denomimator), and the triangle is scaled up by $$(k^2 + m^2)(k^2 + n^2)/2k,$$ the result is similar but not quite identical to Brahmagupta's parametrization. If, instead, this is $$1/t$$ and $$1/u$$ that are reduced to the lowest common denominator, that is, if $$t = k/m$$ and $$u = k/n$$ with $$\gcd(m, n, k) = 1,$$ then one gets exactly Brahmagupta's parametrization by scaling up the triangle by $$(k^2 + m^2)(k^2 + n^2)/2k.$$

This proves that either parametrization generates all Heronian triangles.

Other results
has derived fast algorithms for generating Heronian triangles.

There are infinitely many primitive and indecomposable non-Pythagorean Heronian triangles with integer values for the inradius $$r$$ and all three of the exradii $$(r_a, r_b, r_c)$$, including the ones generated by


 * $$\begin{align}

a &= 5(5n^2 + n - 1),              & r_a &= 5n+3,     \\ b &= (5n + 3)(5n^2 - 4n + 1),      & r_b &= 5n^2+n-1, \\ c &= (5n - 2)(5n^2 + 6n + 2),      & r_c &= (5n - 2)(5n + 3)(5n^2 + n - 1), \\ &                                  & r &= 5n - 2, \\ A &= (5n - 2)(5n + 3)(5n^2 + n - 1) = r_c. \end{align}$$

There are infinitely many Heronian triangles that can be placed on a lattice such that not only are the vertices at lattice points, as holds for all Heronian triangles, but additionally the centers of the incircle and excircles are at lattice points. See also for parametrizations of some types of Heronian triangles.

Examples
The list of primitive integer Heronian triangles, sorted by area and, if this is the same, by perimeter, starts as in the following table. "Primitive" means that the greatest common divisor of the three side lengths equals 1. The list of primitive Heronian triangles whose sides do not exceed 6,000,000 has been computed by.

Heronian triangles with perfect square sides
Heronian triangles with perfect square sides are related to the Perfect cuboid problem. As of February 2021, only two primitive Heronian triangles with perfect square sides are known:

(1853², 4380², 4427², Area=32918611718880), published in 2013.

(11789², 68104², 68595², Area=284239560530875680), published in 2018.

Equable triangles
A shape is called equable if its area equals its perimeter. There are exactly five equable Heronian triangles: the ones with side lengths (5,12,13), (6,8,10), (6,25,29), (7,15,20), and (9,10,17), though only four of them are primitive.

Almost-equilateral Heronian triangles
Since the area of an equilateral triangle with rational sides is an irrational number, no equilateral triangle is Heronian. However, a sequence of isosceles Heronian triangles that are "almost equilateral" can be developed from the duplication of right-angled triangles, in which the hypotenuse is almost twice as long as one of the legs. The first few examples of these almost-equilateral triangles are listed in the following table :

There is a unique sequence of Heronian triangles that are "almost equilateral" because the three sides are of the form n − 1, n, n + 1. A method for generating all solutions to this problem based on continued fractions was described in 1864 by Edward Sang, and in 1880 Reinhold Hoppe gave a closed-form expression for the solutions. The first few examples of these almost-equilateral triangles are listed in the following table :

Subsequent values of n can be found by multiplying the previous value by 4, then subtracting the value prior to that one (52 = 4 × 14 − 4, 194 = 4 × 52 − 14, etc.), thus:


 * $$n_t = 4n_{t-1} - n_{t-2} \, ,$$

where t denotes any row in the table. This is a Lucas sequence. Alternatively, the formula $$(2 + \sqrt{3})^t + (2 - \sqrt{3})^t$$ generates all n for positive integers t. Equivalently, let A = area and y = inradius, then,


 * $$\big((n-1)^2+n^2+(n+1)^2\big)^2-2\big((n-1)^4+n^4+(n+1)^4\big) = (6n y)^2 = (4A)^2$$

where {n, y} are solutions to n2 − 12y2 = 4. A small transformation n = 2x yields a conventional Pell equation x2 − 3y2 = 1, the solutions of which can then be derived from the regular continued fraction expansion for $p$.

The variable n is of the form $$n=\sqrt{2 + 2 k}$$, where k is 7, 97, 1351, 18817, .... The numbers in this sequence have the property that k consecutive integers have integral standard deviation.