# Geometry of Pythagorean triples on the unit circle

This question arose from my trying to independently prove that pythagorean triples are dense on the unit circle.

Suppose I normalize pythagorean triples so that they lie on the unit circle. Given two such pythagorean triples $P_1=(x_1,y_1)$ forming an angle $\theta_1$ with the non-negative $x$-axis and $P_2=(x_2, y_2)$ forming an angle $\theta_2$ I can perform the geometric operation of rotating $P_1$ by $\theta_2$ to create another pythagorean triple (shown via trig identities).

My questions are:

What is know about such an operation? Is it related to other methods of generating pythagorean triples?

This operation defines a group. Is it interesting? A cursory look at suggests it has no torsion.

• This is a great question! Yes, the group is interesting, but NB in order that it really is a group, we have to include the degenerate triples with one zero leg and triples with one or both legs negative. In fact, the group is precisely $SO(2, \mathbb{Q})$, and is an infinite sum of cyclic groups. See en.wikipedia.org/wiki/… Certainly it is not torsion-free, as the element $(0, 1)$ has order $4$. – Travis Willse Mar 21 '15 at 6:25
• You've probably already figured this out, but to show that Pythagorean triples are dense on the unit circle along these lines it suffices to find one such that, when normalized to lie on the unit circle, the corresponding angle $\theta$ is not a rational multiple of $\pi$. This is fairly straightforward, e.g. $\left( \frac{3}{5}, \frac{4}{5} \right)$ has this property. – Qiaochu Yuan Mar 21 '15 at 7:03

There's a lot to say here; here are some comments off the top of my head.

It's more natural to look at all rational points on the circle $x^2 + y^2 = 1$ (so to allow zero and negative values of $x, y$). In fact, let $R$ be any commutative ring. Then the $R$-rational points on the circle (by which I mean the set of all pairs $(x, y) \in R^2$ such that $x^2 + y^2 = 1$) naturally form a group, which one might call $\text{SO}_2(R)$, with group operation the cosine and sine angle addition formula

$$(x_0, y_0) \cdot (x_1, y_1) = (x_0 x_1 - y_0 y_1, x_0 y_1 + x_1 y_0).$$

This is equivalently the group of all $2 \times 2$ matrices over $R$ with determinant $1$ whose transposes are their inverses, with the group operation given by matrix multiplication. As $R$ ranges over all commutative rings, $\text{SO}_2(-)$ organizes itself into a group scheme.

Now suppose that $R = k$ is a field. There is a standard geometric method for producing $k$-valued points on the circle, which is the following: consider a line through the point $(-1, 0)$ with slope lying in $k$. Then it intersects the circle at at most one other point, which must also have coordinates lying in $k$. Conversely, any $k$-rational point on the circle is connected to $(-1, 0)$ by a line with slope in $k$. This reproduces the standard method of generating Pythagorean triples when $k = \mathbb{Q}$, but it is also applicable, for example, to finite fields.

Explicitly, writing

$$x = t - 1, y = st$$

for the parametric equation of a line of slope $s$ passing through $(-1, 0)$, we get that the other intersection point satisfies

$$(t - 1)^2 + (st)^2 = (1 + s^2) t^2 - 2t + 1 = 1$$

and hence that $t = \frac{2}{1 + s^2}$, which gives the standard rational parameterization

$$x = \frac{1 - s^2}{1 + s^2}, y = \frac{2s}{1 + s^2}.$$

Over $\mathbb{R}$, if we write $x = \cos \theta, y = \sin \theta$, then a straightforward geometric argument gives $s = \tan \frac{\theta}{2}$. Hence, in terms of this new coordinate $s$, the group operation is now given by the tangent angle addition formula.

This doesn't happen over $\mathbb{Q}$, but in general, e.g. over finite fields, it sometimes happens that $1 + s^2 = 0$, in which case the corresponding points are undefined. If we work projectively then these points get interpreted as points at infinity. Counting solutions to equations over finite fields leads to some deep waters, and counting solutions to quadratic equations over finite fields in particular can be used to, for example, prove quadratic reciprocity.

From a more number-theoretic point of view, for a field $k$ the $k$-rational points on the circle can also be interpreted as the group of elements of norm $1$ in $k[i]$. In this direction see, for example, Hilbert's Theorem 90 for another way to arrive at the standard parameterization of Pythagorean triples.

Here the group operation over $\mathbb{Q}$ is interpreted as multiplication in the fraction field of the Gaussian integers $\mathbb{Z}[i]$, and so one way to figure out how it behaves is to understand unique prime factorization for the Gaussian integers. (Compare: one way to figure out how $\mathbb{Q}^{\times}$ behaves is to understand unique prime factorization for the integers.) Once you know how this works it's not hard to prove the description of $\text{SO}_2(\mathbb{Q})$ given by Travis's link in the comments.

This whole story can be thought of as a degenerate case of the corresponding story for elliptic curves; take a look at the group operation on Edwards curves.

• This is an especially nice answer, Qiaochu! – Travis Willse Mar 21 '15 at 9:46