दुर्गा बेरागी Durga Beragi, homeEnter the study →

Library › Mathematics

An Introduction to the Theory of Numbers

G. H. Hardy and E. M. Wright · 1938 · Clarendon Press

More by G. H. Hardy on this shelf · 3 books →

Primes, partitions and continued fractions. The standard text.

About the book

G. H. Hardy and E. M. Wright published this book in 1938. It became the standard introduction to number theory for students and remains in print. The sixth edition of 2008 was revised by D. R. Heath-Brown and J. H. Silverman and added a chapter on elliptic curves. The book covers prime numbers, Farey series, irrational numbers, congruences, Fermat's theorem, quadratic residues, primitive roots, continued fractions, approximation of irrationals by rationals, the fundamental theorem of arithmetic, arithmetical functions, the partition function, sums of squares, quadratic fields, and the prime number theorem. It covers a wide range at a moderate level.

Key ideas

  • Every whole number greater than one factors into primes in only one way. This fundamental theorem of arithmetic is the base on which the rest of the subject is built.
  • There are infinitely many primes, and they thin out in a regular way. The prime number theorem says roughly how many primes lie below a given number.
  • Irrational numbers can be approximated by fractions. Continued fractions give the best approximations, and they reveal the structure of numbers like the square root of two.
  • Fermat's little theorem and its extensions describe how powers of numbers behave when divided by a prime. These results underlie much of the theory of congruences.
  • Every positive whole number is a sum of four squares. Hardy and Wright prove this and related results about which numbers are sums of two or three squares.
  • Number theory, though pure, draws on tools from analysis, algebra and geometry. The book shows these tools at work on questions about whole numbers. It is a good map of the field.

Why it is on this shelf

This is the standard broad introduction to number theory, used by students for over eighty years. It is clear and covers a great deal of ground. A reader who wants to learn number theory properly, beyond popular accounts, should keep it as both textbook and reference.

How to start reading it

Read the first two chapters on primes, then the chapters on congruences and Fermat's theorem. Then go to continued fractions. Chapters can be read somewhat independently.

About this book

An Introduction to the Theory of Numbers by G. H. Hardy and E. M. Wright was first published in 1938 by the Clarendon Press in Oxford. It has been in print ever since. It went through several editions during Wright's long life, and a sixth edition appeared in 2008, revised by D. R. Heath-Brown and J. H. Silverman, with a new chapter on elliptic curves. For most of the twentieth century it was the book that English-speaking students of mathematics were handed when they wanted to learn number theory properly. It still occupies that place on many shelves, though newer textbooks have joined it.

Number theory is the study of the whole numbers: one, two, three and onward, together with zero and the negatives. The questions are often easy to state. Which numbers are prime? How are the primes spread out? Which numbers can be written as a sum of two squares? What remainders do powers leave when divided by a prime? How well can an irrational number be approximated by fractions? Many of these questions are ancient. The answers, where they exist, often require surprising tools drawn from analysis, algebra and geometry.

Hardy and Wright did not write a complete treatise, and they said so. Their aim was to introduce a wide range of the subject at a level that a good undergraduate could follow, and to interest the reader in it. They chose topics they found beautiful and important, gave full proofs, and at the end of each chapter added notes pointing to the history and the literature. The result is a broad, varied and rigorous book that can be read as a course or dipped into as a reference.

The question the book sets out to answer is not a single question. It is better described as a tour of the main regions of classical number theory, showing in each region the central results and the kinds of argument they need. A reader who finishes it should know what the subject contains, how its parts connect, and how to read more advanced work. The shelf note calls it the standard text, and that is still a fair description.

How the book has been used

Over its long life the book has served at least three kinds of reader. University students have used it as a course text or, more often, as a companion to lectures, reading the chapters that matched their syllabus. Research mathematicians have used it as a reference, a place to look up a classical result and its proof, or to find the history of a problem in the chapter notes. And serious amateurs, people who love numbers without being professionals, have used it as a guide to the subject as a whole, often working through it over years.

Each kind of reader uses it differently. The student follows a path set by a course. The researcher goes straight to the needed theorem. The amateur wanders. The book's structure, broad and loosely connected, suits all three, which is one reason it has lasted. It is also one reason it can feel unfamiliar to a reader used to modern textbooks with a single line of development and exercises at the end of every section.

What kind of book it is

It is a textbook, but an unusual one. It has no exercises. It does not build steadily from one chapter to the next in the manner of a modern course; many chapters can be read independently. It uses a light touch with abstract algebra, preferring concrete arguments with numbers. It mixes elementary results with deep ones, sometimes placing a simple proof next to a much harder theorem. And it is written in Hardy's clear, dry and confident prose, which makes it pleasant to read even where the mathematics is demanding.

It is also a book of its period. Number theory changed enormously after 1938, becoming much more algebraic and geometric. Hardy and Wright show the subject as it looked to the analytic school of Cambridge and Oxford, with a strong emphasis on primes, approximation and arithmetical functions. The later editions added some modern material, but the book's character remains classical. That is both its strength and its limit.

The authors

Godfrey Harold Hardy was born in 1877 in Cranleigh, Surrey, where both his parents were teachers. He was educated at Winchester College and at Trinity College, Cambridge, where he was elected a fellow in 1900. He spent most of his career at Cambridge, with an important interval from 1919 to 1931 as Savilian Professor of Geometry at Oxford, and returned to Cambridge as Sadleirian Professor of Pure Mathematics. He died in 1947.

Hardy did more than anyone to modernise English pure mathematics. When he began, Cambridge mathematics was dominated by the Tripos examination, which rewarded speed at solving difficult but often trivial problems. Hardy campaigned against that system and brought to England the rigorous analysis developed in France and Germany. His A Course of Pure Mathematics, first published in 1908 and on this shelf, introduced generations of British students to rigorous analysis.

His research was mainly in analysis and analytic number theory. With J. E. Littlewood he formed one of the most productive collaborations in the history of mathematics, lasting some thirty-five years. Together they worked on the Riemann zeta function, the distribution of primes, Waring's problem and much else. With Srinivasa Ramanujan, whom he brought to Cambridge in 1914, he wrote the papers on partitions and on the normal number of prime factors that appear in Ramanujan's Collected Papers, also on this shelf. His essay A Mathematician's Apology, published in 1940, is a personal defence of pure mathematics written near the end of his creative life.

Edward Maitland Wright was born in 1906 in Farnley, near Leeds. He came to university mathematics by an unusual route, with much of his early learning done through private study, and went on to Oxford. He became a research student under Hardy at Oxford and wrote papers on Waring's problem, partitions and other topics in analytic number theory. In 1935 he became professor of mathematics at the University of Aberdeen, where he stayed for the rest of his career. He later served as principal of the university. He lived to be ninety-eight and died in 2005.

Wright did much of the work of preparing successive editions after Hardy's death. Each revision added newer results, corrected errors and updated the notes. Without his long stewardship the book would likely have dated far faster than it did. The sixth edition was prepared after his death by Roger Heath-Brown of Oxford, a leading analytic number theorist, and Joseph Silverman of Brown University, a leading authority on elliptic curves.

How the authors bear on the book

The book reflects Hardy's taste strongly. Hardy believed that the best mathematics was serious, general and beautiful, and that number theory was the purest part of it. He admired proofs that were clear and economical. He liked results that were surprising. He was also an analyst, and the book often brings analytic methods, such as estimates using inequalities and infinite series, into problems about whole numbers. Wright shared these tastes and the training behind them. The result is a book that is, in a sense, a portrait of a mathematical school.

The shape of the argument

The book can be thought of as having several broad regions, which a reader moves between rather than through in a strict order. Seeing these regions helps a reader decide where to start and what to expect.

The first region is the primes themselves: what they are, why there are infinitely many, how they are distributed, and what can be proved about them with elementary means. This material opens the book and returns later in more advanced form, ending with proofs of the prime number theorem. The second region is the arithmetic of remainders, called congruences: Fermat's theorem, Euler's generalisation, primitive roots, quadratic residues and the law of quadratic reciprocity. The third region is approximation: Farey series, continued fractions, the approximation of irrational numbers by rational ones, and the proof that some numbers are not only irrational but transcendental.

A fourth region extends the idea of whole numbers to larger number systems, such as numbers of the form a plus b times the square root of minus one, and asks whether unique factorisation into primes still holds there. A fifth region studies arithmetical functions, such as the number of divisors of a number or the number of integers below it that share no factor with it, and their average behaviour. A sixth region concerns additive questions: partitions, sums of squares, and Waring's problem on sums of higher powers. A seventh introduces the geometry of numbers, which uses lattices of points in space to solve arithmetical problems. The sixth edition adds an eighth region on elliptic curves.

How the regions connect

The deep theme of the book is that these regions are not separate. Unique factorisation, proved early on, underlies the arithmetical functions and the theory of congruences. Continued fractions, introduced for approximation, reappear in the solution of certain equations. The geometry of numbers gives new proofs of results on sums of squares. Analytic estimates connect the arithmetical functions to the distribution of primes. A reader who follows the cross-references, which the authors provide generously, will find that the book is a web, not a list.

Idea one: unique factorisation

Every whole number greater than one can be written as a product of primes, and in only one way, apart from the order of the factors. Twelve is two times two times three; no other collection of primes multiplies to twelve. This is the fundamental theorem of arithmetic. It sounds obvious, and most people accept it without thought. Hardy and Wright prove it carefully and then show why the proof is needed.

The proof depends on a key fact: if a prime divides a product of two numbers, it must divide at least one of them. That fact in turn depends on the Euclidean algorithm, the ancient method of finding the greatest common divisor of two numbers by repeated division with remainder. Euclid's Elements, on this shelf, contains both the algorithm and essentially this argument. Hardy and Wright give more than one proof, which helps the reader see what each depends on.

Why the proof matters

The reason the proof is needed becomes clear when one looks at other number systems. Consider all numbers of the form a plus b times the square root of minus five, where a and b are whole numbers. In this system, six can be factored as two times three, and also as one plus the square root of minus five times one minus the square root of minus five, and none of these four factors can be broken down further. Unique factorisation fails. The obviousness of the theorem for ordinary numbers is therefore an illusion. It is a real property that some number systems have and others do not.

Hardy and Wright explore this in chapters on the arithmetic of certain quadratic fields, showing systems in which unique factorisation still holds and using it to solve problems about ordinary numbers. Their treatment is concrete and avoids the general machinery of ideals that Dedekind introduced. Dedekind's Essays on the Theory of Numbers on this shelf come from the same circle of ideas, and modern algebraic number theory grew from them.

An analogy

Think of building with interlocking bricks where each finished model can be taken apart into basic bricks in only one way. You could then identify any model by listing its basic bricks. Now imagine a different set where two different collections of basic bricks can make the same model. A list of bricks would no longer identify the model. Ordinary arithmetic is like the first set. Some other number systems are like the second. Much of algebraic number theory is the study of how to repair the second kind of system so that something like unique factorisation returns.

Idea two: the infinitude and distribution of primes

Euclid proved that there are infinitely many primes. Given any finite list of primes, multiply them together and add one; the result is not divisible by any prime on the list, so some prime is missing. Hardy and Wright give this proof and several others, each of which teaches something different. One uses the fact that the sum of the reciprocals of the primes grows without bound, which shows not just that there are infinitely many primes but that they are fairly common.

How common? The primes thin out as numbers grow. Among the first hundred numbers there are twenty-five primes; among the first million there are about seventy-eight thousand. The prime number theorem says that the number of primes up to a large number is approximately that number divided by its natural logarithm. Equivalently, near a large number, roughly one number in every logarithm-of-that-number is prime. The theorem was conjectured by Gauss and Legendre around 1800 and proved in 1896 by Jacques Hadamard and Charles de la Vallee Poussin, independently, using complex analysis and the Riemann zeta function.

What the book does with it

Hardy and Wright approach the distribution of primes in stages. They first prove weaker results by elementary means, such as Chebyshev's theorem that the number of primes up to a given size lies between two constant multiples of the expected value. They prove Bertrand's postulate that there is always a prime between a number and its double. They discuss Mertens' theorems about sums and products over primes. Finally they prove the prime number theorem itself. In later editions they included the elementary proof found in 1948 and 1949 by Atle Selberg and Paul Erdos, which uses no complex analysis. Many mathematicians, Hardy among them, had expected that no such proof would be found, or that finding one would change how the whole subject was understood.

Why it matters and what it is confused with

The prime number theorem is often confused with a formula for the primes. It is not. It does not tell you which numbers are prime. It tells you how many there are, approximately, on average. The individual primes remain irregular. That combination, irregular in detail but regular on average, is the central fact about primes and the source of many of the deepest open problems, including the Riemann hypothesis, which would give a precise bound on how far the actual count can stray from the average. Hardy and Wright mention the hypothesis and its significance; they do not, of course, prove it, since no one has.

The book also discusses famous unsolved problems about primes, such as whether there are infinitely many twin primes, pairs like eleven and thirteen that differ by two, and Goldbach's conjecture that every even number greater than two is a sum of two primes. Some progress on these has been made since: in 2013 Yitang Zhang proved that there are infinitely many pairs of primes differing by at most some fixed bound, and James Maynard and others soon reduced that bound greatly. The twin prime conjecture itself remains open. Reading the older editions alongside these developments shows a subject still in motion.

Idea three: congruences and Fermat's theorem

Much of number theory is about remainders. Two numbers are said to be congruent with respect to a modulus if they leave the same remainder when divided by it. Seventeen and two are congruent with respect to five, since both leave remainder two. Gauss introduced this language in his Disquisitiones Arithmeticae of 1801, on this shelf, and it transformed the subject. Arithmetic with remainders behaves much like ordinary arithmetic: one can add, subtract and multiply, and the remainders follow along consistently.

Clock arithmetic is the familiar example. Five hours after nine o'clock is two o'clock, because fourteen and two are congruent with respect to twelve. Days of the week work with respect to seven. Many calendar calculations, including the computation of the day of the week for any date and the traditional computations of festival dates, are exercises in congruences.

Fermat's little theorem

A central result is Fermat's little theorem. If p is a prime and a is any number not divisible by p, then a raised to the power p minus one leaves remainder one when divided by p. For example, two to the sixth power is sixty-four, which leaves remainder one when divided by seven. Euler generalised the result to any modulus, replacing p minus one by the number of integers below the modulus that share no factor with it, now called Euler's totient function. Hardy and Wright prove these theorems and develop their consequences, including Wilson's theorem, which characterises primes by a property of factorials.

They also introduce primitive roots. For a prime modulus, there is always a number whose powers run through every nonzero remainder before returning to one. Such a number is called a primitive root. It plays the role, in the world of remainders, that a generator plays in a cycle: every element can be reached by repeating it. This idea leads directly to the modern theory of cyclic groups.

Where it leads

Fermat's little theorem is now used every day in computer security. The RSA encryption system, published in 1977, relies on Euler's generalisation: a message raised to a certain power and then to another returns to itself when remainders are taken with respect to a product of two large primes. The security rests on the difficulty of factoring that product. Primality tests used to generate large primes also use Fermat's theorem and its refinements. Hardy, who prided himself on the uselessness of number theory, would have been surprised.

Idea four: quadratic residues and reciprocity

Some remainders are squares and some are not. With respect to seven, the squares of one to six leave remainders one, four, two, two, four and one. So one, two and four are squares modulo seven, called quadratic residues, while three, five and six are not. A natural question is: given a prime and a number, is the number a square modulo that prime? For small primes one can simply check. For large ones checking every possibility is slow. Is there a better way?

The law of quadratic reciprocity gives one. It connects two questions that seem unrelated: whether p is a square modulo q, and whether q is a square modulo p, for two odd primes p and q. The law says that the answers are the same, unless both primes leave remainder three when divided by four, in which case the answers are opposite. With this law, and two supplementary rules for minus one and two, one can decide quickly whether any number is a square modulo any prime, by repeatedly swapping and reducing, much as in the Euclidean algorithm.

Euler and Legendre stated the law. Gauss gave the first complete proof in the Disquisitiones and was so fond of it that he called it the golden theorem and published several different proofs during his life. Hundreds of proofs are now known. Hardy and Wright give a proof and discuss its background.

Why it matters

Quadratic reciprocity is often described as the first deep theorem of number theory. It is deep because it reveals a hidden symmetry between primes that nothing in their definition suggests. It matters historically because the search for similar laws for cubes, fourth powers and beyond drove much of nineteenth- and twentieth-century algebraic number theory. That search led eventually to class field theory and then to the Langlands programme, which seeks a vast generalisation of reciprocity linking number theory to other parts of mathematics. A student who understands quadratic reciprocity has seen the first instance of one of the central patterns of modern mathematics.

An analogy

Imagine two people, each of whom can only see the other's shadow. It would be surprising if what each saw of the other were tightly linked by a simple rule. Quadratic reciprocity is like that: the way p looks from the point of view of q is linked to the way q looks from the point of view of p, by a rule involving only their remainders on division by four. The surprise is the point.

Idea five: continued fractions and approximation

Every real number can be approximated by fractions. Pi is roughly twenty-two sevenths, and more closely three hundred and fifty-five over one hundred and thirteen. Why these particular fractions? Because they are the best approximations for their size: no fraction with a smaller denominator comes closer. Continued fractions give a systematic way to find all such best approximations.

A continued fraction expresses a number as a whole number plus one over another whole number plus one over another, and so on. The successive whole numbers are found by repeatedly taking the integer part and inverting the remainder. Cutting the expression off at each stage gives a sequence of fractions, called convergents, which are exactly the best approximations. For rational numbers the process ends. For irrational numbers it goes on forever. For square roots of whole numbers, and more generally for roots of quadratic equations, it eventually repeats, a theorem of Lagrange that Hardy and Wright prove.

Farey series

The book also introduces Farey series, the sequences of all fractions between zero and one with denominators up to a given bound, arranged in order. They have a beautiful property: for two neighbouring fractions, the difference between the products of their cross terms is always one. They give a simple way to see how fractions are spread along the line and lead naturally to theorems about approximation. Hardy and Wright use them early in the book, and the idea reappears in the circle method of Hardy and Ramanujan.

How well can a number be approximated?

Dirichlet showed that every irrational number has infinitely many fractions that approximate it with an error smaller than one over the square of the denominator. Hurwitz sharpened the constant, and the golden ratio turned out to be the hardest number to approximate in this sense, because its continued fraction consists entirely of ones. Hardy and Wright prove these results and discuss what lies beyond them, including Liouville's theorem that algebraic numbers cannot be approximated too well, which leads to the first construction of numbers that are not algebraic.

Where it leads

Continued fractions solve Pell's equation, the problem of finding whole numbers x and y such that x squared minus a fixed non-square number times y squared equals one. Indian mathematicians, notably Brahmagupta in the seventh century and Bhaskara in the twelfth, developed a method for this equation, the chakravala or cyclic method, centuries before Europeans solved it. Bhaskara's Lilavati on this shelf is a companion to his algebra, where the method appears. In modern times continued fractions appear in the study of dynamical systems, in the design of calendars and gear trains, and in the tuning of musical scales, wherever a ratio must be approximated by small whole numbers.

Idea six: irrational and transcendental numbers

A number is irrational if it cannot be written as a fraction of two whole numbers. The square root of two was the first known example; its irrationality was known to the Greeks, and the classical proof is a short argument by contradiction. Hardy and Wright prove the irrationality of many numbers, including roots of whole numbers that are not perfect powers, and of e, the base of natural logarithms, and pi.

Some numbers are not only irrational but transcendental: they are not the root of any polynomial equation with whole-number coefficients. The square root of two is irrational but algebraic, since it solves x squared equals two. Pi and e are transcendental. The existence of transcendental numbers was first shown by Liouville in 1844 by constructing numbers that are approximated by fractions too well to be algebraic. Hermite proved e transcendental in 1873, and Lindemann proved pi transcendental in 1882. Hardy and Wright give proofs of both, a rare and valuable feature in an introductory book.

Why it matters

Lindemann's theorem settled one of the oldest problems in mathematics, the squaring of the circle. The Greeks had asked whether one can construct, with straightedge and compass alone, a square equal in area to a given circle. Such a construction would require producing a length equal to the square root of pi. Constructible lengths are always algebraic. Since pi is transcendental, so is its square root, and the construction is impossible. A two-thousand-year-old question was answered by a theorem of number theory.

In the same spirit Hardy and Wright discuss which regular polygons can be constructed with straightedge and compass, a question Gauss answered in the Disquisitiones. Gauss showed as a young man that the regular seventeen-sided polygon is constructible, the first new construction of its kind since the Greeks, and found the general rule linking constructibility to primes of a special form, now called Fermat primes. These results show number theory reaching into geometry and settling classical questions.

Cantor's contrast

There is a further surprise. Cantor showed that the algebraic numbers can be listed in a sequence, while the real numbers cannot. It follows that almost all real numbers are transcendental, even though proving that any particular number is transcendental is very hard. Cantor's Contributions to the Founding of the Theory of Transfinite Numbers on this shelf develops the ideas behind this argument. The contrast between abundance in general and difficulty in particular is a recurring theme in number theory.

Idea seven: arithmetical functions and their averages

An arithmetical function assigns a number to each whole number. The number of divisors of n is one. The sum of the divisors of n is another. Euler's totient, the count of numbers up to n that share no factor with it, is a third. The Mobius function, which takes the values one, minus one or zero depending on the prime factorisation of n, is a fourth. These functions are irregular when viewed one number at a time. The number of divisors jumps from two for a prime to many for a highly composite neighbour.

Hardy and Wright study these functions in two ways. First, they find exact relations among them. Many are multiplicative, meaning their value on a product of numbers with no common factor is the product of their values. The Mobius inversion formula lets one recover a function from its sums over divisors, rather as subtraction undoes addition. Second, they study average behaviour. Although the number of divisors is irregular, its average over the numbers up to a given size grows like the logarithm of that size. Such averages smooth out the irregularity and reveal underlying order.

An analogy

Daily rainfall in a city is erratic: some days are dry, some have storms. The average over a month is much steadier, and the average over a year steadier still. Arithmetical functions behave similarly. Studying them number by number is like studying single days. Studying their averages is like studying climate. Hardy and Wright teach both, and they show that the climate of the whole numbers is often describable with precision even when the weather is not.

Where it leads

The book also discusses the normal order of the number of prime factors, the result of Hardy and Ramanujan that almost all numbers of a given size have close to log log of that size as their number of prime factors. This is the seed of probabilistic number theory. More broadly, the study of arithmetical functions through their generating series, called Dirichlet series, leads to the Riemann zeta function and to the analytic proofs of the prime number theorem. Hardy and Wright give a taste of this connection, enough for a reader to see why analysis and arithmetic belong together.

Idea eight: partitions and generating functions

A partition of a number is a way of writing it as a sum of positive whole numbers, ignoring order. Five has seven partitions. Hardy and Wright introduce partitions through generating functions: infinite series or products whose coefficients count the objects of interest. Euler found that the partition numbers are the coefficients of a simple infinite product, and that a related product, when expanded, has coefficients that are almost all zero, with the nonzero ones occurring at the pentagonal numbers. This pentagonal number theorem gives a fast way to compute partition numbers by recursion.

The book proves several identities of this kind, including the Rogers-Ramanujan identities, which say that two different ways of counting restricted partitions always agree. It also discusses, in its notes, the Hardy-Ramanujan asymptotic formula and the Ramanujan congruences, which say for instance that the number of partitions of any number leaving remainder four on division by five is itself divisible by five. These results link the book directly to Ramanujan's Collected Papers on this shelf.

Why generating functions matter

The idea of a generating function is one of the most powerful in mathematics. It turns a counting problem into a problem about a function, which can then be studied with algebra or analysis. A sequence of numbers becomes a single object. Operations on the sequence, such as combining two counts, become operations on the function, such as multiplication. Hardy and Wright show this technique at work in number theory, but it is now used throughout combinatorics, probability and computer science, wherever things must be counted.

An example

Suppose you want to know how many ways there are to pay a sum using coins of certain values. Each coin value contributes a factor to a product, and the coefficients of the expanded product give the number of ways for each sum. The method turns a laborious enumeration into a mechanical calculation, and it makes clear why some sums have many ways and others few. Partitions are the same problem with coins of every whole-number value.

Idea nine: sums of squares and Waring's problem

Which numbers are sums of two squares? Five is one plus four. Thirteen is four plus nine. Three is not, and neither is seven. Fermat stated, and Euler proved, that an odd prime is a sum of two squares exactly when it leaves remainder one on division by four. Using unique factorisation, one can then decide for any number whether it is a sum of two squares by looking at its prime factors: it is, unless some prime of the form four times something plus three appears to an odd power.

Every positive whole number is a sum of four squares, allowing zero. This was conjectured long before and proved by Lagrange in 1770. Three squares are not enough: seven, for instance, needs four. Legendre and Gauss found exactly which numbers are sums of three squares; the exceptions are the numbers of a particular form involving powers of four. Hardy and Wright prove the two-square and four-square theorems, in more than one way, and discuss the three-square theorem.

Counting representations

The book goes further than asking whether a number is a sum of squares. It asks how many ways it can be written so. Jacobi found exact formulas for the number of representations as a sum of two squares and of four squares in terms of the divisors of the number. These formulas come from identities among theta functions, the same kind of infinite series that Ramanujan used. Hardy and Wright give elementary proofs of some of them, showing again how arithmetic and analysis interlock.

Waring's problem

In 1770 Edward Waring asserted that every number is a sum of at most nine cubes, at most nineteen fourth powers, and so on, with some fixed bound for each power. Hilbert proved in 1909 that such a bound exists for every power. Hardy and Littlewood then developed the circle method to give much more precise information about how many powers are needed for all large numbers. Hardy and Wright treat the elementary parts of Waring's problem and indicate the shape of the analytic theory. The problem has since been largely settled for the question as originally stated, though refined versions remain active research.

Fermat's Last Theorem

Closely related is Fermat's claim that no cube is a sum of two cubes, no fourth power a sum of two fourth powers, and in general no higher power a sum of two like powers. Hardy and Wright prove the cases of fourth powers and cubes, using Fermat's method of infinite descent and arithmetic in a suitable number system. The general case was proved by Andrew Wiles in 1994, with a key step completed with Richard Taylor, using the theory of elliptic curves and modular forms. The story is told for general readers in Simon Singh's Fermat's Last Theorem on this shelf. The sixth edition's new chapter on elliptic curves gives a reader a first view of the objects involved.

Idea ten: the geometry of numbers

One of the most elegant ideas in the book is to solve problems about whole numbers by looking at points in space. Take all the points in a plane whose coordinates are both whole numbers. They form a grid, called a lattice. Hermann Minkowski showed in the 1890s that any convex region symmetric about the origin and large enough in area must contain a lattice point other than the origin. More precisely, in the plane, if the area is more than four, there must be such a point. This simple-sounding theorem has powerful arithmetical consequences.

For example, it can be used to prove that a prime of the form four times something plus one is a sum of two squares, by choosing a suitable region and a suitable lattice and showing that the guaranteed point gives the squares. It can be used to prove results on approximation of irrational numbers and on the representation of numbers by quadratic forms. Hardy and Wright present Minkowski's theorem and several of its applications, showing a third way, besides algebra and analysis, in which mathematics outside arithmetic helps to answer arithmetical questions.

An intuitive picture

Imagine an orchard with trees planted at every grid point. Stand at one tree and look outward. Minkowski's idea is related to the question of whether a straight line of sight can escape the orchard without hitting a tree. If the trees are thick enough relative to the region you are looking through, some tree must block your view. Translating this into precise geometry, and then into arithmetic, gives the theorems. The orchard problem was in fact posed in this form by Polya, whose How to Solve It is on this shelf.

Where it leads

The geometry of numbers is now a substantial field in its own right. It is used in algebraic number theory to prove that class numbers are finite, in the theory of quadratic forms, and in modern cryptography, where problems about lattices in high dimensions are believed to be hard even for quantum computers and so form the basis of new encryption schemes. A theorem first used to give new proofs of old results about squares has become part of the infrastructure of digital security.

Idea eleven: the language of estimates

A feature of the book that newcomers often find strange is how much of it consists of inequalities rather than equations. Many results do not say that some quantity equals something. They say it is at most something, or at least something, or approximately something with an error of a certain size. This is the language of analytic number theory, and learning to read it is one of the main skills the book teaches.

Hardy and Wright use a compact notation for this, which Hardy did much to popularise in English. Writing that one function is big O of another means that the first is at most a constant multiple of the second for large inputs. Writing that it is little o of another means that it becomes negligible in comparison. Writing that two functions are asymptotically equal means that their ratio approaches one. These three ideas let a mathematician say exactly how good an approximation is, without needing an exact formula.

Why it matters

The reason for this language is that exact formulas are rare in number theory. There is no simple exact formula for the number of primes up to a given size, or for the number of partitions, or for the average number of divisors. But there are very good approximations, and the quality of an approximation can be stated precisely. The prime number theorem is a statement that two functions are asymptotically equal. The Riemann hypothesis is, in one form, a statement about the size of the error term. Much modern research is about improving error terms by small amounts, and each improvement can require new ideas.

An everyday comparison

A builder estimating the cost of a house does not know the exact figure in advance. A useful estimate says the cost will be about a certain amount, give or take a stated margin. A careless estimate gives a number with no margin at all. Analytic number theory insists on the margin. The big O notation is a way of writing the margin down. Students now meet the same notation in computer science, where it is used to describe how the running time of an algorithm grows with the size of its input. A reader who learns it from Hardy and Wright will recognise it everywhere.

The sixth edition and elliptic curves

The sixth edition of 2008 added a chapter on elliptic curves, written by Joseph Silverman. An elliptic curve, for the purposes of number theory, is the set of solutions of an equation of the form y squared equals a cubic polynomial in x. Despite the name, these curves have nothing to do with ellipses; the name comes from their connection with the elliptic integrals used to compute the length of an ellipse.

What makes them special is that their points can be added. Given two rational points on the curve, the line through them meets the curve in a third point, and a simple construction from that point gives the sum. With this addition the rational points form a group. Mordell proved in 1922 that this group is finitely generated: all rational points can be produced from a finite number of them by repeated addition. Determining how many independent generators are needed, the rank, is still a deep and partly open problem, connected with the Birch and Swinnerton-Dyer conjecture, one of the most important unsolved problems in mathematics.

The new chapter matters because elliptic curves became central to number theory after Hardy's time. They were essential to the proof of Fermat's Last Theorem, they underlie a widely used family of cryptographic systems, and they are a meeting point of algebra, geometry and analysis. By including them, the sixth edition connects the classical book to the modern subject. A reader who reaches this chapter has a bridge from the world of Hardy and Wright to current research.

The tradition around it

Hardy and Wright stands in a long line of books on number theory. Its ancestors include Euclid's Elements, whose arithmetical books contain the Euclidean algorithm and the infinitude of primes; Legendre's Essai sur la theorie des nombres; and above all Gauss's Disquisitiones Arithmeticae of 1801, which created the modern subject. Dirichlet's lectures on number theory, edited by Dedekind, carried Gauss's work into a teachable form in the nineteenth century. Euler's Elements of Algebra, Gauss, and Dedekind's Essays on the Theory of Numbers are all on this shelf, and a reader can trace much of what Hardy and Wright teach back to them.

In its own time, the book represented the analytic school of number theory, centred in England on Hardy and Littlewood and in Germany on Edmund Landau, whose own textbooks covered similar ground with greater formality. Hardy and Wright brought that school's methods and tastes to a broad audience. They also drew on Ramanujan's work, and the book includes several of his results in partitions and arithmetical functions.

The Indian contribution

The book, like most European texts of its period, says relatively little about the Indian history of its subject, and a reader of this shelf should know that history. Aryabhata, in the fifth century, gave a method called kuttaka, meaning pulverising, for solving linear equations in whole numbers, which is in substance the Euclidean algorithm applied to such equations. Brahmagupta, in the seventh century, found an identity for combining solutions of equations of the Pell type, so that two known solutions give a third; this composition rule anticipates ideas that Euler and Lagrange developed a thousand years later. Bhaskara, in the twelfth century, refined these methods into the chakravala, a cyclic procedure that always finds a solution of Pell's equation and does so efficiently. European mathematicians did not have a complete method until Lagrange in the eighteenth century.

These achievements matter for reading Hardy and Wright because they show that several of the book's central techniques, the Euclidean algorithm, the theory of continued fractions and the solution of quadratic equations in whole numbers, had a long and independent life in India. A reader who knows this will read the chapters on approximation and on quadratic forms with a fuller sense of where the ideas came from, and will see Ramanujan's later work as part of a continuous tradition rather than an isolated event.

What came after

After 1938 number theory became much more algebraic and geometric. André Weil, Jean-Pierre Serre, Alexander Grothendieck and others reshaped the subject around abstract algebra and algebraic geometry. Textbooks reflecting this shift, such as Ireland and Rosen's A Classical Introduction to Modern Number Theory and Serre's A Course in Arithmetic, became standard for students heading into research. Hardy and Wright did not become obsolete, but its role shifted from the main route to a broad and classical companion. Its breadth and concreteness make it especially valuable for readers who want to see many topics at a moderate level before choosing one to pursue.

Connections within this bay

Within this shelf, Hardy and Wright sits at a crossroads. Gauss's Disquisitiones shows where much of its material began. Dedekind's essays show the algebraic road the subject took next. Ramanujan's Collected Papers show the source of several of its most striking results. Hardy's A Course of Pure Mathematics and Rudin's Principles of Mathematical Analysis provide the analysis needed for its harder chapters. Hardy's A Mathematician's Apology gives the philosophy behind its choices. Singh's Fermat's Last Theorem shows where one of its problems led, and Kanigel's The Man Who Knew Infinity tells the human story of the collaboration that shaped part of it. Naive Set Theory by Halmos is a useful background for the language of sets and functions that the book takes for granted.

Questions and criticisms

The most common criticism is the absence of exercises. A textbook without exercises asks the reader to supply their own practice, and many students find that difficult. Instructors who use the book usually supplement it with problem sets from other sources. A reader working alone should plan to do the same, and should treat the worked examples as starting points for their own calculations.

A second criticism is that the book is not well suited to linear study. Its chapters vary greatly in difficulty, and some depend on results from distant parts of the book. A beginner who starts at the first page and proceeds in order may meet a hard analytic chapter before being ready for it. Reading selectively is the sensible approach, and the chapters allow it, but that places a burden of choice on the reader.

What has aged

Some of the book's perspective has aged. Its treatment of algebraic number theory is deliberately concrete and avoids the language of rings and ideals, which is now the standard way to teach that subject. Its coverage of modern topics such as elliptic curves, modular forms, and computational number theory is limited, though the sixth edition improved this. Its notes, though updated, cannot fully reflect the progress of recent decades, such as the work on bounded gaps between primes or the proof of the ternary Goldbach conjecture by Harald Helfgott in 2013. A reader should treat its statements about what is unknown with care and check current sources.

Hardy's own view that number theory is useless has also aged. Since the 1970s the subject has become central to cryptography and computer science. Fermat's theorem, primitive roots, continued fractions, lattices and elliptic curves all have practical uses that Hardy could not have foreseen and would perhaps have regretted. This does not affect the mathematics in the book, but it changes how a modern reader might frame its value.

What has held up

What has held up is the clarity of the proofs, the breadth of coverage, and the quality of the notes. Many of the arguments are still the best elementary proofs available. The book's way of showing different methods, elementary, analytic, algebraic and geometric, applied to related questions remains instructive. Few textbooks from the 1930s are still used in any field. This one is.

Why it is on this shelf

This shelf gathers books on Vedanta, Jyotish, science, economics and technology. Number theory touches each of these in a different way. It is the purest part of mathematics, studied for its own sake for thousands of years, and it is now at the heart of the digital technology that carries most of the world's communication and money. It also has deep roots in Indian mathematics, from the decimal place-value system to Brahmagupta's and Bhaskara's work on equations in whole numbers to Ramanujan's results on partitions.

For a reader interested in Jyotish, the arithmetic of remainders and cycles is directly relevant. Traditional calendar and astronomical calculations rely on finding when several cycles of different lengths come back into alignment, a problem in congruences, and on approximating astronomical ratios by fractions with manageable numbers, a problem in continued fractions. The kuttaka method of Aryabhata and later Indian astronomers, used to solve linear equations in whole numbers that arise in such calculations, is essentially the Euclidean algorithm at work. Hardy and Wright give the modern theory behind these old techniques.

For a reader of technology and economics, the book explains the mathematics behind encryption, digital signatures and the security of online payments. For a reader of science, it shows the purest example of how abstract structures, studied for their beauty, later turn out to describe the world and to power our tools. For a reader of Vedanta, the stability of arithmetical truth, the fact that a theorem about primes holds always and everywhere, raises questions about the nature of knowledge that have been asked in many traditions. We keep the book because it is the standard broad map of the subject, and because it rewards a lifetime of return visits.

How to read it

This book cannot be read quickly. A good pace is a chapter a week, with pencil and paper, working small examples by hand before reading each proof. The reader needs comfort with school algebra and some patience with proofs. For the analytic chapters, a first course in calculus and real analysis helps a great deal.

Keep a notebook of small tables as you go: primes, squares modulo small primes, continued fractions, partition numbers. These tables are the raw material from which most of the theorems in the book were first guessed, and building them yourself is the surest way to feel why each theorem is true before you read its proof. A simple computer program or spreadsheet can extend them when the hand calculations grow long.

A first path through the book

  • Begin with the opening chapters on primes. Work out the primes up to two hundred by the sieve of Eratosthenes. Follow each of the proofs that there are infinitely many primes and note what each one uses.
  • Next read the chapter on the fundamental theorem of arithmetic. Then construct the example of failed factorisation using the square root of minus five and check it by multiplying out.
  • Read the chapters on congruences and Fermat's theorem. Verify Fermat's little theorem for several primes by hand, and compute a primitive root modulo seven and modulo eleven.
  • Read the chapter on quadratic residues and reciprocity. List the squares modulo several small primes and test the law on pairs of them before reading the proof.
  • Read the chapters on continued fractions and approximation. Compute the continued fraction of the square root of two, of pi to a few terms, and of the golden ratio, and find their convergents.
  • Read the chapter on sums of two and four squares. Write each number up to fifty as a sum of four squares.
  • Then choose among the remaining topics according to interest: partitions and generating functions, arithmetical functions and their averages, the geometry of numbers, transcendence, or the prime number theorem.

What to skip on a first pass

On a first pass, skip the long analytic proofs of the prime number theorem and the more technical estimates for arithmetical functions. Skip the chapters on quadratic fields unless you are interested in algebraic number theory. Read the statements of the main theorems and the notes at the end of each chapter, which give the history and context. Return to the skipped parts after a course in analysis.

What to read next from this shelf

Before or alongside this book, Courant and Robbins's What Is Mathematics? gives a gentler first look at several of the same topics. For background in analysis, use Hardy's A Course of Pure Mathematics or Spivak's Calculus, then Rudin. For history, go back to Euclid and to Gauss's Disquisitiones. For the Indian thread, read Bhaskara's Lilavati and Ramanujan's Collected Papers. For the human side, Kanigel's biography of Ramanujan and Hardy's A Mathematician's Apology. For where the subject went, Singh's Fermat's Last Theorem.

Questions to carry

  • Why is unique factorisation a theorem rather than an obvious fact, and what breaks when it fails?
  • How can the primes be irregular one by one and regular on average?
  • Why should whether p is a square modulo q be linked to whether q is a square modulo p?
  • What makes a fraction a best approximation to a number, and why do continued fractions find them?
  • Why is the golden ratio the hardest number to approximate by fractions?
  • How can almost all real numbers be transcendental when proving any one of them so is hard?
  • What is gained by turning a counting problem into a question about a function?
  • Why are two squares enough for some primes and not others?
  • How can a theorem about areas and grids prove a fact about sums of squares?
  • What did Hardy mean by calling number theory useless, and was he wrong?
  • Which questions in this book, easy to state, remain unsolved?
  • What does the Indian tradition of the kuttaka and chakravala methods share with the modern theory?
  • How much of number theory is discovered by calculation and how much by theory?

Words to know

  • Prime: a whole number greater than one whose only divisors are one and itself.
  • Composite: a whole number greater than one that is not prime.
  • Fundamental theorem of arithmetic: every whole number greater than one factors into primes in exactly one way, apart from order.
  • Euclidean algorithm: the method of finding the greatest common divisor of two numbers by repeated division with remainder.
  • Greatest common divisor: the largest whole number dividing two given numbers.
  • Congruence: the relation between two numbers that leave the same remainder when divided by a given modulus.
  • Modulus: the number by which remainders are taken in a congruence.
  • Fermat's little theorem: for a prime p and a number a not divisible by p, a to the power p minus one leaves remainder one on division by p.
  • Euler's totient function: the count of numbers up to n that share no factor with n.
  • Primitive root: a number whose powers produce every nonzero remainder modulo a prime.
  • Quadratic residue: a number that is a perfect square modulo a given prime.
  • Quadratic reciprocity: the law linking whether p is a square modulo q to whether q is a square modulo p.
  • Continued fraction: an expression of a number as a whole number plus one over another such expression, repeated.
  • Convergent: a fraction obtained by cutting a continued fraction off at some stage; a best approximation.
  • Farey series: the ordered sequence of fractions between zero and one with denominators up to a given bound.
  • Irrational number: a number that is not a fraction of two whole numbers.
  • Algebraic number: a root of a polynomial equation with whole-number coefficients.
  • Transcendental number: a number that is not algebraic, such as pi or e.
  • Arithmetical function: a function from the whole numbers to numbers, such as the divisor count.
  • Mobius function: an arithmetical function used to invert sums over divisors.
  • Partition: a way of writing a whole number as a sum of positive whole numbers, ignoring order.
  • Generating function: a series or product whose coefficients encode a sequence of numbers.
  • Lattice: the set of points in space whose coordinates are whole numbers, or a regular grid like it.
  • Prime number theorem: the number of primes up to x is approximately x divided by the natural logarithm of x.
  • Elliptic curve: the set of solutions of an equation of the form y squared equals a cubic in x, whose points can be added.

A note on this edition

This is a study edition written for this shelf in our own words. It is a companion to Hardy and Wright's An Introduction to the Theory of Numbers, not a substitute for it, and it reproduces none of the book's text, proofs or tables. The book is in copyright and remains in print from Oxford University Press in its sixth edition. It is worth owning, and it is held by most university libraries. Read it slowly, with a pencil, and work the small cases by hand. The numbers will reward the patience you give them.

Terms from this book with their own page: Partition, Congruence, Irrational number

More from “Mathematics”

The whole section →