Chapter I · Real variables

Rational numbers and the line

§§1–2 25 min

Fractions in lowest terms, how to list all of them in a single sequence, and how they are placed as points on a line.

Why this matters

Hardy begins with the numbers everybody already trusts: the fractions. Before he can show that they are not enough (next lesson), he fixes exactly what they are, how each one can be written in a standard way, and how they sit on a straight line. Two ideas from these first pages return again and again: a number has many names but one standard name, and an infinite collection can sometimes be arranged in a single list.

The idea

A rational number is a fraction p/qp/q of two integers with q≠0q \neq 0. The same number has many names: 12=24=−3−6\tfrac12 = \tfrac24 = \tfrac{-3}{-6}. Hardy removes the ambiguity with two conventions. Cancel every common factor of pp and qq, and make the denominator positive (by changing the sign of both, if necessary). What is left, p/qp/q with q>0q > 0 and no common factor, is the number’s lowest terms. Zero is the rational number with p=0p = 0, written 0/10/1.

There are infinitely many fractions, and between any two of them there are infinitely many more, so it is surprising that they can all be written in one list, first, second, third, and so on, with none left out. The trick (Hardy’s Examples I, 4) is to arrange the positive fractions in a square grid, pp across and qq down, and to read the grid along the diagonals on which p+qp + q is constant. Each diagonal is finite, so every fraction is reached after finitely many steps.

Explore One list containing every positive fraction

Try this. Press “Walk the list” and watch the order: 11\tfrac11, 21\tfrac21, 12\tfrac12, 31\tfrac31, … Then use the pp and qq steppers to jump to 32\tfrac32 and to 43\tfrac43, and read off their places in the list. Finally switch on “skip repeats”.

The fractions p/qp/q listed diagonal by diagonalp →q →112233445566771/12/13/14/15/16/17/11/22/23/24/25/26/27/21/32/33/34/35/36/37/31/42/43/44/45/46/47/41/52/53/54/55/56/57/51/62/63/64/65/66/67/61/72/73/74/75/76/77/7
  • the list so far
  • current term
32\tfrac{3}{2} is on the diagonal p+q=5p+q=5, which holds 4 fractions; the earlier diagonals hold 1+2+⋯+3=12(p+q−1)(p+q−2)=61+2+\dots+3 = \tfrac12(p+q-1)(p+q-2) = 6 of them. So it is term 6+q=86 + q = 8 of the list. It is in lowest terms.
What to notice

The fraction p/qp/q is the qq-th entry of the diagonal p+qp + q, and the earlier diagonals hold 1+2+⋯+(p+q−2)1 + 2 + \dots + (p+q-2) entries. So its place is 12(p+q−1)(p+q−2)+q\tfrac12(p+q-1)(p+q-2) + q: for 32\tfrac32 that is 6+2=86 + 2 = 8. Every number occurs infinitely often (11=22=33=…\tfrac11 = \tfrac22 = \tfrac33 = \dots); skipping the fractions that are not in lowest terms leaves each number exactly once, but then no simple formula gives its place.

The second idea is geometric. Draw a straight line, mark a point A0A_0 (the origin) and a point A1A_1 to its right, and take the length A0A1A_0A_1 as the unit. To place p/qp/q with p,q>0p, q > 0, divide the unit into qq equal parts and step pp of them to the right of A0A_0. For a negative number −s-s step the same distance to the left. Lengths now carry a sign: measured to the right they count as positive, to the left as negative, so that AB=−BAAB = -BA.

A−2A−1A0A1A21/2−1/35/2unit
Rational points: the point ArA_r lies at signed distance rr from the origin A0A_0, measured in units of A0A1A_0A_1. (cf. Hardy’s Fig. 1)

Precise statements

Definition Rational number Hardy: §1

A rational number is a number r=p/qr = p/q where pp and qq are integers and q≠0q \neq 0. It is in lowest terms when q>0q > 0 and pp, qq have no common factor greater than 11. The rational number 00 is 0/10/1.

Theorem Every rational number has exactly one lowest-terms form

Every rational number can be written as p/qp/q in lowest terms, and in only one way.

Theorem The rationals are closed under arithmetic Hardy: Examples I, 1

If rr and ss are rational, so are r+sr + s, r−sr - s, rsrs, and, when s≠0s \neq 0, r/sr/s.

Definition Rational points of a line Hardy: §2

Fix a line Λ\Lambda, an origin A0A_0 and a unit point A1A_1. For each rational rr the rational point ArA_r is the point with signed length A0Ar=r⋅A0A1A_0A_r = r \cdot A_0A_1; with A0A1=1A_0A_1 = 1 this reads A0Ar=rA_0A_r = r. Then ArAs=s−rA_rA_s = s - r for all rational r,sr, s, and ArA_r lies to the left of AsA_s exactly when r<sr < s.

Proofs

Proof Lowest terms exist and are unique
Strategy

Existence is a matter of cancelling. For uniqueness, suppose two lowest-terms forms name the same number, cross-multiply, and use the fact that a number dividing a product, and sharing no factor with one of its factors, must divide the other.

Existence

Start from any p/qp/q. If q<0q < 0, replace p,qp, q by −p,−q-p, -q; this does not change the number. Let gg be the greatest common divisor of pp and qq and replace them by p/gp/g and q/gq/g. These have no common factor greater than 11, and the quotient is unchanged.

Suppose p/q=r/sp/q = r/s, both in lowest terms

Then ps=rqps = rq. So qq divides psps.

Then qq divides ss, and ss divides qq

Since qq has no factor in common with pp, every prime power dividing qq must divide ss (this is Euclid’s lemma, or unique factorisation into primes). So q∣sq \mid s. The same argument with the roles exchanged, starting from rq=psrq = ps, gives s∣qs \mid q.

Conclude q=sq = s and p=rp = r

Two positive integers that divide each other are equal, so q=sq = s, and then ps=rqps = rq gives p=rp = r.

The closure theorem is a calculation. If r=p/qr = p/q and s=m/ns = m/n, then

r±s=pn±mqqn,rs=pmqn,rs=pnqm (m≠0),r \pm s = \frac{pn \pm mq}{qn}, \qquad rs = \frac{pm}{qn}, \qquad \frac{r}{s} = \frac{pn}{qm} \ (m \neq 0),

and each right-hand side is a quotient of integers with a non-zero denominator. Notice what this means: no amount of adding, subtracting, multiplying and dividing fractions can ever lead outside the fractions. If a new kind of number is needed, it will have to come from some other operation. In the next lesson that operation is taking a square root.

Worked examples and exercises

Exercise Rational right-angled triangles ●○○ Hardy: Examples I, 2

Let λ,m,n\lambda, m, n be positive rationals with m>nm > n. Show that λ(m2−n2)\lambda(m^2 - n^2), 2λmn2\lambda mn and λ(m2+n2)\lambda(m^2 + n^2) are positive rationals, and that they are the sides of a right-angled triangle. Use this to produce as many right-angled triangles with rational sides as you like.

Hint
Positivity and rationality follow from closure. For the triangle, check Pythagoras: compare (m2−n2)2+(2mn)2(m^2 - n^2)^2 + (2mn)^2 with (m2+n2)2(m^2 + n^2)^2.

Solution

All three are built from λ,m,n\lambda, m, n by +,−,×+, -, \times, so they are rational; they are positive because m>n>0m > n > 0 and λ>0\lambda > 0. Expanding,

(m2−n2)2+(2mn)2=m4−2m2n2+n4+4m2n2=(m2+n2)2,(m^2 - n^2)^2 + (2mn)^2 = m^4 - 2m^2n^2 + n^4 + 4m^2n^2 = (m^2 + n^2)^2,

and multiplying by λ2\lambda^2 gives the same identity for the three given numbers. By the converse of Pythagoras’ theorem they are the sides of a right-angled triangle, with hypotenuse λ(m2+n2)\lambda(m^2 + n^2). With λ=1\lambda = 1: m,n=2,1m, n = 2, 1 gives 3,4,53, 4, 5; m,n=3,2m, n = 3, 2 gives 5,12,135, 12, 13; m,n=4,1m, n = 4, 1 gives 15,8,1715, 8, 17. Every choice gives a triangle, so there are as many as we please.

Exercise Terminating decimals ●●○ Hardy: Examples I, 3

Show that a terminating decimal is a rational number whose denominator (in lowest terms) has no prime factors other than 22 and 55, and conversely that every such rational number is a terminating decimal, in only one way.

Hint
A decimal with kk figures after the point is N/10kN/10^k for an integer NN, and 10k=2k5k10^k = 2^k 5^k.
Hint
For the converse, if q=2a5bq = 2^a 5^b, multiply top and bottom by a power of 22 or of 55 to make the denominator a power of 1010.

Solution

Decimal to fraction. A decimal with kk figures after the point equals N/10kN/10^k for an integer NN. When this is reduced to lowest terms p/qp/q, the denominator qq divides 10k=2k5k10^k = 2^k5^k, so its only prime factors are 22 and 55.

Fraction to decimal. Let p/qp/q be in lowest terms with q=2a5bq = 2^a5^b, and put k=max⁡(a,b)k = \max(a, b). Then

pq=p⋅2k−a5k−b2k5k=p⋅2k−a5k−b10k,\frac{p}{q} = \frac{p \cdot 2^{k-a} 5^{k-b}}{2^k 5^k} = \frac{p \cdot 2^{k-a}5^{k-b}}{10^k},

an integer divided by 10k10^k, which is a decimal with at most kk figures after the point.

Uniqueness. Suppose two terminating decimals are equal. Pad the shorter one with zeros so that both have kk figures after the point; they are then N/10kN/10^k and M/10kM/10^k, so N=MN = M, and the strings of digits agree (apart from the trailing zeros we added). So the representation is unique once we agree not to write trailing zeros.

Exercise Where is p/qp/q in the list? ●●○ Hardy: Examples I, 4

List the positive rationals as 11,21,12,31,22,13,41,…\tfrac11, \tfrac21, \tfrac12, \tfrac31, \tfrac22, \tfrac13, \tfrac41, \dots Show that p/qp/q is term number 12(p+q−1)(p+q−2)+q\tfrac12(p+q-1)(p+q-2) + q. Which fraction is term 5050?

Hint
The fractions with p+q=sp + q = s form one block of s−1s - 1 terms, written with q=1,2,…,s−1q = 1, 2, \dots, s-1.
Hint
For term 5050: find the block. The first 99 blocks (s=2,…,10s = 2, \dots, 10) contain 1+2+⋯+9=451 + 2 + \dots + 9 = 45 terms.

Solution

The blocks s=2,3,…s = 2, 3, \dots have 1,2,3,…1, 2, 3, \dots terms, and inside block ss the term with denominator qq is the qq-th. The fraction p/qp/q is in block s=p+qs = p + q, which is preceded by blocks of total length

1+2+⋯+(s−2)=12(s−1)(s−2)=12(p+q−1)(p+q−2).1 + 2 + \dots + (s - 2) = \tfrac12 (s-1)(s-2) = \tfrac12(p+q-1)(p+q-2).

Adding its position qq inside the block gives the formula.

For term 5050: blocks s=2,…,10s = 2, \dots, 10 hold 4545 terms, so term 5050 is the 55th term of block s=11s = 11, which has q=5q = 5, p=6p = 6. Term 5050 is 65\tfrac65. Check: 12⋅10⋅9+5=50\tfrac12 \cdot 10 \cdot 9 + 5 = 50.

Exercise Signed lengths ●○○ Hardy: §2

Using the rule A0Ar=rA_0A_r = r for every rational rr (positive or negative) and the convention AB=−BAAB = -BA, show that ArAs=s−rA_rA_s = s - r.

Hint
Go from ArA_r to AsA_s by way of the origin.

Solution

Signed lengths along one line add: ArAs=ArA0+A0AsA_rA_s = A_rA_0 + A_0A_s, whichever order the three points are in. Now ArA0=−A0Ar=−rA_rA_0 = -A_0A_r = -r and A0As=sA_0A_s = s, so ArAs=s−rA_rA_s = s - r. In particular the distance between the points is ∣s−r∣|s - r|, and AsA_s is to the right of ArA_r exactly when s>rs > r.

Check yourself

Check yourself Choose one

Which of these is in lowest terms, in Hardy’s sense?

Why

Lowest terms needs two things: no common factor, and a positive denominator. 6−4\tfrac{6}{-4} has the common factor 22 and a negative denominator; −3−2\tfrac{-3}{-2} and 3−2\tfrac{3}{-2} have negative denominators. All four name either 32\tfrac32 or −32-\tfrac32, and −32-\tfrac32 is written −32\tfrac{-3}{2}.

Check yourself Enter a number

In Hardy’s list 11,21,12,31,…\tfrac11, \tfrac21, \tfrac12, \tfrac31, \dots, what is the position of 43\tfrac43?

Why

Here p+q=7p + q = 7. The blocks p+q=2,…,6p + q = 2, \dots, 6 hold 1+2+3+4+5=151 + 2 + 3 + 4 + 5 = 15 terms, and 43\tfrac43 is the 3rd term of the block p+q=7p + q = 7 (the one with q=3q = 3). So it is term 15+3=1815 + 3 = 18, as the formula 12⋅6⋅5+3\tfrac12 \cdot 6 \cdot 5 + 3 says. A common slip is to count the block of 43\tfrac43 itself among the earlier ones.

Check yourself True or false?

Since the rationals are closed under +,−,×,÷+, -, \times, \div, every number you can compute from fractions is rational.

Why

False. Closure covers only the four operations. Other operations, such as taking a square root, can lead out of the rationals: the next lesson shows that no fraction squares to 22.

Check yourself True or false?

In Hardy’s list every positive rational number appears infinitely often.

Why

True. The number p/qp/q appears as p/qp/q, 2p/2q2p/2q, 3p/3q3p/3q, …, and each of these is in the list. That is why Hardy remarks that omitting the repeats makes the position formula harder.

Hardy’s language

they are illustrations and nothing more, and are employed merely for the sake of clearness of exposition.

— G. H. Hardy, §2

Hardy means the geometry: pictures of points on a line help us think, but no proof in the book depends on them. This is why he can later define the real numbers without any geometry at all.

Summary

Summary
  • A rational number is p/qp/q with integers pp, q≠0q \neq 0; it has exactly one lowest-terms form, with q>0q > 0 and no common factor.
  • The rationals are closed under +,−,×,÷+, -, \times, \div: arithmetic alone never produces anything new.
  • The positive rationals can be listed in a single sequence by running along the diagonals p+q=p + q = constant; p/qp/q is term 12(p+q−1)(p+q−2)+q\tfrac12(p+q-1)(p+q-2) + q.
  • Each rational rr has a point ArA_r on a line at signed distance rr from the origin. Geometry is used for illustration only.