Choose a positive integer \(n\) and look at what numbers can be written as \(x^2+ny^2\). Because \[ (x^2+ny^2)(u^2+nv^2)= (xy-nyv)^2 + n(xv+yu)^2,\] the product of two such numbers can also be written in that form. So the first question to address is which *prime* numbers can be expressed that way. That is what this book is about. Since it is a massive 533 pages, it must be the case that the question is quite hard to answer. As the subtitle suggests, a lot of mathematics comes into play.

Most mathematics books chase a topic or a theory. This one chases a particular question from the first results, due to Fermat, all the way to a complete solution. The author does his best to keep the reader with him all along, but it’s a long road.

Fermat managed to find complete solutions for \(n=1,2,3\). He showed that in those cases there is a congruence condition on the prime \(p\) that decides the question. For example:

Every prime number which surpasses by one a multiple of four is composed of two squares. …

Every prime number which surpasses by one of three a multiple of eight is composed of a square and the double of another square.…

Those seem straightforward enough, and suggest a conjecture that the primes that can be written as \(x^2+ny^2\) are determined by a congruence condition modulo \(4n\). Alas, that is not true.

Fermat did not, of course, give a proof of his three theorems; he rarely shared his proofs. Euler gave the first proofs, which revealed a link between \(p=x^2+ny^2\) and quadratic residues modulo \(p\). We can express it using the language later introduced by Gauss: if \(x^2+ny^2=p\) then \(x^2\equiv -ny^2\pmod p\), which implies that \(-n\) is congruent to a square modulo \(p\). That gives a necessary condition: if \(p=x^2+ny^2\) then \(-m\) must be a square modulo \(p\). Using the quadratic reciprocity law first proved by Gauss, we can see that this is indeed a congruence condition modulo \(4n\). So what is happening in Fermat’s three cases is that the necessary condition is also sufficient.

We reach that point on page 17 of what turns out to be a 300-page story. There is a lot more to come. Here are some examples:

\(p=x^2+27y^2\) if and only if \(p\equiv 1\pmod 3\) and the congruence \(x^2\equiv 2 \pmod p\) has a solution. (p. 64)

or, even weirder,

\(p=x^2+55y^2\) if and only if \(p\neq 5, 11\), \(-55\) is a square mod \(p\) and the congruence \((x^2-3)^2\equiv 30 \pmod p\) has a solution. (p. 378)

The book is divided into three chapters. The first, “From Fermat to Gauss,” is the most varied. It starts with Euler’s elementary argument, then goes into the theory of binary quadratic forms, Gauss’s genus theory, and finally cubic and biquadratic reciprocity. The second chapter, “Class Field Theory,” introduces quadratic imaginary number fields and develops enough class field theory to prove a general theorem about \(p=x^2+ny^2\): except for finitely many primes, we have \(p=x^2+ny^2\) if and only if \(-n\) is a square mod \(p\) *and* some polynomial congruence has a solution mod \(p\). In other words, the results we quoted above are typical.

The general theorem we reach at the end of chapter 2 does not allow us to find the required polynomial congruence explicitly. That is the goal of chapter 3, “Complex Multiplication.” It brings in modular and elliptic functions, complex multiplication, and leads to many explicit formulas. A final chapter on “Additional Topics” introduces elliptic curves and Shimura reciprocity. That last section was introduced in the second edition and has been revised and improved for this edition.

As this outline suggests, the book is quite a ride. We start from elementary number theory and end up in waters that are very deep indeed. In the process, we see many proofs, but not all theorems are given full proofs. The focus, instead, is on the developing narrative. The story is brilliantly told, but the theoretical (and notational!) demands grow steeply.

For most readers, the experience is likely to be something like this. At first, we are reading familiar material and can nod along. Then we find ourselves learning new stuff, but it is still close enough to what we know that we can read comfortably and find new insights. Eventually, we are in so deep that we must chose between stopping, skimming, or slowing down to really work through the material. Where the transitions happen will, of course, depend on the reader.

I suspect the book will be most useful in the second stage, where the material is new but not outright unfamiliar. A reader who knows some algebraic number theory, for example, may well find chapter 2 a very congenial account of class field theory, one that focuses on the main themes and does not need to deal with technical issues that a full treatment with complete proofs cannot avoid. A reader with good control of class field theory may find chapter 3 a very useful introduction to complex multiplication. At the other extreme, an undergraduate with only elementary number theory as background will probably learn the most from chapter 1, which stays quite classical until the end. Reading those chapters will provide a dramatic demonstration of how a seemingly simple question can turn out to lead us into deep waters.

There are exercises throughout, including many cases of “we leave the proof as an exercise.” The major change in this third edition is that full solutions are now included. Many of these were written by Roger Lipsett and then completed and revised by Cox. Inevitably, small errors and unclear spots were found in the course of preparing solutions, so one of the advantages of the new edition is that “small errors have been fixed and many hints have been clarified and/or expanded.” The solutions to the exercises fill 219 pages of the book, almost doubling its size.

Some readerly questions suggest themselves. For example, what about \(x^2-ny^2\)? That leads to entirely different issues, from Pell’s equation to real quadratic fields. These are mentioned, but not really discussed seriously, the main problem being that there is not a version of complex multiplication that applies to this case. Or at least not yet.

This is an unusual book that can be delightful to read. There are many interesting insights to be found throughout. It is hard to imagine, however, using it as a textbook. Given that, the inclusion of solutions to the exercises is much to be welcomed.

The first two editions of this book were from Wiley. This edition is by AMS Chelsea, an imprint that has a long and distinguished history of bringing classic works back into print. Traditionally, Chelsea books have been sturdy hardcovers without dustjackets. They were not pretty, perhaps, but felt like they would survive long use. It seems that those days are over, alas: this (and other recent AMS Chelsea books) is a perfect-bound paperback. I was a bit worried that a 533 page paperback would not resist being read through, but so far so good: there are creases on the spine, but no pages have fallen out. Still, I miss the old Chelsea style.

Not to end on a sour note, let me reiterate that this is a wonderful and challenging book that will help its readers see how a relatively simple question can drive the development of a huge range of mathematics.

Fernando Q. Gouvêa is Carter Professor of Mathematics at Colby College in Waterville, ME.