## Tuesday, October 7, 2014

### Generating pythagorean triples from the positive rationals [0..1]

consider this formula:
For rationals [0..1] these (x,y) pairs are on the unit circle in the first quadrant, as proven here: http://mathnow.wordpress.com/2009/11/06/a-rational-parameterization-of-the-unit-circle/
Another way to write the above formula since m is a rational between [0..1] is to substitute in p/q as that rational to get...

For any rational number [0..1] a pythagorean triple can be generated as follows...
Put the rational number in for m (or as p/q in the two other formulas), here I'm using as an example 7/12...
A, B of the triple appear in the numerators of the simplified fractions and C is the denominator common to both...

*Simple direct proof

The above shows that x,y lie on the unit circle as the sum of the squares equals 1. In the first link it shows that p/q [0..1] covers the top right quarter of the circle.
And the above shows that the numerator of x squared plus the numerator of y squared equals the common denominator squared.
This proof really admits a great deal more generality than just for pythagorean triples, considering it doesn't even require p,q be rational numbers. One could have p=pi and q = -sqr(2)/2.

*Alternate more explanatory Proof
Consider some right triangle with whole number hypotenuse and legs such that it is contained in the first quadrant. This has an a,b,c in the usual way for right triangles. We can divide a and b by the distance to that point (a,b) to normalize the vector to that point to somewhere on the circle. Because it is a pythagorean triple triangle, we will have to divide by c to normalize it (because (a^2+b^2)^1/2=c. The formula I gave after substituting in p/q  once simplified can be thought of as such a  normalization because it is two rational numbers with the same denominator and is on the unit circle, hence we clear the common denominator from x,y to get a,b and that denominator becomes c.
* Note
I just find that interesting that it puts an ordering on primitive pythagorean triples.
I guess it's also interesting that because rational points are dense on the unit circle, if you draw a line through somewhere on the circle from the origin you will pass arbitrarily close to an infnite number of pythagorean triple points, I don't know enough topology to know what to conclude from that.