## Pages

### Pythagorean triples

In geometry, there is a well known theorem, called the Pythagorean Theorem, which says that in a right triangle, the square of the hypotenuse is equal to the sum of squares of the other two sides.
 Pythagorean Theorem: $BC^2 = AB^2 + AC^2$

That is why we call the equation $$x^2 + y^2 = z^2$$ the Pythagorean equation and its solution $(x,y,z)$ is called a Pythagorean triple. Of course, we only consider integer solutions.

Today, we will solve the Pythagorean equation and show that this equation has an infinite number of solutions.

Before going into solving the Pythagorean equation, let us recall a bit about prime numbers. In this post "Primes numbers", we have pointed out an interesting analogy. That is the set of prime numbers can be viewed as a complete set of genes to build the whole of natural numbers. Just as each of us has unique characteristics because we have different genes, the numbers too, each different number possesses a different set of genes.

Since $20 = 2 \times 2 \times 5$, we say that the number $20$ has two genes $2$ and one gene $5$, on the other hand, the number $45 = 3 \times 3 \times 5$ has two genes $3$ and one gene $5$.

In general, if a number $n$ is factored into primes as follows $$n = p_1^{\alpha_1} p_2^{\alpha_2} \dots p_k^{\alpha_k}$$ then we say that $n$ has $\alpha_1$ genes $p_1$, $\alpha_2$ genes $p_2$, ..., and $\alpha_k$ genes $p_k$.

We observe that if $ab = n^2$ then $a$ and $b$ must be of the following forms: $a = u^2 w$, $b = v^2 w$. This is because the number of each gene in $ab$ is an even number. So if we have an odd number of gene $p$ in $a$ then we must have an odd number of gene $p$ in $b$ also. If we collect all the odd genes into $w$ then we will have $a = u^2 w$ and $b = v^2 w$.
 $20 \times 45 = 900 = 30^2$ so the odd gene of $20$ has to match with the odd gene of $45$
For example, we have $20 \times 45 = 900 = 30^2$. In number $20$ we have an odd gene $5$ and in number $45$ we also have an odd gene $5$, that is why we can write $20 = 2^2 \times 5$ and $45 = 3^2 \times 5$.

Observation: if $ab = n^2$ then $a = u^2 w$ and $b = v^2 w$.

Let us now solve the Pythagorean equation $$x^2 + y^2 = z^2$$

We have $$x^2 = z^2 - y^2 = (z-y)(z+y)$$

By the above observation,
• $z + y = u^2 w$
• $z - y = v^2 w$
• $x = uvw$

Thus we obtain the solution of the Pythagorean equation
• $x = uvw$
• $y = (u^2 - v^2)w/2$
• $z = (u^2 + v^2)w/2$
Our last job is to find the condition so that $y$ and $z$ are integers.

For $y$ and $z$ to be integers, we either have $w$ as an even number, or the two numbers $u$ and $v$ must be either both odd or both even. Let us consider each case separately.

Case 1: $w$ is an even number. Let $w = 2s$. Then the solution of the Pythagorean equation is
• $x = 2uvs$
• $y = (u^2 - v^2)s$
• $z = (u^2 + v^2)s$

Case 2: $u$ and $v$ are both even, or both odd. Let $u = v + 2k$. Thus,
• $x = (v + 2k)vw = (v^2 + 2kv)w$
• $y = [(v + 2k)^2 - v^2]w/2 = (2kv+2k^2)w$
• $z = [(v + 2k)^2 + v^2]w/2 = (v^2 + 2kv + 2k^2)w$
This solution can be rewritten as
• $x = [(v+k)^2 - k^2]w$
• $y = 2(v+k)kw$
• $z = [(v+k)^2 + k^2]w$

In both cases, we can see that the general solution of the Pythagorean equation is
• $\{x,y\} = \{2abc, (a^2 - b^2)c\}$ and
• $z = (a^2 + b^2)c$.

So we have solved the Pythagorean equation.

• With $c=1$, $a=2$, $b=1$, we have the Pythagorean triple $(3,4,5)$ and $3^2 + 4^2 = 5^2$.
• With $c=1$, $a=3$, $b=2$,  we have the Pythagorean triple $(5,12,13)$ and $5^2 + 12^2 = 13^2$.

We have shown that the Pythagorean equation has an infinite number of solutions. On the other hand, for any $n \geq 3$, the mathematician Fermat said that the equation $$x^n + y^n = z^n$$ does not have any non-zero solutions. It took more than 300 years for mathematicians to prove this fact. You can read more about the Fermat problem in this post.

The Pythagorean Theorem can be proved by using similar triangles. You can read the proof in this post "Similar triangles".

Let us stop here for now, see you again in the next post.

Homework.

1. Prove that if $ab = n^3$ then $a = t^3 u v^2$ and $b = s^3 u^2 v$.

2. Prove that the equation $x^4 + y^4 = z^4$ has no non-zero solutions.