When you order rational points on the circle $X^2 + Y^2 = 2$ by height, these points equidistribute.

Stated differently, suppose that $I$ is an arc on the circle $X^2 + Y^2 = 2$. Then asymptotically, the number of rational points on the arc $I$ with height bounded by a number $H$ is equal to what you would expect if $\lvert I\rvert /2\sqrt{2}\pi$ of all points with height up to $H$ were on this arc. Here, $\lvert I\rvert /2\sqrt{2}\pi$ the ratio of the arclength of the arc $I$ with the total circumference of the circle.

This only makes sense if we define the height of a rational point on the circle. Given a point $(a/c, b/c)$ (written in least terms) on the circle, we define the height of this point to be $c$.

In forthcoming work with my frequent collaborators Chan Ieong Kuan, Thomas Hulse, and Alexander Walker, we count three term arithmetic progressions of squares. If $C^2 – B^2 = B^2 – A^2$, then clearly $A^2 + C^2 = 2B^2$, and thus a 3AP of squares corresponds to a rational point on the circle $X^2 + Y^2 = 2$. We compare one of our results to what you would expect from equidistribution. From general principles, we expected such equidistribution to be true. But I wasn’t sure how to prove it.

With helpful assistance from Noam Elkies, Emmanuel Peyre, and John Voight (who each immediately knew how to prove this), I learned how to prove this fact.

The rest of this note contains this proof.

## A quick aside on the height function

*Which height function is natural* is itself a natural question. Perhaps the most obvious height function would come from looking at the magnitude of a point on the circle after homogenization. Rational points on $X^2 + Y^2 = 2$ are the same as integer points on $X^2 + Y^2 = 2Z^2$. If $p = (x : y : z)$ is such a point, then perhaps the most natural definition of the *size* of this point would be $\lvert p \rvert = x^2 + y^2 + z^2$.

But since this point satisfies $x^2 + y^2 = 2z^2$, we have that

$$ \lvert p \rvert = 3z^2,$$

which is essentially the same as the height we actually use. Ordering rational points $(x, y)$ on $X^2 + Y^2 = 2$ by the size of the denominator is the same ordering of points $p$ on $X^2 + Y^2 = 2Z^2$ by $\lvert p \rvert$.

Thus this actually is a natural notion of height.

## Strategy of proof

To prove this equidistribution, we do the following steps.

- Parametrize rational points by projection,
- Study the problem in the parametrization space,
- Translate this problem into a lattice-point problem in regions,
- Then we execute this lattice-point counting argument.

## Parametrization of points

Rational points on $X^2 + Y^2 = 2$ are the same as integer points on $X^2 + Y^2 = 2Z^2$. These points are parametrized by

$$

(x:y:z) = (m^2 + 2mn – n^2 : m^2 – 2mn – n^2 : m^2 + n^2).

$$

This is a classical argument. The idea is to find a rational point (like $(-1, -1)$) and then consider lines with rational slope $t$ through this point. Every rational point on the circle will appear from such a slope (with the exception of the single point $(-1, 1)$, which would have infinite slope).

Projecting from this point gives rational points in terms of the rational parameter $t = m/n$. Clearing denominators gives the result.

Although this is not a complicated argument, it can be done in sage.

```
var('x y t')
show(solve([
x^2 + y^2 == 2,
y == t*(x+1) + 1
], [x, y]))
```

## Understanding primitive points

When counting rational points, we do not want to count (for example) $(-1, -1)$ and $(-2/2, -2/2)$, as these are the same point. Stated projectively, we want to count each point $(x : y : z) \in \mathbb{P}^2(\mathbb{Z})$ precisely once (and use its simplest form as its height, of course). These are primitive points.

We need to find conditions for $m,n$ such that the parametrization of points in terms of $m$ and $n$ yields only the primitive points. Each primitive point corresponds to a pair $(\pm m,\pm n)$ such that $\gcd(m,n)=1$ and the parity of $m$ is opposite from the parity of $n$.

It is very easy to see that if either $\gcd(m,n) \neq 1$ or if the parities of $m$ and $n$ are the same, then the resulting point $(x : y : z)$ is not primitive.

Conversely, suppose that the resulting point $(x : y : z)$ is not primitive. Then $\gcd(m^2 – 2mn – n^2, m^2 + 2mn – n^2, m^2 + n^2) > 1$, and thus

$$ \gcd(4mn, m^2 + n^2) = g > 1.$$

The prime factors of $4mn$ are exactly $2$ and the primes diving $m$ and $n$. If $p \mid g$ divides $m$ or $n$, then it divides $m^2 + n^2$, and thus $p \mid \gcd(m, n)$. If $2 \mid g$, then $2 \mid m^2 + n^2$, and thus the parities of $m$ and $n$ are the same.

Thus we see that primitive points are precisely those obtained from $(m, n)$ with $\gcd(m,n) = 1$, $m, n$ having opposite parity, and $m \geq 0$.

## Equidistribution in terms of the parametrization

In terms of the parametrization $$ (x : y : z) = (m^2 – 2mn – n^2, m^2 + 2mn – n^2, m^2 + n^2),$$ one can explicitly check that

$$ (1+i)(m-in)^2 = x + iy.$$

(Noam Elkies pointed this out to me). Thus points $(x, y)$ are equidistributed (when ordered by denominator) if and only if the numbers $m + in$ are angularly equidistributed (when ordered by $m^2 + n^2$).

To prove this, we study the following question: given an arc $I = [\theta_1, \theta_2]$, how many pairs $(m, n)$ (with $\gcd(m, n) = 1$, where $m$ and $n$ have opposite parity, and where $m^2 + n^2 \leq H$) project to the arc $I$ under $m+in \mapsto (m+in)/\lvert m + in \rvert$? We want to show that the answer to this question is linear in the length of the arc $I$; this would give the required equidistribution for $m + in$, and thus for our initial question.

## A lattice point problem

The points $m + in$ form the typical $\mathbb{Z}^2$ lattice when $m$ and $n$ are unconstrained. We can handle the gcd condition later, but the opposite parity condition is annoying. Points $m+in$ when $m$ and $n$ are constrained to have opposite parity *do not* form a lattice. For example, $(1, 2) + (1, 2) = (2, 4)$, which is unfortunate.

But points $m + in$ where $m$ and $n$ are constrained to have **the same** parity do form a lattice. Let $\Lambda_1$ be the typical $\mathbb{Z}^2$ lattice formed from all $m + in$ as $m, n$ range across $\mathbb{Z}$. Let $\lambda_2$ be the lattice formed from $m + in$ where $m, n$ have the same parity. The points we are interested in are precisely those points in $\Lambda_1 \backslash \Lambda_2$.

Now we ask: which points in $\Lambda_1$ and $\Lambda_2$ project to a given arc under the projection map $z \mapsto z/\lvert z \rvert$, and have $\lvert z \rvert \leq H$? These are precisely the points contained within the region

$$

\Omega_H =

\{ re^{i\theta} : 0 \leq r \leq H, \theta_1 \leq \theta \leq \theta_2 \}.

$$

For a given lattice $\Lambda$, we can mimic Gauss’s heuristic for the Gauss Circle Problem to approximate the number of points $N(H; \Lambda)$ contained within the region $\Omega_H$. The Gaussian heuristic gives the estimate

$$

N(H; \Lambda) = \mathrm{Area}(\Omega_H) \cdot \rho(\Lambda)

+ O(\lvert \delta \Omega_H \rvert) + O(1),

$$

where $\rho(\Lambda)$ is the density of the lattice $\Lambda$ (how many lattice points there are per unit square, on average), and where $\lvert \delta \Omega_H \rvert = O(H)$ is the length of the boundary of the region $\Omega_H$.

The density of $\Lambda_1$ is $1$. The density of $\Lambda_2$ is $1/2$. Thus the number of points $(m, n)$ with $m, n$ having opposite parity that project to the arc $I$ and which have $m^2 + n^2 \leq H^2$ is given by

$$

N(H) = \mathrm{Area}(\Omega_H) \cdot \tfrac{1}{2}

+ O(H) + O(1).

$$

## Removing imprimitive points

Finally, we restrict attention to primitive points (equivalently, points where $\gcd(m, n) = 1$) through an inclusion-exclusion argument. Notice that if $(n, m)$ is a point in our region, then the points $(3n, 3m)$, $(5n, 5m)$, and so on are also in the region. (But **not** the point $(2n, 2m)$, as this violates the parity constraint).

To remove them, we can thus use inclusion-exclusion (e.g. remove points such that $(3n, 3m)$ are counted, and points such that $(5n, 5m)$ are counted, but then add back in points such that $(15n, 15m)$ should be counted, etc.). This is accomplished by the mobius sum $$\widetilde{N}(H) = \sum_{d \leq H, 2 \nmid d} \mu(d) N(h/d).$$

From the Gaussian heuristic and the fact that $\mathrm{Area}(\Omega_H) =A H^2$ for the constant $A = \pi \cdot (\theta_2 – \theta_1)/2\pi$, we have that

$$\widetilde{N}(H)

= A H^2 \cdot \frac{1}{2} \sum_{d \leq H, 2 \nmid d} \frac{\mu(d)}{d^2} + O\Big( \sum_{d \leq H}

\frac{H}{d} \Big) + O(H).

$$

The error term is of size $O(H \log H)$. The main can be understood by extending the sum to all $d \geq 1$ with $2 \nmid d$. This introduces an error term bounded by

$$

\sum_{d \geq H} \frac{H^2}{d^2} \ll H,

$$

which is swallowed by the other error term. And thus we have that

$$\widetilde{N}(H) = \pi\frac{\theta_2 – \theta_1}{2\pi} \frac{H^2}{2} \sum_{d \geq

1, 2 \nmid d} \frac{\mu(d)}{d^2} + O(H \log H).$$

The sum is exactly $$\frac{1}{\zeta^{(2)}(2)} = \frac{8}{\pi^2},$$ where $\zeta^{(2)}(s)$ is the Riemann zeta function, but with the $2$-factor of the Euler product removed. This gives the evaluation $$\widetilde{N}(H) = \frac{\theta_2 – \theta_1}{2\pi} H^2 \frac{4}{\pi} + O(H \log H).$$

And thus the number of points that project to the arc $I$ is linear in the length of the arc, as expected. The points equidistribute as claimed.

## An alternate computation for the total number of points

From the relationship $(x + iy) = (1 + i)(m – in)^2$, an arc of length $\ell$ in $(m, n)$ coordinates will correspond to an arc of length $2\ell$ in $(x + iy)$ coordinates.

On the other hand, $N(H)$ as defined above counted all $n, m$ of opposite parity, with $n^2 + m^2 \leq H^2$, such that $m+in$ projected to the arc $I$. This includes points with $m$ coordinate positive and negative. But from the analysis of primitive parameters above, we see that this double counts actual lattice points $x + iy$ (as $(-m, -n)$ and $(m, n)$ correspond to the same lattice point).

These two facts are deeply related. The effect is that the asymptotic $\widetilde{N}(H)$ above counts lattice points in $(x, y)$ coordinates. (That is, the doubling of the arc length and the double-counting of points cancel each other).

It follows that if we were to take an arc of length $2\pi$, i.e. take the whole circle, we have computed that there will be

$$

\widetilde{N}(H) = \frac{4}{\pi}H^2 + O(H \log H)

$$

points in the circle.

We can compute this in another way.

Let $A(b)$ denote the number of rational points on $x^2 + y^2 = 2$ of the (reduced) form $(a/b, c/b)$. We see that

$$

\sum_ {d \mid b} A(d)= \#\{(a, c) \in \mathbb{Z}^2 : a^2 + c^2 = 2b^2\} = r_ 2(2b^2) = r_ 2(b^2),

$$

where $r_2(n)$ is the number of ways of writing $n$ as a sum of $2$ squares. The function $r_2(n)/4$ is multiplicative, and we can compute the Dirichlet series

$$

\sum _{n \geq 1} \frac{A(n)}{n^s} =

\frac{4 \zeta(s) L(s, \chi _4)}{(1 + 2^{-s})\zeta(2s)},

$$

where $\chi _4 = (\frac{-1}{\cdot})$ is the non-trivial character of modulus $4$. This can be seen upon comparing Euler products.

A simple application of Perron’s formula then shows that the number of rational points on $x^2 + y^2 = 2$ of the (reduced) form $(a/b, c/b)$ with $b \leq X^2$ is

$$

\sum _{b \leq X^2} A(b) =

\frac{4}{\pi} X^2 + O(X^{\frac{4}{3} + \epsilon}).

$$

The leading asymptotics agree! (And a more sophisticated analysis in the Perron estimate would allow one to lower the error there).