© 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).
In this chapter · 8 sections
- 3.1Why build the integers at all
- 3.2The integers as formal differences
- 3.2.1Arithmetic, and checking it is well defined
- 3.3The laws of integer arithmetic, proved
- 3.4The rationals as formal quotients
- 3.4.1The rational laws, proved
- 3.5Order and absolute value
- 3.6Between any two rationals, another
- 3.7A hole in the rationals
- 3.8Exercises
- ↗Free resources
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 ;
- prove any law of arithmetic for or with one recipe: choose representatives, compute, and use the laws of the level below;
- work with order, absolute value and distance on , including the triangle inequality and the closeness estimates that the next chapters use;
- 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.26).
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 .
Take (intended: ) and (intended: ). By Definition 3.3,
And , which is , while , which is . Now redo the computation with different representatives, and : the product is , the same integer. That is well-definedness in action: different names for the inputs, the same output.
Where did the multiplication formula come from? From wanting the distributive law to hold. If and are to be multiplied like ordinary numbers, then . The definition simply records the answer this forces, in a form that uses only addition and multiplication of naturals.
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.6 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.27).
The laws of integer arithmetic, proved
The previous section stated the laws of the integers and proved one or two. This section proves the rest, because the method is the important thing: it is used again, unchanged, for the rationals below and for the real numbers in 2A.4 The Real Numbers. If you are happy to take the laws on trust, read the recipe and the first two proofs, and move on.
To prove a law about integers (or, later, rationals or reals):
- Choose representatives. Write each integer in the law as a formal difference: , , and so on.
- Compute both sides using the definitions of the operations, until each side is a single formal difference of natural numbers.
- Compare using the definition of equality ( when ), and the laws of proved in 2A.1 The Natural Numbers.
Step 1 is legitimate only because the operations are well defined. Without that, the answer might depend on the representatives chosen, and the computation in step 2 would prove nothing about the integers themselves.
Proof (Commutativity and associativity of addition; zero and negatives). With , , :
- and . These are the same pair, by commutativity in .
- and both compute to , by associativity in .
- , and .
- , which equals because .
Negation is well defined: if , so , then requires , which is the same equation.
Proof (Commutativity of multiplication, the unit, and distributivity).
- and : the same pair, by commutativity of both operations in .
- , and .
- For distributivity, , so
On the other side, . The two pairs have the same entries in a different order, so they are equal.
Associativity of multiplication is the same kind of computation, with eight terms on each side (Exercise 3.28).
Two consequences are used constantly. First, : with , , which is . Second, , by applying the first twice. That is the sign rule, in general.
Now the proof of Proposition 3.8, which was only sketched above.
Proof (No zero divisors, and cancellation). Suppose and . By Lemma 3.6, or , and or , for positive natural numbers and . By the sign rules just proved, is or . And is a positive natural number (2A.1 The Natural Numbers, no zero divisors), so . This proves the first statement, by contrapositive.
For cancellation, suppose with . Then , using distributivity and . By the first statement, , so .
For all integers :
- (Trichotomy) exactly one of , , holds;
- (Transitivity) if and then ;
- if then ;
- if and then ;
- if and then .
Proof. (1) Apply Lemma 3.6 to : it is a positive natural (), zero (), or the negative of a positive natural (, since then is positive). (2) is a sum of two positive naturals, so a positive natural. (3) . (4) is a product of two positive naturals. (5) Write with a positive natural. Then , a product of positive naturals, so .
Part (5) is the solution to Exercise 3.27; notice that the proof uses Lemma 3.6 to write a negative as .
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.8 gives .
and, if , the reciprocal .
(Here and from now on we write or for .) The denominators are nonzero by Proposition 3.8.
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.7, 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.30).
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.
The rational laws, proved
The proofs for follow the same recipe as for , one level up: choose representatives , compute, and use the laws of . Two small facts make the computations short.
For integers , and nonzero integers , :
- (a common nonzero factor cancels);
- (fractions with the same denominator add numerators);
- exactly when , and .
Proof. (1) By Definition 3.10 we need , which holds in . (2) By Definition 3.11, , which is by part (1). (3) is , and means . And .
Proof (Addition and the reciprocal are well defined). Addition. Suppose , that is, . We need , that is,
The left side is and the right side is . These are equal because . Replacing the second summand by an equal one is the same computation.
Reciprocal. Suppose with . Then (a product of nonzero integers), so and makes sense. And requires , which is the same equation as before.
Proof (The field laws). Write , , .
- Additive inverse: , by Lemma 3.13.
- Reciprocal: if then , and , by part (1) of Lemma 3.13 with .
- Distributivity: , so . On the other side, , which equals by Lemma 3.13.
- Commutativity, associativity, and : each is a short computation of the same kind, using the corresponding law in . For example , and both and are .
Finally, the integers sit inside the rationals consistently: and , so the identification respects both operations.
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.
Both claims deserve a proof, because Definition 3.14 is phrased in terms of some representative, and a rational has many.
Let be integers with . Then is positive exactly when and are both positive or both negative; it is zero exactly when ; and it is negative exactly when one of is positive and the other negative.
Proof. If are both negative, then with positive, so is positive. Conversely, suppose with positive integers, so . If , then , so , and since this forces (if then by Proposition 3.9). If , the same argument gives . So a positive rational always has numerator and denominator of the same sign. The case is Lemma 3.13. Finally, is negative when is positive, that is, when and have the same sign, that is, when and have opposite signs.
So every rational can be written with (replace by if needed), and then its sign is simply the sign of . Trichotomy for follows at once from trichotomy for . If and are positive, written with , then their sum and product visibly have positive numerators and denominators. The order laws of Proposition 3.9 then hold for with the same proofs, since those proofs used only "sums and products of positives are positive".
One more consequence is used constantly: if then . Indeed , a positive number divided by a positive number.
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.
Proof (Parts 1, 2 and 4). (1) If then ; if then . In either case forces .
(2) In every case and , so ; likewise . Both and are . If both are . Otherwise exactly one of and is positive, and both quantities must equal that one.
(4) Suppose ; then . If , then and . If , then , so , and . Conversely, suppose . If then ; if then , from .
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.
, never "" in general: while . Cancellation between terms can only make a sum smaller in size. A common slip is to write , which is false (, ). The correct companion is the reverse triangle inequality of Exercise 3.31.
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". The following estimates are the tools for that, and the third one deserves to be learned by heart.
Let be rationals, and rationals.
- If are -close and are -close, then are -close.
- If are -close and are -close, then and are -close, and so are and .
- If are -close and are -close, then and are -close.
Proof. (1) is the triangle inequality: .
(2) , so by the triangle inequality . For differences, , and the same estimate applies.
(3) Write and , where and . Then
so , and by the triangle inequality and ,
The trick in (3), writing each perturbed quantity as "original plus small error" and expanding, is the single most common computation in analysis. Notice what the answer says: to make a product close, the errors must be small compared with the sizes of the factors. If and are huge, tiny errors in the factors can make a large error in the product. That is why, when the next chapters multiply sequences, they first prove that the sequences are bounded (2A.4 The Real Numbers, 2A.6 Sequences).
Suppose and are measured quantities with and , and we want their product to within . If each is measured to within , then by part (3) the product is within . With this is . So measuring each factor to within is enough. This is exactly the shape of an – argument: you are told the tolerance for the output, and you work backwards to a tolerance for the inputs.
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.29, write with . Then with . Uniqueness: if and , then , and the only integer with absolute value less than is .
The integer is written , the integer part or floor of . The form of the Archimedean property used most often in analysis is about small numbers rather than large ones.
For every rational there is a positive integer with , and then for every .
Proof. By Proposition 3.21 there is a natural number ; then is positive, and , so (multiply by the positive number ). If , then , by the reciprocal rule above.
This is the first time an "" is produced from an "". Every limit in the next chapters starts this way.
If are rationals, then there is a rational with .
Proof. Take . Then and .
Applying Proposition 3.23 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 . The first half of that sentence also needs a proof, and the proof is a good example of induction and the Archimedean property working together.
For every rational there is a rational with .
Proof. Suppose not, for some . Then whenever is rational with , we must have , and since is impossible (Theorem 3.24), in fact . Now , so by induction on , for every natural number . But by Proposition 3.21 there is a natural number , and for it , so . This contradiction proves the proposition.
So the set of non-negative rationals whose square is less than creeps up arbitrarily close to the hole, and has no largest element and no rational least upper bound (Exercise 3.35). Being bounded above and yet having no least upper bound is precisely the defect the real numbers are designed to cure (2A.4 The Real Numbers). 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.4 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.6?
Solution
This is part (5) of Proposition 3.9. Since , Lemma 3.6 lets us write with a positive natural number. Then , a product of two positive naturals, so .
With , , , show that and are equal.
Solution
, so
And , so
The two pairs have the same four terms in each entry, so they are equal.
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 .
Solution
For natural exponents, the proof of 2A.1 The Natural Numbers works word for word in . Two facts about reciprocals are needed: (because ) and . Now split into cases, with natural.
- , : .
- , with : , so .
- , with : , so .
For the inequalities, induct on : if , then , multiplying by the positive numbers and . Then by the reciprocal rule ( implies ).
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 .
Solution
For . Suppose with positive. If did not divide , then or , and or , which leaves remainder , not . So , then , so , and in the same way . Now is a representation with a smaller denominator, and descent gives a contradiction, exactly as for .
For general , without factorisation. Suppose with positive, and choose as small as possible (well-ordering). Let , so . If then is a perfect square, which is excluded; so . Put and . Then
so with , contradicting the choice of . (Replace by if it is negative.)
Why fails. Here exactly, so : there is no smaller positive denominator to descend to. In the parity argument, gives and then , which says nothing about being even.
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 .
Let be positive integers and . Prove that . (This is how arose in Exercise 3.33.)
Solution
with positive denominators means (subtract and use Lemma 3.15). Then , and similarly .
Let . Show that is bounded above (by , say), that it has no largest element, and that no rational number is a least upper bound for it: for every rational upper bound there is a smaller rational upper bound.
Hint
If , Proposition 3.25 doesn't directly give a larger element; instead, try for a small rational and estimate for . For an upper bound , first show , then try .
Solution
Bounded: if then , so every element of is at most . No largest element: let and . Then , which is less than as soon as . So for a suitable rational . No least upper bound: let be a rational upper bound. Then (since ), and by Theorem 3.24. If , then and the previous step gives a larger element of , contradicting that is an upper bound. So . Now for , , which is greater than when . For such , is still an upper bound: if some had , then , which is impossible.
Let , , , . Compute directly, and compare it with the bound of Proposition 3.19 with , .
Solution
and , so . The bound is . Here the bound is exact, because both errors push the product the same way: compare the proof, where the bound comes from the triangle inequality, which is an equality when all the terms have the same sign.
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.3 The Structure of κ-Solutions) is a region that is -close to a model cylinder, and the proofs keep track of how the errors accumulate.
Solution
Take , , : are -close and are -close, but . In general, by the triangle inequality, (Proposition 3.19, part 1). So closeness is not transitive, but the error at most doubles at each step: after steps of -closeness, the ends are -close. That is why proofs fix the number of steps first and then choose , as in the trick of 2A.4 The Real Numbers.
Free resources for this chapter
Chosen for what this chapter covers, and all free to read or watch. Where a lecture covers more than this chapter, the minutes to watch are given, and the link starts there when it can. Links checked Nov 6, 2026.
Read
- Notes Lecture 3: Cantor’s Remarkable Theorem and the Rationals’ Lack of the Least Upper Bound PropertyMIT OpenCourseWare 18.100A Real Analysis (Fall 2020)The second half shows that the rationals lack the least upper bound property: the hole this chapter finds.
- Reference Integer: ConstructionWikipediaBuilding ℤ from pairs of natural numbers, as in the chapter.
- Reference Field of fractionsWikipediaThe general version of building ℚ from ℤ as a quotient of pairs.
Watch 3 lectures and talks
- Video Lecture 1: Constructing the Rational NumbersFrancis Su, Real Analysis lectures (Harvey Mudd College, 2010)ℚ built from pairs of integers, the quotient construction this chapter uses.
- Video Lecture 2: Properties of QFrancis Su, Real Analysis lectures (Harvey Mudd College, 2010)Order and field properties of ℚ, and the gaps that ℚ leaves.
- Video Lecture 3: Cantor’s Remarkable Theorem and the Rationals’ Lack of the Least Upper Bound PropertyMIT OpenCourseWare 18.100A Real Analysis (Fall 2020), Casey Rodriguez · 19:47 to the end (ℚ lacks the least upper bound property)Why ℚ has no least upper bound for the set of rationals with square less than 2.
© 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.