Impossible rational triangles
A rational triangle is a triangle whose sides have rational length and whose area is rational. Can any two rational numbers be sizes of a rational triangle? Surprisingly no. You can always find a third side of rational length, but it might not be possible to do so while keeping the area rational.
The following theorem comes from [1].
Let q be a prime number not congruent to 1 or -1 mod 8. And let be an odd integer such that no prime factor of q2 - 1 is congruent to 1 mod 4. Then a = q + 1 and b = q - 1 are not the sides of any rational triangle.
To make the theorem explicitly clear, here's a Python implementation.
from sympy import isprime, primefactorsdef test(q, omega): if not isprime(q): return False if q % 8 == 1 or q % 8 == 7: return False if omega % 2 == 0: return False factors = primefactors(q**(2*omega) - 1) for f in factors: if f % 4 == 1: return False return True
We can see that q = 2 and = 1 passes the test, so there is no rational triangle with sides a = 21 + 1 = 3 and b = 21 - 1 = 1.
You could use the code above to search for (a,b) pairs systematically.
from sympy import primerangefor q in primerange(20): for omega in range(1, 20, 2): if test(q, omega): a, b = q**omega + 1, q**omega - 1 print(a, b)
This outputs the following:
3 19 733 31129 1278193 819132769 32767131073 131071524289 5242874 26 4126 12414 12
Note that one of the outputs is (4, 2). Since multiplying the sides of a rational triangle by a rational number gives another rational triangle, there cannot be a rational triangle in which one side is twice as long as another.
As the author in [1] points out, There are undoubtedly many pairs not covered by [the theorem cited above]. It would be of interest to characterize all pairs." The paper was published in 1976. Maybe there has been additional work since then.
Related posts- Rational right triangles
- The congruent number problem
- Do perimeter and area determine a triangle?
- Approximation with Pythagorean triangles
[1] N. J. Fine. On Rational Triangles. The American Mathematical Monthly. Vol. 83. No. 7, pp. 517-521.
The post Impossible rational triangles first appeared on John D. Cook.