## April 17, 2024

### Pythagorean Triples and the Projective Line

#### Posted by John Baez

Pythagorean triples like $3^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^2$ gives a point with rational coordinates on the unit circle:

$(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 $\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 $\mathbb{Q}\mathrm{P}^1$.

It’s true! And since $\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 $\mathbb{R}\mathrm{P}^1$ and the unit circle $S^1$. To do this, we think of $\mathbb{R}\mathrm{P}^1$ as the $x$ axis in the plane together with a point at infinity. Then we map each point on the $x$ axis to a point on the unit circle by drawing a straight line through that point and the ‘north pole’ $(0,1)$ and seeing where it hits the circle:

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

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

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

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

$x = q(1-y)$

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

$x^2 + y^2 = 1$

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

$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 $q$ is rational! We could work it out and see, but a general principle saves us from this demeaning labor:

Lemma. If $a x^2 + b x + c$ is a quadratic with coefficients $a,b,c$ in some field $k$, and this quadratic has one root $r_1$ in $k$, then the quadratic factors as $a(x-r_1)(x-r_2)$ in this field $k$.

Our equation $q^2(1-y)^2 + y^2 = 1$ has rational coefficients when $q$ is rational, and we know it has one rational solution, namely $y = 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 $q$ is rational so is $y$, and then $x = (1-q)y$ is as well, so $f(q) = (x,y)$ is a point on the rational unit circle.

Since lines from the north pole to rational points on the $x$ 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)$. 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 (1-y)^2 + y^2 = 1$

or in other words

$(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 = 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 $a x^2 + b x + c$ is a quadratic with coefficients $a,b,c$ in some field $k$, and this quadratic has one root $r_1$ in $k$, then the quadratic factors as $a(x-r_1)(x-r_2)$ for some $r_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_2$. The quadratic must factor in the algebraic closure of $k$, so

$a x^2 + b x + c = a(x-r_1)(x-r_2)$

for $r_1, r_2 \in \overline{k}$. Thus

$b = - a(r_1 + r_2)$

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

$r_2 = - \frac{b}{a} - r_1$

If the coefficients $a,b$ are in $k$ and the root $r_1$ is in $k$, it follows that the root $r_2$ is also in $k$. $\quad$

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

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

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

That’s the root we want, so

$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 = \frac{q^2 - 1}{q^2 + 1}$

which is much more cute. Then we get

$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 = \frac{2q}{q^2 + 1}$

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

$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 = 100$, and pop it into our formula for $f$. We get

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

This means that

$\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$

Nice!

The unit circle is an example of a ‘conic’. Other examples include ellipses, hyperbolas and parabolas. Conics can be studied over any field $k$, 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$

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 $\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 \times 2$ integer matrices lurking behind Trautman’s work on Pythagorean spinors and the modular group. At least the algebra of $2 \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 $k$ and Severi–Brauer varieties over that field, which are varieties that become isomorphic to projective space when we pass to the algebraic closure $\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 $k$ is isomorphic to the projective line $\mathrm{P}^1$ over $k$ if and only if it has a $k$-rational point. The isomorphism is given by taking the line joining a point $P$ of the conic to some fixed $k$-rational point $O$ and then taking the intersection of this line with $\mathrm{P}^1$ embedded as, say, some coordinate axis in $\mathrm{P}^2$.

As far as I can tell, a ‘$k$-rational point’ is just a point defined over the field $k$ (rather than some algebraic extension). So they’re saying a smooth projective conic over a field $k$ that has any points in this simple sense must be isomorphic to the projective line $k\mathrm{P}^1$. And their sketched proof of this generalizes the argument I presented above for $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 $k\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:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3526

### 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)$, the reason being that $t=0$ is one intersection point. Explicitly $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)$, yielding of course the point $(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(\alpha))=(\sin\,2\alpha, \cos\,2\alpha)$.

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

• Let $z=a+bi$ be a Gaussian integer. $(a,b,c)$ is a Pythagorean triple if and only if $N(z)=z\bar{z}=c^2$ is a square number.
• Since $N(z^2)=N(z)^2$ is a square number, $z^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+q i$. Then $w=z^2/N(z)=z/\bar{z}$ is a point on the unit circle in the complex plane (and is just $f(q)$ in a different coordinate system).
• Since $w=\frac{1+q i}{1-q i}$, we have $q=i\frac{1-w}{1+w}$.
• As a result, $q \in\mathbb{Q}[i]$ if and only if $w\in\mathbb{Q}[i]$.
Posted by: unekdoud on May 19, 2024 11:13 AM | Permalink | Reply to this

Post a New Comment