## Sometimes the math is just gross

Programming is a little game. My opponent, past Ryan, introduces a problem into
my code and I, present Ryan, program a solution. When the dust settles and
I review my work I often find it inelegant. Ugly, even. *Would a mathematician
accept this approach? Surely I’ve made some grave error: I’ve overspecialized
too early, overlooked some obvious structure inherent in the problem…* It’s
a frustrating feeling, and I have been trying to avoid it by remembering that
good solutions don’t have to be elegant.

Some math must be taught via counterexample. The teacher makes a conjecture at the board.

Continuous functions are differentiable.

Then, as the class watches in horror, the teacher constructs a concrete counterexample.

Define for nonzero and set . Try to differentiate at the origin.

The presentation of the counterexample is at once an argument against the false conjecture and an argument for a better one, a theorem which avoids such “monsters.”

This post describes a concrete counterexample to an informal conjecture: to be good, a solution has to be elegant. Sometimes, as I’m going to show, there’s nothing pleasant about the right thing.

My example is the Stark-Heegner theorem. I’ve picked a theorem from math rather than some kind of software artifact because I want to emphasize that math isn’t naturally more beautiful than other lines of work. I keep the story of this theorem in my pocket for when I’m dissatisfied with my work, and I hope it’s useful to you too.

### Quadratic number fields and their rings of integers

We need to make a whirlwind tour of abstract algebra before we can state the theorem. It’s been about two years since I last took an algebra course and I think I sold my textbook, so this is all cobbled together from Wikipedia and some survey papers. If anything seems off, let me know and I can fix it. If you taught me algebra, I apologize in advance.

Recall the rational numbers . They’re nice enough, but they’re
missing lots of other things we like to call numbers, like or
. We can tack all these missing *irrational numbers* onto
in one fell swoop using Dedekind cuts or Cauchy sequences. This gets us the real
numbers , which have enough analytic structure to support things
like continuity and differentiation.

However, they have some algebraic gaps. If we’ve got a polynomial with numbers for coefficients, won’t it have numbers for roots? For real numbers, the answer is no: we can’t solve in . To fill this gap, we introduce the imaginary unit as a solution to our equation and then make sure all our algebraic operations still work. This gives us the complex numbers , whose elements act like for some real numbers and .

In algebra, we say that we’ve *adjoined* the element to the
field to obtain the *field extension* of
. We write . This operation makes
sense on any field, that is, on any set supporting addition, multiplication, and
division operations obeying some reasonable axioms. The Stark-Heegner theorem
involves a particular class of field extensions, the *quadratic field
extensions* .

The first thing we ought to notice is that the only values of that matter
are *square-free*. If divides for some integer , then there’s
an smaller than such that and .
Since is just an integer, this means .

Let for square-free. We call a polynomial
with a leading coefficient a *monic polynomial*. In , the
roots of monic polynomials with coefficients in are the integers
and nothing else. However, if we look for roots in we sometimes get more
than just the ordinary integers. That’s okay, because the roots still form
a *ring*: they’re closed under multiplication and addition (but not division).
We call this ring the *ring of integers in * and denote it by
.

Rings have *ideals*, which are the nonempty subsets closed under addition and
absorbing under multiplication. For example, the even numbers are an ideal in
: adding even numbers gets you an even number, and multiplying an
even number by any integer gets you an even number. The even numbers are
*generated* by : you can write an even number as for some
integer , and for all integers , is even. In arbitrary rings
, ideals do not always have unique generators: sometimes you need a few
generators, and you take linear combinations of them with coefficients in
to generate the ideal.

A ring in which this never happens and all ideals can be generated by a single
element is called a *principal ideal domain*. These are particularly nice
objects: in particular, rings of integers that are principal ideal domains admit
unique factorization into prime elements, just like in the natural numbers. For
a long time, mathematicians have wanted to figure out which quadratic field
extensions have rings of integers that are principal
ideal domains. It turns out that for imaginary quadratic extensions, those
extensions in which we adjoin the square root of a negative number, this
question has been settled.

### 160 years of toil

The Stark-Heegner theorem goes like this.

Theorem.There are finitely many square-free negative integers for which the ring of integers in is a principal ideal domain.

Well, that’s not really it. Here’s the real thing.

Theorem.There are exactly nine square-free negative integers for which the ring of integers in is a principal ideal domain, and they are and .

It’s not elegant. It’s ugly and it’s frustrating. Why stop at ? Is this some kind of joke? It took 160 years of collective toil to produce satisfactory answers to these two questions: a long proof, and “No.”

Gauss came up with the list of what are now known as Heegner numbers by
computing the *class number* of many rings of integers by hand. The class number
is 1 if and only if the ring is a principal ideal domain. He came up with the
above list of values for and conjectured that it was complete.

That was at the turn of the 19th century. Plenty of mathematicians looked at the list and felt frustrated. It’s maddening. Why no others? Even more maddening, some 130 years later, was a result of Heilbronn and Linfoot showing that there are at most 10 valid values for :

\[d = -1, -2, -3, -7, -11, -19, -43, -67, -163,\ ???\]

Now this was high drama. God created the integers, but did He create a tenth ?

In 1952, a German high school teacher named Kurt Heegner published a proof showing that there is no tenth value for . But his proof took some leaps of faith and, worse yet, was “written in an amateurish and rather mystical style” that made heavy use of results proved in a poorly regarded algebra textbook. You can see where this is going: no one accepted his proof. He died in 1965 an anonymous Berliner.

It was left to Harold Stark, a young American mathematician, to cross the finish line. He learned enough German to decipher Heegner’s work and in 1967 published a proof similar to Heegner’s. This isn’t to say that he simply unearthed Heegner’s work and dusted it off. His approach was different enough that it could rightfully be called a distinct proof, and he later published a paper specifically devoted to closing “the gap” in Heegner’s proof.

The theorem carries Stark and Heegner’s names, but results like these are not proved alone. There were important contributions from Baker, Siegel, and Deuring around the same time. For more historical and mathematical details, I recommend Dorian Goldfeld’s survey paper.

### What’s the point

There are better measures of importance and quality than elegance. Exciting and worthwhile work can be clunky. Even the objectives of the work can be clunky. It’s fine.