How to find pythagorean triples and n-tuples

1.1k Views Asked by At

A pythagorean triple is any set of three positive integers $(a,b,c)$ where $a^2 + b^2 = c^2$

I'm wondering, is there a formula to find all pythagorean triples, and can it be generalized to $n$-tuples? (i.e $a_1^2+a_2^2+a_3^2+a_4^2+....+a_n^2=x^2$)

2

There are 2 best solutions below

0
On

If (a,b,c) is a pythagorian triple, so is (ka,kb,ck) so we only need concern ourselves with coprime triplets (if two have a common factor the third will as well).

Note: if $n = 2k+1 = m^2$ is an odd square then $k^2 + m^2 = k^2 + 2k + 1 = (k+1)^2$. So that is a method of generating infinite triplets: ie. for $i \in \mathbb Z$ $(2i^2 + 2i ,2i+1, 2i^2 + 2i+1 )$

Such solutions are all of coprime pythogarian triplets.

Wolog assume $a \le b$.

Then $a^2 = c^2 - b^2 = (c-b)(c+b)$. $\gcd((c - b),(c+b)) | 2c$ and $\gcd((c - b),(c+b)) | 2b$ so $gcd(c-b, c+ b) =\{1,2\}$. So $a^2 = (c-b)(c+b)$ means either both $(c + b)$ and $(c -b)$ are perfect squares or 2 times perfect squares. But $\gcd(a, c \pm b) =\{1,2\}$ for the same reasons. So $c -b$ = 1 or 2.

If $c - b = 2$ then $a^2 = c^2 - (c - 2)^2 = 4c - 4$ as $(a/2)^2 = c - 2$ which is pretty much impossible if $0 < a < c$.

So $c = b+1$.

Not sure how to extend to n-tuples.

0
On

Let $t$ be a scaling factor. Then the complete rational solutions are,

$$((a^2-b^2)t)^2+(2abt)^2 = ((a^2+b^2)t)^2$$

$$((a^2-b^2-c^2)t)^2+(2abt)^2+(2act)^2 = ((a^2+b^2+c^2)t)^2$$

$$((a^2-b^2-c^2-d^2)t)^2+(2abt)^2+(2act)^2+(2adt)^2 = ((a^2+b^2+c^2+d^2)t)^2$$

and so on.