© 2026 NeckPinch · www.neckpinch.com · All rights reserved.
Course 2Book 2A: Numbers, Limits and the IntegralChapter 3
Integers and Rationals
Building ℤ and ℚ as quotients of pairs, checking operations are well defined, and finding the gaps in ℚ.
Read with Tao, Analysis I, chapter "Integers and rationals" (the integers, the rationals, absolute value and exponentiation, gaps in the rational numbers).
The natural numbers can be added and multiplied, but not always subtracted: has no answer in . Adding a missing answer is a pattern that runs right through mathematics, and this chapter does it twice. First we add the answers to subtractions, which gives the integers . Then we add the answers to divisions, which gives the rationals . Both times the tool is the one from 2A.2 Sets, Functions and Equivalence: take pairs of numbers you already have, declare when two pairs should count as the same, and pass to the quotient.
The rationals look complete: between any two of them there is another, and they can be added, subtracted, multiplied and divided freely. Yet they have holes. The chapter ends by finding one, at . Filling those holes is the job of the next chapter, and the reason analysis exists.
By the end of this chapter you will be able to:
- construct and as quotients, and prove that their operations are well defined;
- explain why every familiar law of arithmetic for and now follows from the laws for ;
- work with order, absolute value and distance on , including the triangle inequality;
- prove that is irrational, and explain what that says about .
Why build the integers at all
Negative numbers are older than any axiom. The Indian mathematician Brahmagupta stated rules for calculating with them in 628 CE, thinking of positive numbers as fortunes and negative numbers as debts. European mathematics resisted them for many centuries more.1 Even in the 17th century, some European mathematicians called negative solutions of equations "false" or "absurd". Today every bank statement, thermometer and altimeter uses them without comment. The question here is not whether negative numbers make sense. It is how to define them so that their laws (why is ?) become theorems, proved from what we already have, rather than rules to be memorised.
The obvious approach is to take and add a new symbol for each positive . That can be made to work, but every definition and proof then splits into cases: positive plus positive, positive plus negative with the positive one larger, and so on. The construction below avoids all the cases by a single idea.
The integers as formal differences
An integer is going to be "what you get by subtracting one natural number from another". Since we can't subtract yet, we record the subtraction as a pair, and write it (read " minus ", but at this stage just a pair of naturals). Different pairs can describe the same intended number: and should both be "". When should two pairs be the same? We'd like , which, moving terms across, means , and that involves only addition of naturals.
An integer is an expression where and are natural numbers. Two integers are equal, , exactly when . Formally, the integers are the quotient of by this equivalence relation, and we write for the set of integers.
Before this definition can be trusted, we must check that "" really is an equivalence relation, because equality has to be reflexive, symmetric and transitive (2A.2 Sets, Functions and Equivalence).
The relation if is reflexive, symmetric and transitive.
Proof. Reflexive: . Symmetric: gives . Transitive: suppose and . Adding these equations, . Cancelling from both sides (the cancellation law of 2A.1 The Natural Numbers) leaves , which says .
The proof of transitivity used cancellation, which in turn rested on Axiom 1.4 of 2A.1 The Natural Numbers. The axioms keep doing work long after they've been stated.
Arithmetic, and checking it is well defined
The definitions of the operations come from what we want: and .
These are formulas in terms of representatives, so each one must be checked to be well defined: the answer must not depend on which pair we chose for each integer (2A.2 Sets, Functions and Equivalence). Here is the check for addition. The others are similar (Exercise 3.18).
If , then . (By symmetry the same holds when the second integer is replaced by an equal one.)
Proof. We are given , and must show , that is, . Rearranging (associativity and commutativity of addition in ), the left side is and the right side is , and these are equal because .
The naturals sit inside the integers. The natural number is identified with the integer . This is consistent with the operations: and . We may therefore write for , for , and for . Once this is done, the formal symbol has served its purpose: really is .
Every integer is exactly one of: a positive natural number ; zero; or for a positive natural number .
Proof. Write . By trichotomy in (2A.1 The Natural Numbers), exactly one of , , holds. If , then with positive, and . If , then . If , then with positive, and . These cases are mutually exclusive by 2A.1 The Natural Numbers's trichotomy, and the representation does not depend on the chosen pair, by Lemma 3.2.
So the quotient construction gives back exactly the picture everyone has of the integers, without our ever having to define them by cases.
For all integers : addition and multiplication are commutative and associative; and ; ; and multiplication distributes over addition, .
Each law is proved by writing , , as formal differences and using the corresponding laws in . For example, , because . In particular, . The sign rule that schoolchildren memorise is a two-line computation.
If then or . Consequently, if and , then .
The first statement follows from Lemma 3.5 and the corresponding fact for (2A.1 The Natural Numbers), by checking signs. The second follows from the first applied to .
Order. For integers, means is a natural number, and means is a positive natural number. The order laws of 2A.1 The Natural Numbers carry over, with one important change: multiplying by a negative number reverses an inequality. If and then (Exercise 3.19).
The rationals as formal quotients
Now do the same for division. A rational number should be " divided by ", with , recorded as a formal quotient . When should and be equal? We'd like , which means , an equation in the integers alone.
A rational number is an expression with integers and . Two rationals are equal, , exactly when . The set of rationals is written : the quotient of by this equivalence relation.
Showing this is an equivalence relation needs one more ingredient than for the integers. Transitivity requires cancelling a nonzero factor: from and we get , so , and since , Proposition 3.7 gives .
and, if , the reciprocal .
(Here and from now on we write or for .) The denominators are nonzero by Proposition 3.7.
Each of these is well defined. For multiplication: if , that is, , then (multiply both sides by and rearrange), which says . The integer is identified with , and the operations agree with those of .
The rationals satisfy all the laws of Proposition 3.6, and in addition every nonzero rational has a reciprocal: .
A set with an addition and multiplication satisfying these laws is called a field. The integers are not a field, because has no integer reciprocal; the rationals are. We can now define division, for , and powers with integer exponents, , with the usual laws (Exercise 3.21).
Floating-point numbers (the subject of 2A.4 The Real Numbers) can't represent exactly, so programs that need exact answers, such as computer algebra systems, exact geometry and some financial calculations, use rationals instead. They store a fraction exactly as this chapter defines it: a pair of integers. To make equality easy to test, they keep one canonical representative of each class, with the numerator and denominator reduced to lowest terms and the denominator positive. Python's standard fractions.Fraction type does exactly this, so Fraction(2, 4) and Fraction(1, 2) are stored identically. Choosing a canonical representative for each equivalence class is a recurring trick: it turns a quotient back into a set of concrete objects.
Order and absolute value
A rational is positive if for some positive integers , and negative if is positive. For rationals, means is positive.
Every rational is exactly one of positive, zero or negative, by the integer version of trichotomy. With this order is an ordered field: sums and products of positive rationals are positive, and order is compatible with addition and with multiplication by positive numbers.
The absolute value of a rational is if and if . The distance between and is .
For all rationals :
- , with exactly when ;
- ;
- (Triangle inequality) , and hence ;
- if and only if .
Proof (Triangle inequality). By (4), and . Adding, , which by (4) again says . Applying this to and , whose sum is , gives the statement about distances.
The triangle inequality is the most-used inequality in analysis. Every argument of the form "these two things are close because each is close to a third" is an application of it, and in 2B.1 Metric Spaces it becomes the defining property of a distance.
Let be rational. Two rationals and are -close if .
This is a deliberately modest notion: it is about a single tolerance , not about limits. But the next chapter builds the real numbers entirely out of statements of the form "for every , eventually, things are -close". Two facts are worth having in hand: if is -close to and is -close to , then is -close to (triangle inequality); and if are -close then are -close.
Between any two rationals, another
The integers are spread out, one unit apart. The rationals are not: they crowd together everywhere. The first step is to show that the integers at least reach everywhere.
For every rational there is a unique integer with . In particular, for every rational there is a natural number larger than .
Proof. Existence for with : by Euclidean division in (2A.1 The Natural Numbers), extended to integers in Exercise 3.20, write with . Then with . Uniqueness: if and , then , and the only integer with absolute value less than is .
If are rationals, then there is a rational with .
Proof. Take . Then and .
Applying Proposition 3.16 again and again, there are infinitely many rationals between any two. A picture of the rationals between and suggests a continuum with no room left over.
A hole in the rationals
The square on a unit length has a diagonal of length with , by Pythagoras. Is that length a rational number?
There is no rational number with .
Proof (By infinite descent). Suppose for some rational . Replacing by if necessary, , so with and positive natural numbers. Then . So is even, and therefore is even, since the square of an odd number is odd (). Write . Then , so , and by the same argument is even, . Now , with .
We started from one representation with positive natural numbers and produced another with a strictly smaller denominator. Repeating forever would give an infinite strictly decreasing sequence of natural numbers , which is impossible by the well-ordering principle of 2A.1 The Natural Numbers. So no such exists.
The proof uses exactly the descent form of well-ordering from 2A.1 The Natural Numbers. A shorter version takes to be the smallest possible denominator at the start, and reaches a contradiction in one step.
So the rationals, though dense, are full of holes. There are rationals whose squares are as close to as you please, from both sides, but none whose square is . Calculus needs every such gap filled. The intermediate value theorem (2A.9 Continuous Functions) would be false over : the function is negative at and positive at , yet has no rational zero. Filling the gaps is the construction of the real numbers.
The same kind of argument, about prime factors, explains a fact every musician lives with. Two notes a perfect fifth apart have frequencies in the ratio , and an octave is a ratio of . Twelve fifths are meant to span the same range as seven octaves, so you would hope , which means . That is impossible: is odd and is even. The actual ratio is
about 23.46 cents, roughly a quarter of a semitone. This is the Pythagorean comma. Going round the circle of fifths from C doesn't return exactly to C. Equal temperament, the tuning of most modern keyboards, hides the comma by making every fifth very slightly narrow, by one twelfth of the comma (about 2 cents), so the circle closes.
Two ideas from this chapter run far ahead. The first is the quotient construction with a well-definedness check, which builds the reals next (2A.4 The Real Numbers) and much later the spaces on which Ricci flow acts (11A.3 Short-Time Existence and Uniqueness). The second is the triangle inequality. It defines a metric space in 2B.1 Metric Spaces, and in Riemannian geometry (9A.3 Geodesics and the Exponential Map) the distance between two points of a curved space is defined as the length of the shortest path between them, a definition chosen precisely so that the triangle inequality holds.
From the natural numbers we have built the integers, a commutative ring with no zero divisors, and the rationals, an ordered field with an absolute value satisfying the triangle inequality. The rationals are dense but have gaps: has no rational solution. 2A.4 The Real Numbers fills the gaps and builds the real numbers.
Exercises
Show that integer multiplication (Definition 3.3) is well defined: if , then .
Hint
You are given . Multiply by and by , and add the results in the right combination.
Solution
We need . Multiplying by gives , and multiplying by (with the sides swapped) gives . Adding these two equations gives exactly the required identity.
Prove that if and are integers, then . Where does the proof use Lemma 3.5?
Extend Euclidean division to all integers: for every integer and positive integer there are unique integers and with and . Then compute the integer part of .
Solution
For this is 2A.1 The Natural Numbers. For , divide : with . If take , . Otherwise , with . Uniqueness is as in 2A.1 The Natural Numbers. For : , so the integer part is , not .
Prove that for every nonzero rational and all integers , using the definition for natural . Then show that if and is a positive integer, then , but .
Prove that for all rationals . Interpret it as a statement about distances to .
Solution
By the triangle inequality, , so . Swapping and , . Together these say . In words: two points that are close have nearly equal distances from .
Prove that is irrational, and more generally that if is a natural number that is not a perfect square, then is irrational. Why does the descent argument fail for ?
Hint
For general , use unique factorisation: in , each prime appears to an even power on the left. Or use the well-ordering principle directly: take the smallest with an integer , and consider .
Find the rational with the smallest positive denominator lying strictly between and . (Look at Figure 3.3: rationals with small denominators are spread out, so the answer has a larger denominator than you might expect.)
Solution
Any rational strictly between them has denominator at least . With denominator , the candidates near – are , which works, since . Checking denominators to shows none works: for example and are adjacent among fractions with denominators up to , and the next fraction to appear between them is the mediant .
Show that if is -close to and is -close to , then need not be -close to , but is always -close to it. Compare with the "similar enough" relation in 2A.2 Sets, Functions and Equivalence. Much of analysis consists of carefully tracking how such small errors add up. In 2A.4 The Real Numbers they are made to vanish in the limit; in Ricci flow, a "-neck" (12B.2 The Structure of κ-Solutions) is a region that is -close to a model cylinder, and the proofs keep track of how the $\varepsilon$s accumulate.
© 2026 NeckPinch (www.neckpinch.com). All content in the guidebook (text, mathematics, figures and exercises) is protected by copyright. All rights reserved. No part may be copied, republished or redistributed without written permission.