← Recreational maths

Conway's topograph

John Conway had a way of drawing every value of a binary quadratic form $Q(x, y) = ax^2 + bxy + cy^2$ on one picture, so that the arithmetic can be read off by eye. He called it the topograph. It is a tree in which every vertex has three edges, drawn in the plane so that it divides the plane into infinitely many regions. Each region is labelled by a value $Q(x, y)$ at a primitive vector $(x, y)$, taken up to sign, and every primitive vector appears exactly once.

2510172913342551325341029175101726532973581334658925744151325417434896510295873175326121x² + y²-127141717-2-7-14-23-41-17-46-31-7-17-31-49-94-46-119-89-14-41-82-103-23-73-3421-2-7-1714177173146144123-2-11x² − 2y²
Topographs of $x^2 + y^2$ (left) and $x^2 - 2y^2$ (right), drawn five levels deep. On the left the values climb away from the central edge between the two $1$s. On the right a marigold river separates the positive values from the negative ones and repeats periodically.

How to build it

Start with three regions meeting at a vertex, labelled with $Q(1, 0) = a$, $Q(0, 1) = c$ and $Q(1, 1) = a + b + c$. Everything else follows from one rule:

Arithmetic progression rule. If two regions with values $e$ and $f$ share an edge, and the regions at the two ends of that edge have values $g$ and $h$, then $g$, $e + f$, $h$ form an arithmetic progression: $g + h = 2(e + f)$.

So each new region gets the value $2(e + f) - g$, and the picture can be grown outward as far as you like with nothing but addition. The regions correspond to the fractions $x/y$ (the topograph is dual to the Farey tessellation), the edges to bases of $\mathbb{Z}^2$, and the vertices to "superbases" $\{u, v, u + v\}$.

Reading it

Positive definite forms such as $x^2 + y^2$ have a "well": a place where the values are smallest, and moving away from it the values only increase. Conway calls this the climbing lemma. So the smallest values, and the reduced form of Gauss, can be found by walking downhill. The values of $x^2 + y^2$ in the picture, $1, 1, 2, 5, 10, 13, 17, 25, \dots$, are the sums of two coprime squares.

Indefinite forms such as $x^2 - 2y^2$ take both signs, and the edges separating positive from negative values form a single infinite path, the river. The values along the river repeat periodically, and one period of the river encodes the fundamental solution of the Pell equation: here $x^2 - 2y^2 = 1$ first at $(3, 2)$. The period also corresponds to the period of the continued fraction of $\sqrt2$. The modular surface lab shows the same Farey structure from the hyperbolic side, and the post on Markov numbers uses topographs of indefinite forms.

Full proof: the arithmetic progression rule

Lemma. For any binary quadratic form $Q$ and vectors $u, v$, $Q(u + v) + Q(u - v) = 2Q(u) + 2Q(v)$.

Proof. Let $B(u, v) = Q(u + v) - Q(u) - Q(v)$, which is bilinear because $Q$ is a quadratic form. Then $Q(u + v) = Q(u) + Q(v) + B(u, v)$ and $Q(u - v) = Q(u) + Q(v) - B(u, v)$. Adding gives the claim. $\square$

An edge of the topograph separates the regions of $u$ and $v$, where $\{u, v\}$ is a basis of $\mathbb{Z}^2$; its two endpoints are the superbases $\{u, v, u + v\}$ and $\{u, v, u - v\}$, so the regions at the ends are $u + v$ and $u - v$ (up to sign, which does not change $Q$). With $e = Q(u)$, $f = Q(v)$, $g = Q(u+v)$ and $h = Q(u - v)$, the lemma says $g + h = 2(e + f)$.

Further reading

  • J. H. Conway, The Sensual (Quadratic) Form, Carus Mathematical Monographs 26, MAA, 1997.
  • A. Hatcher, Topology of Numbers, AMS, 2022 (draft freely available on the author's website).
  • D. A. Cox, Primes of the Form $x^2 + ny^2$, 2nd ed., Wiley, 2013.