Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

April 17, 2024

Pythagorean Triples and the Projective Line

Posted by John Baez

Pythagorean triples like 3 2+4 2=5 23^2 + 4^2 = 5^2 may seem merely cute, but they’re connected to some important ideas in algebra. To start seeing this, note that rescaling any Pythagorean triple m 2+n 2=k 2m^2 + n^2 = k^2 gives a point with rational coordinates on the unit circle:

(m/k) 2+(n/k) 2=1(m/k)^2 + (n/k)^2 = 1

Conversely any point with rational coordinates on the unit circle can be scaled up to get a Pythagorean triple.

Now, if you’re a topologist or differential geometer you’ll know the unit circle is isomorphic to the real projective line P 1\mathbb{R}\mathrm{P}^1 as a topological space, and as a smooth manifold. You may even know they’re isomorphic as real algebraic varieties. But you may never have wondered whether the points with rational coordinates on the unit circle form a variety isomorphic to the rational projective line P 1\mathbb{Q}\mathrm{P}^1.

It’s true! And since P 1\mathbb{Q}\mathrm{P}^1 is \mathbb{Q} plus a point at infinity, this means there’s a way to turn rational numbers into Pythagorean triples. Working this out explicitly, this gives a nice explicit way to get our hands on all Pythagorean triples. And as a side-benefit, we see that points with rational coordinates are dense in the unit circle.

The basic idea is simple, but there’s a bit of suspense involved, and thus a bit to be learned.

First we set up an explicit isomorphism between P 1\mathbb{R}\mathrm{P}^1 and the unit circle S 1S^1. To do this, we think of P 1\mathbb{R}\mathrm{P}^1 as the xx axis in the plane together with a point at infinity. Then we map each point on the xx axis to a point on the unit circle by drawing a straight line through that point and the ‘north pole’ (0,1)(0,1) and seeing where it hits the circle:

This extends to a bijection f:P 1S 1f \colon \mathbb{R}\mathrm{P}^1 \to S^1. Then we can restrict this to an isomorphism between P 1\mathbb{Q}\mathrm{P}^1 and what I’ll call the rational unit circle

{(x,y) 2|x 2+y 2=1} \{(x,y) \in \mathbb{Q}^2 \vert \; x^2 + y^2 = 1 \}

But there’s something to check here! Why does ff map rational numbers qq \in \mathbb{Q} to points on S 1S^1 with rational coordinates?

For this we need to think about ff. The line through the north pole and a point (q,0)(q,0) on the xx axis is given by

x=q(1y) x = q(1-y)

since this equation gives x=0x = 0 when y=1y = 1 and x=qx = q when y=0y = 0. This line goes through some point f(q)f(q) on the unit circle. To figure out this point f(q)=(x,y)f(q) = (x,y), notice it obeys the equation for the line and also

x 2+y 2=1 x^2 + y^2 = 1

So plop the equation for the line into the equation for the circle and get

q 2(1y) 2+y 2=1 q^2 (1-y)^2 + y^2 = 1

Now things get sort of interesting. It’s easy to solve this using the quadratic formula, but it’s not instantly obvious the solution will be rational when qq is rational! We could work it out and see, but a general principle saves us from this demeaning labor:

Lemma. If ax 2+bx+ca x^2 + b x + c is a quadratic with coefficients a,b,ca,b,c in some field kk, and this quadratic has one root r 1r_1 in kk, then the quadratic factors as a(xr 1)(xr 2)a(x-r_1)(x-r_2) in this field kk.

Our equation q 2(1y) 2+y 2=1q^2(1-y)^2 + y^2 = 1 has rational coefficients when qq is rational, and we know it has one rational solution, namely y=1y = 1, since the north pole lies both on the line and the circle. So the lemma says the other solution, the one we care about, must also be rational!

In short: whenever qq is rational so is yy, and then x=(1q)yx = (1-q)y is as well, so f(q)=(x,y)f(q) = (x,y) is a point on the rational unit circle.

Since lines from the north pole to rational points on the xx axis hit the unit circle in a dense set, it follows that the rational unit circle is dense in the unit circle. And these correspond precisely to Pythagorean triples mod rescaling by integers. So we get all the Pythagorean triples this way, and a lot of them.

That makes it more interesting to see an explicit formula for f(q)=(x,y)f(q) = (x,y). I joked that this would require “demeaning labor”. It’s just some algebra, but it’s a bit annoying. The main step is to solve the quadratic equation

q 2(1y) 2+y 2=1 q^2 (1-y)^2 + y^2 = 1

or in other words

(q 2+1)y 22q 2y+(q 21)=0 (q^2 + 1) y^2 - 2q^2 y + (q^2 - 1) = 0

We could solve this using the quadratic formula—but that makes it seem a bit miraculous that in addition to the root y=1y = 1, the root we care about will also be rational. It’s actually more fun to solve this equation using this proof of the Lemma:

Lemma. If ax 2+bx+ca x^2 + b x + c is a quadratic with coefficients a,b,ca,b,c in some field kk, and this quadratic has one root r 1r_1 in kk, then the quadratic factors as a(xr 1)(xr 2)a(x-r_1)(x-r_2) for some r 2kr_2 \in k.

Proof. There’s a general abstract nonsense way to prove this, but it’s even quicker to show it directly and get a formula for r 2r_2. The quadratic must factor in the algebraic closure of kk, so

ax 2+bx+c=a(xr 1)(xr 2) a x^2 + b x + c = a(x-r_1)(x-r_2)

for r 1,r 2k¯r_1, r_2 \in \overline{k}. Thus

b=a(r 1+r 2) b = - a(r_1 + r_2)

which lets us solve for one root if we know the other:

r 2=bar 1 r_2 = - \frac{b}{a} - r_1

If the coefficients a,ba,b are in kk and the root r 1r_1 is in kk, it follows that the root r 2r_2 is also in kk. \quad

Since our quadratic

(q 2+1)y 22q 2y+(q 21)=0 (q^2 + 1) y^2 - 2q^2 y + (q^2 - 1) = 0

has one rational root r 1=1r_1 = 1, we see that the other root must be

r 2=2q 2q 2+11 r_2 = \frac{2q^2}{q^2 + 1} - 1

That’s the root we want, so

y=2q 2q 2+11 y = \frac{2q^2}{q^2 + 1} - 1

See, this was more fun than using the quadratic formula and discovering that “miraculously” the answer is rational despite the square root! Simplifying a bit we get

y=q 21q 2+1 y = \frac{q^2 - 1}{q^2 + 1}

which is much more cute. Then we get

x=q(1y)=q(1q 21q 2+1) x = q(1-y) = q\left(1 - \frac{q^2 - 1}{q^2 + 1} \right)

Simplifying this we again get something much more cute:

x=2qq 2+1 x = \frac{2q}{q^2 + 1}

So, our map from the rational projective line to the rational circle is

f(q)=(2qq 2+1,q 21q 2+1) f(q) = \left( \frac{2q}{q^2 + 1}, \frac{q^2 - 1}{q^2 + 1} \right)

You can see this formula on Wikipedia, but I find the journey much more interesting than the destination… and we’re not even done with the journey.

But before we go on, we should at least take a moment to childishly flex our muscles. Take any rational number, like q=100q = 100, and pop it into our formula for ff. We get

f(100)=(20010001,999910001) f(100) = \left( \frac{200}{10001}, \frac{9999}{10001} \right)

This means that

(20010001) 2+(999910001) 2=1 \left( \frac{200}{10001} \right)^2 + \left( \frac{9999}{10001} \right)^2 = 1

Rescaling, we get a Pythagorean triple:

200 2+9999 2=10001 2 200^2 + 9999^2 = 10001^2


Further adventures

The unit circle is an example of a ‘conic’. Other examples include ellipses, hyperbolas and parabolas. Conics can be studied over any field kk, but it’s easiest to study them as projective varieties rather than affine varieties. To do that we take a quadratic form in 3 variables, see where it vanishes, and then ‘projectivize’: mod out by rescaling to get a subvariety of the projective plane. For example we get our friend the unit circle by projectivizing the real solutions of

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

and the same idea works for the rational unit circle if we use rational solutions.

Working projectively, we include ‘points at infinity’ which make our conics better behaved. The ordinary real hyperbola is obviously not isomorphic to P 1\mathbb{R}\mathrm{P}^1, but when we work projectively it gets two points at infinity that fix this problem: you can sail out along one branch of the hyperbola to a point at infinity, sail back in along another branch, go out along that branch to another point at infinity, and then sail back to where you started. It’s really a circle viewed in a funny way!

I got interested in this stuff while writing about elliptic curves over finite fields. I suddenly realized I didn’t even understand conics over finite fields! This is like writing about cubic equations when you don’t even understand the quadratic equation. So I started learning about conics.

Among other things, I re-read Chapter 1 of Gille and Szamuely’s nice book Central Simple Algebras and Galois Cohomology, which explains the correspondence between projective conics over an arbitrary field and ‘quaternion algebras’ over that field, which are central simple algebras of dimension 4. I believe this should clarify the relation between Pythagorean triples and the algebra of 2×22 \times 2 integer matrices lurking behind Trautman’s work on Pythagorean spinors and the modular group. At least the algebra of 2×22 \times 2 rational matrices is a quaternion algebra over \mathbb{Q}. But there seems to be something more going on here: some extension of the correspondence between conics and quaternion algebras over fields to certain more general commutative rings, including \mathbb{Z} but also maybe all integral domains or something.

Why are Gille and Szamuely talking about conics and quaternion algebras? Because the correspondence between these led people to the more general correspondence between central simple algebras over a field kk and Severi–Brauer varieties over that field, which are varieties that become isomorphic to projective space when we pass to the algebraic closure k¯\overline{k}. Attempting to classify these things led folks like Brauer, Hasse and Noether to invent what we’d now Galois cohomology, leading inexorably to modern homological algebra and descent theory. A great historical account is here:

I learned a lot of algebra from this paper; it’s a good supplement to Gille and Szamuely’s book.

But I digress. Gille and Szamuely write:

It is a well-known fact from algebraic geometry that a smooth projective conic defined over a field kk is isomorphic to the projective line P 1\mathrm{P}^1 over kk if and only if it has a kk-rational point. The isomorphism is given by taking the line joining a point PP of the conic to some fixed kk-rational point OO and then taking the intersection of this line with P 1\mathrm{P}^1 embedded as, say, some coordinate axis in P 2\mathrm{P}^2.

As far as I can tell, a ‘kk-rational point’ is just a point defined over the field kk (rather than some algebraic extension). So they’re saying a smooth projective conic over a field kk that has any points in this simple sense must be isomorphic to the projective line kP 1k\mathrm{P}^1. And their sketched proof of this generalizes the argument I presented above for k=k = \mathbb{Q}. Discussing this over on the Category Theory Community Server, I got some help from people like Morgan Rogers, who pointed out the lemma used above. This lemma should guarantee that if a line in kP 2k\mathrm{P}^2 intersects a conic transversally at one point it intersects it in some other point.

Posted at April 17, 2024 9:52 AM UTC

TrackBack URL for this Entry:

3 Comments & 0 Trackbacks

Re: Pythagorean Triples and the Projective Line

When computing the intersection points, I find it easier to use the parametric form of the line, so (0,1)+t(q,1)(0,1)+t(q,-1), the reason being that t=0t=0 is one intersection point. Explicitly 0=x 2+y 21=t 2q 2+(1t) 21=t(t(q 2+1)2), 0 = x^2+y^2-1 = t^2q^2 + (1-t)^2 - 1 = t(t(q^2+1)-2), so the other point of intersection is when t=2/(q 2+1)t=2/(q^2+1), yielding of course the point (2q/(q 2+1),(q 21)/(q 2+1)). (2q/(q^2+1),(q^2-1)/(q^2+1)).

Posted by: Andrew Hubery on April 17, 2024 4:33 PM | Permalink | Reply to this

Re: Pythagorean Triples and the Projective Line

That’s certainly a lot more efficient! For some reason I didn’t think of using a parametric equation. Oh well, the long way around was fun too.

Posted by: John Baez on April 18, 2024 11:56 AM | Permalink | Reply to this

Re: Pythagorean Triples and the Projective Line

We actually learn these formulas very early on, because the “demeaning labor” is just working out the half-angle formula: f(tan(α))=(sin2α,cos2α)f(\tan(\alpha))=(\sin\,2\alpha, \cos\,2\alpha).

From the “Pythagorean triple” Wikipedia, there’s also the Gaussian integer construction:

  • Let z=a+biz=a+bi be a Gaussian integer. (a,b,c)(a,b,c) is a Pythagorean triple if and only if N(z)=zz¯=c 2N(z)=z\bar{z}=c^2 is a square number.
  • Since N(z 2)=N(z) 2N(z^2)=N(z)^2 is a square number, z 2=(a 2b 2)+(2ab)iz^2=(a^2-b^2)+(2a b)i always gives a Pythagorean triple.
  • Writing and proving a converse statement takes a lot more work.

Squaring the complex number doubles the angle, so this is kind of the same thing. Well, it only matches up if we ignore the magnitude of the complex number, so let’s do that:

  • Let z=1+qiz=1+q i. Then w=z 2/N(z)=z/z¯w=z^2/N(z)=z/\bar{z} is a point on the unit circle in the complex plane (and is just f(q)f(q) in a different coordinate system).
  • Since w=1+qi1qiw=\frac{1+q i}{1-q i}, we have q=i1w1+wq=i\frac{1-w}{1+w}.
  • As a result, q[i]q \in\mathbb{Q}[i] if and only if w[i]w\in\mathbb{Q}[i].
Posted by: unekdoud on May 19, 2024 11:13 AM | Permalink | Reply to this

Post a New Comment