# Where is this formula for generating pythagorean triples coming from?

I'm reading Stillwell's Mathematics and Its History. In the chapter about pythagorean triples, he says that we now know that the general formula for generating pythagorean triples is:

$$a = r\cdot(m^2 - n^2) ,\ \, b = r\cdot(2mn) ,\ \, c = r\cdot(m^2 + n^2)\tag{1}$$

And that there is a special case which gives all solutions $a,b,c$ without common divisor:

$$a = m^2 - n^2 ,\ \, b = 2mn ,\ \, c = m^2 + n^2\tag{2}$$

I'm just no so sure where are these formulas coming from. I've made the following trial: By looking $(2)$, I've written the formula for the pythagorean theorem and I've switched only the $c$:

$$a^2+b^2=\color{red}{(m^2 + n^2)^2}$$

And expanded it:

$$a^2+b^2=\color{red}{m^4+2n^2m^2+n^4}\tag{3}$$

Then my guess is that I should find arbitrary $a$, $b$ (and perhaps some integers?) written in terms of $n$ and $m$ such that $(3)$ is true. So I guess I need to split the polynomial in (perhaps) some arbitrary way such as:

$$a^2+b^2=\color{red}{m^4+2n^2m^2}\color{green}{+n^4}$$ $$a^2+b^2=\color{red}{m^4+n^2m^2}\color{green}{+n^2m^2+n^4}$$

And then find $a,b$ such that:

$$\begin{eqnarray*} {a^2}&=&{m^4+2n^2m^2} \\ {b^2}&=&{n^4} \end{eqnarray*}$$

Or:

$$\begin{eqnarray*} {a^2}&=&{m^4+n^2m^2} \\ {b^2}&=&{n^2m^2+n^4} \end{eqnarray*}$$

Or any arbitrary combination such that $(3)$ holds. I'm still a little stuck, am I on the right path? I've looked wikipedia article on pythagorean triples and there's no much insight into this matter.

-
From where ? From Euclid. :-) –  Lucian Mar 16 '14 at 23:44
@Lucian Yes. The worst part is that it's all in there. I've seen "proof" and somehow I thought that it wouldn't answer my question. Where's the "I feel ashamed for asking such a dumb question and want to delete it to avoid future embarassment" button? –  Voyska Mar 16 '14 at 23:56
This is possibly a duplicate of this question. –  robjohn Mar 16 '14 at 23:57
@Pristine, don't worry about it. We all sometimes feel like we're asking dumb questions. But really, the only dumb questions are the ones you don't ask. –  David Mar 18 '14 at 5:28

If you read a few pages further you will find that Exercises 1.31. and 1.3.2 give a derivation of the Pythagorean triple formula using a rational parametrization of the circle (see also the "geometry" section of the Wikipedia article).

More generally, if a conic curve with rational coefficients has one rational point $\rm\:P\:$ then it has infinitely many, since any rational line through $\rm\:P\:$ will intersect the curve in another point, necessarily rational, since if one root of a rational quadratic is rational then so is the other. Therefore, by sweeping lines of varying rational slopes through $\rm\:P\:$ we obtain infinitely many rational points on the conic. Projecting these points onto a line leads to a rational parametrization of the conic. For a very nice exposition see Chapter $1$ of Silverman and Tate: Rational Points on Elliptic Curves. There are also many online expositions, e.g. search on "rational parametrization Pythagorean triple".

There are also many other ways to derive the formula. A particularly beautiful one-line way employs Hilbert's Theorem $90$ - see the award winning expository Monthly paper by Olga Taussky Sums of Squares.

-
I got sad for asking such a stupid question - after you said the answer is in wikipedia, I noticed it really was. But when you answered the question and provided references, I got really happy! I'm a books colector, then answers with references are a supreme delight, specially coming from a very qualified member of the mathematical community like you. Thanks! If you have some blog or website where you recommend books and articles, please let me know. –  Voyska Mar 17 '14 at 2:48
Don't worry, we all pondered this question at one point on our learning curve. The geometrical approach is very pretty so I recommend that you read about it. Another beautiful geometrical viewpoint is the reflective generation of the ternary tree of primitive Pythagorean triples due to Aubry. –  Bill Dubuque Mar 17 '14 at 3:00

There is a fair bit of work to do to prove this theorem but you could look here, starting on page 2. The article is aimed at a secondary school level audience, so hopefully it should be fairly accessible.

Note that the main difficulty is not proving that the formulae give some possible $a,b,c$ but proving that they give all possible $a,b,c$.

-

It comes from a rather sneaky relation that $2m^2n^2=4m^2n^2-2m^2n^2$. If we have $c=m^2+n^2$, then $$c^2=(m^2+n^2)^2=m^4+2m^2n^2+n^4=\\m^4-2m^2n^2+n^4+4m^2n^2=(n^2-m^2)^2+(2mn)^2=a^2+b^2$$ where $a=(m^2+n^2),b=2mn$.

-
That doesn't actually prove anything since you're assuming a certain form for $c$. –  nbubis Mar 17 '14 at 0:19