Given a number say $x$, How do you check if it can become hypotenuse of right angle triangle and other sides must be integers?

2.2k Views Asked by At

Given a number say $x$, how to check if it can become hypotenuse of right angle triangle and other sides must be integer

For example:

$5$ it can be hypotenuse as its other sides $3$ & $4$ are integers.

$13$ it can also hypotenuse as its other sides $12$ & $5$ are integers.

$12$ can't be hypotenuse because other two sides can't be integers.

2

There are 2 best solutions below

2
On BEST ANSWER

An integer number $N>0$ can be the hypothenuse of a right angled triangle with integer side lengths if and only if it has a prime factor $p \equiv 1 (4)$ (i.e. $p$ is of the form $4k+1$ with integer $k$).

The proof outline is as follows:

  • If $N^2 = a^2+b^2$ then $(kN)^2 = (ka)^2+(kb)^2$.
  • Any prime $p \equiv 1 (4)$ can be represented as $x^2+y^2$ with positive integers $x,y$ (Fermat's theorem on sums of two squares). And then $p^2 = (x^2+y^2)^2 = (x^2-y^2)^2 + (2xy)^2$
  • All other numbers only have the trivial representation $N^2 = N^2+0^2$ (see e.g. here), which does not form a triangle.
1
On

It is known that any primitive pythagorean triple $a^2 + b^2 = c^2$ is on the form $$ (a, b, c) = (2uv, u^2 - v^2, u^2 + v^2) $$for some natural numbers $u>v$, so you basically have to check whether your hypotenuse can be written as the sum of two squares. To confirm your examples, $5 = 4 + 1$, and $13 = 9 + 4$, while $12$ is not the sum of two squares (you can't add your way to $12$ by using only two numbers from $\{1, 4, 9\}$).

If course, it's possible that your number could be the hypotenuse in some non-primitive triple. This happens if it has a divisor that can be written as the sum of two squares. For instance, if at least one of its prime factors are congruent to $1$ modulo $4$.