# The Pythagorean Equation

We consider another quadratic Diophantine equation this time in three variables; namely, the Pythagorean Equation :

$$x^2 + y^2 = z^2$$

It is called the Pythagorean Equation although the Ancient Egyptians and Babylonians certainly knew how to generate Pythagorean triples.  Pythagorus used the formula $$(2m, m^2 – 1, m^2 +1)$$ which does not generate all the solutions.

A Pythagorean triple is an ordered triple $$(x, y, z)$$  of positive integers which gives a solution to the above equation.  The ordered triple is said to be primitive if the greatest common divisor of $$(x, y) = 1$$.  The first such triple is, of course, $$(3, 4, 5)$$ since $$3^2 + 4^2 = 5^2 = 9 + 16 = 25$$ and $$3$$ and $$4$$ are relatively prime.

A consequence of the condition that gcd $$(x, y) = 1$$ is that $$x$$ and $$y$$ cannot both be even.

Neither can $$x$$ and $$y$$ both be odd for the following reason:

All square numbers are congruent to either $$0$$ (if even) or $$1$$ (if odd) in modulo $$4$$.

If $$x$$ and $$y$$ are both odd, then

$$x^2 + y^2\equiv 1 +1\equiv 2 \pmod 4$$

and the sum of this addition is not a square number.

It follows that $$x$$ and $$y$$ have opposite parity and $$z$$ will always be odd.

We chose to write the triples with the even value first $$(4, 3, 5)$$ and use the Euclidean formula for generating solutions.

$$x\equiv0\pmod 4$$ , $$y\equiv1 \, \text{or} \, 3\pmod 4\, \text{and}\, z\equiv 1\pmod4$$ .

The primitive Pythagorean triples are generated as follows :

$$(2mn, m^2 – n^2, m^2 + n^2)$$,

where $$m$$ and $$n$$ are relatively prime positive integers of opposite parity and $$m\gt n$$.

Observe that the even value, $$x = 2mn$$, is always a multiple of $$4$$.

All solutions of the equation are given by the Pythagorean triples $$(x, y, z)$$

$$x = 2kmn,\: y = k(m^2 – n^2),\: z = k(m^2 + n^2)$$,

where $$k\ge 1$$ is any integer and $$m$$ and $$n$$ are relatively prime positive integers with opposite parity and $$m\gt n$$.

The last just says that $$(8, 6, 10)$$ and $$(12, 9, 15)$$ . . . are scalar multiples of $$(4, 3, 5)$$.

The sequence of primitive triples begins

$$\begin{array}{c c c} m&n&\text{triple}\\ \hline 2&1&(4, 3, 5)\\ 3&2&(12, 5, 13)\\ 4&1&(8, 15, 17)\\ 4&3&(24, 7, 25)\\ 5&2&(20, 21, 29)\\ 5&4&(40, 9, 41)\\ 6&1&(12, 35, 37)\\ 6&5&(60, 11, 61)\\ 7&2&(28, 45, 53)\\ 7&4&(56, 33, 65)\\ 7&6&(84, 13, 85) \end{array}$$

We observed above that $$x$$ is always a multiple of $$4$$.

The product $$xy$$ is always a multiple of $$12$$ because $$x$$ is a multiple of $$4$$ and either $$x$$ or $$y$$ is a multiple of $$3$$.

The product $$xyz$$ is always a multiple of $$60$$ with one of $$x, y$$ or $$z$$ being a multiple of $$5$$.

$$\frac{(z – x)(z – y)}{2}$$ is always a square number.

For example, using $$(60, 11, 61)$$

$$\frac{(61 – 60)(61 – 11)}{2} = \frac{1\cdot 50}{2} = 25 = 5^2$$.

There is an infinite family of Pythagorean triples where $$x$$ is one less than $$z$$.

\begin{align} \text{Let :} \qquad \qquad \qquad \qquad m^2 + n^2 & = 2mn + 1\\ \text{Rearrange :} \qquad \quad \; m^2 – 2mn + n^2 & = 1\\ \text{Factorise :} \qquad \qquad \qquad (m \, – n)^2 & = 1\\ \text{Take square roots :} \quad \quad \quad \; \; \; \, m\, – n & = 1 \end{align}

Hence,

$$\begin{array}{c c c c c} m&n&x&y&z\\ \hline 2&1&3&4&5\\ 3&2&12&5&13\\ 4&3&24&7&25\\ 5&4&40&9&41\\ 6&5&60&11&61 \end{array}$$

There is an infinite family of near isosceles Pythagorean triples, that is when $$x$$ and $$y$$ differ by $$1$$.

\begin{align} \text{Let : }\qquad \qquad \qquad \; x = 2mn\;\; \text{and}\; y & = m^2 – n^2\; \text{be consecutive integers}\\ \text{That is :} \qquad \qquad \qquad \qquad \; \; m^2 – n^2 & = 2mn \pm 1\\ \text{Rearrange :}\qquad \qquad \qquad \;\; m^2 – 2mn & = n^2 \pm 1\\ \text{Complete the square :}\quad m^2 – 2mn + n^2 & = n^2 + n^2 \pm 1\\ \text{Factorise :}\qquad \qquad \qquad \quad \; \, (m \, – n)^2 & = 2n^2 \pm 1\\ \text{Substitute :}\qquad \qquad \qquad \qquad \quad \; \; \, l & = m \, – n\\ \text{Rearrange :}\qquad \qquad \qquad \quad \; l^2 – 2n^2 & = \pm 1 \end{align}

This is a Pell equation.  The solutions in $$l$$ and $$n$$ arise from the convergents of $$\sqrt 2$$.

$$\begin{array}{c c c c c c} l&n&m&x&y&z\\ \hline 1&1&2&4&3&5\\ 3&2&5&20&21&29\\ 7&5&12&120&119&169\\ 17&12&29&696&697&985\\ 41&29&70&4060&4059&5741 \end{array}$$

Or whenever $$\frac{m – n}{n}$$ is a convergent of $$\sqrt 2$$.

Primitive Pythagorean triples haves uses in cryptography.