# This is my first article in a while …

And I decided today to share what I learned about an algorithm for generating Pythagorean triples for any $m$ and $n$, where $m, n \in$ Z.

A Pythagorean triple are any three whole numbers which satisfy the equation $a^2 + b^2 = c^2$. For any two integers $m$ and $n$, let $a = m^2 - n^2$; $b = 2 m n$; and $c = m^2 - n^2$, and you will obtain a solution to the relation $a^2 + b^2 = c^2$.

It is therefore not that hard, if we allow $m$ and $n$ to be any numbers from 1 to any upper limit you like, to write a computer program to generate the first $x$ Pythagorean triples, allowing for negative values for $a$ or $b$.

### Pi

I am Paul King, a math and science teacher. I help maintain the MIT FAQ Archive along with Nick Bolach. I am also the maintainer of the FAQ for sci.bio.food-science.

This site uses Akismet to reduce spam. Learn how your comment data is processed.