Decimal representation of the reals Note: 1 lecture (optional)

In document Basic Analysis: Introduction to Real Analysis (Page 41-47)

Real Numbers

1.5 Decimal representation of the reals Note: 1 lecture (optional)

We often think of real numbers as theirdecimal representation. For a positive integern, we find the digitsdK,dK−1, . . . ,d2,d1,d0for someK, where eachdj is an integer between 0 and 9, then


We often assumedK 6=0. To representnwe write the sequence of digits: n=dKdK−1···d2d1d0. By a (decimal)digit, we mean an integer between 0 and 9.

Similarly, we represent some rational numbers. That is, for certain numbers x, we can find negative integer−M, a positive integerK, and digitsdK,dK−1, . . . ,d1,d0,d−1, . . . ,d−M, such that

x=dK10K+dK−110K−1+···+d2102+d110+d0+d−110−1+d−210−2+···+d−M10−M. We writex=dKdK−1···d1d0.d−1d−2···d−M.

Not every real number has such a representation, even the simple rational number1/3does not. The irrational number√2 does not have such a representation either. To get a representation for all real numbers we must allow infinitely many digits.

Let us consider only real numbers in the interval (0,1]. If we find a representation for these, adding integers to them obtains a representation for all real numbers. Take an infinite sequence of decimal digits:

0.d1d2d3. . . .

That is, we have a digitdjfor every j∈N. We renumbered the digits to avoid the negative signs.

We call the number

Dn:=10d1 + d2 102+ d3 103+···+ dn 10n.

the truncation ofxtondecimal digits. We say this sequence of digits represents a real numberxif x=sup n∈N d 1 10+ d2 102+ d3 103+···+ dn 10n =sup n∈N Dn. Proposition 1.5.1.

(i) Every infinite sequence of digits0.d1d2d3. . .represents a unique real number x∈[0,1], and Dn≤x≤Dn+ 1

10n for all n∈N.

(ii) For every x(0,1]there exists an infinite sequence of digits 0.d1d2d3. . .that represents x. There exists a unique representation such that

Proof. Let us start with the first item. Take an arbitrary infinite sequence of digits 0.d1d2d3. . .. Use the geometric sum formula to write

Dn= d101 + d2 102+ d3 103+···+ dn 10n ≤109 +1092+ 9 103+···+ 9 10n = 9 10 1+1/10+ (1/10) 2+ ···+ (1/10)n−1 = 9 10 1 −(1/10)n 1−1/10 =1(1/10)n<1.

In particular,Dn<1 for alln. A sum of nonnegative numbers is nonnegative soDn≥0, and hence 0≤sup



Therefore, 0.d1d2d3. . .represents a unique numberx:=supn∈NDn∈[0,1]. Asxis a supremum

thenDn≤x. Takem∈N. Ifm<n, thenDm−Dn≤0. Ifm>n, then computing as above

Dm−Dn= dn+1 10n+1+ dn+2 10n+2+ dn+3 10n+3+···+ dm 10m ≤ 1 10n 1−(1/10) m−n < 1 10n. Take the supremum overmto find


We move on to the second item. Take any x(0,1]. First let us tackle the existence. For convenience letD0:=0. Then,D0<x≤D0+10−0. Suppose we defined the digitsd1,d2, . . . ,dn, and thatDk<x≤Dk+10−k, fork=0,1,2, . . . ,n. We need to definedn+1.

By the of the real numbers, find an integer jsuch thatxDn≤ j10−(n+1). Take the least such jand obtain

(j−1)10−(n+1)<x−Dn≤ j10−(n+1). (1.3) Let dn+1 := j−1. As Dn <x, then dn+1 = j−1≥0. On the other hand sincex−Dn≤10−n we have that j is at most 10, and thereforedn+1≤9. Sodn+1is a decimal digit. SinceDn+1= Dn+dn+110−(n+1) addDnto the inequality ( ) above:

Dn+1=Dn+ (j−1)10−(n+1)<x≤Dn+j10−(n+1)

=Dn+ (j−1)10−(n+1)+10−(n+1)=Dn+1+10−(n+1). And soDn+1<x≤Dn+1+10−(n+1) holds. We inductively defined an infinite sequence of digits 0.d1d2d3. . ..

Consider Dn<x≤Dn+10−n. AsDn<x for all n, then sup{Dn:n∈N} ≤x. The second

inequality forDnimplies

xsup{Dm:m∈N} ≤x−Dn≤10−n.

As the inequality holds for allnand 10−n can be made arbitrarily small (see ) we havex≤sup{Dm:m∈N}. Therefore sup{Dm:m∈N}=x.

What is left to show is the uniqueness. Suppose 0.e1e2e3. . .is another representation ofx. Let Enbe then-digit truncation of 0.e1e2e3. . ., and supposeEn<x≤En+10−nfor alln∈N. Suppose

for someKN,en=dnfor alln<K, soDK−1=EK−1. Then

EK=DK−1+eK10−K <x≤EK+10−K =DK−1+eK10−K+10−K. SubtractingDK−1and multiplying by 10K we get

eK <(x−DK−1)10K≤eK+1. Similarly,

dK <(x−DK−1)10K≤dK+1.

Hence, botheKanddKare the largest integer jsuch that j<(x−DK−1)10K, and thereforeeK=dK. That is, the representation is unique.

The representation is not unique if we do not require Dn<xfor alln. For example, for the number1/2the method in the proof obtains the representation

0.49999. . . .

However, we also have the representation 0.50000. . ..

The only numbers that have nonunique representations are ones that end either in an infinite sequence of 0s or 9s, because the only representation for whichDn=xis one where all digits past thenth digit are zero. In this case there are exactly two representations ofx(see the exercises).

Let us give another proof of the uncountability of the reals using decimal representations. This is Cantor’s second proof, and is probably better known. This proof may seem shorter, but it is because we already did the hard part above and we are left with a slick trick to prove thatRis uncountable.

This trick is calledCantor diagonalizationand finds use in other proofs as well. Theorem 1.5.2(Cantor). The set(0,1]is uncountable.

Proof. LetX:={x1,x2,x3, . . .}be any countable subset of real numbers in(0,1]. We will construct a real number not inX. Let

xn=0.d1nd2nd3n. . .

be the unique representation from the proposition, that is,dnj is the jth digit of thenth number. Let en:=


1 ifdnn6=1,

2 ifdnn=1.

Let En be the n-digit truncation of y=0.e1e2e3. . .. Because all the digits are nonzero we get En<En+1≤y. Therefore


for alln, and the representation is the unique one foryfrom the proposition. For everyn, thenth digit ofyis different from thenth digit ofxn, soy=6 xn. Thereforey∈/X, and asX was an arbitrary countable subset,(0,1]must be uncountable. See for an example.

x1= 0. 1 3 2 1 0 ··· x2= 0. 7 9 4 1 3 ··· x3= 0. 3 0 1 3 4 ··· x4= 0. 8 9 2 5 6 ··· x5= 0. 1 6 0 2 4 ··· ... ... ... ... ... ... ... ...

Number not in the list: y=0.21211. . .

Figure 1.4:Example of Cantor diagonalization, the diagonal digitsdnnmarked.

Using decimal digits we can also find lots of numbers that are not rational. The following proposition is true for every rational number, but we give it only forx(0,1]for simplicity. Proposition 1.5.3. If x(0,1]is a rational number and x=0.d1d2d3. . ., then the decimal digits eventually start repeating. That is, there are positive integers N and P, such that for all n≥N, dn=dn+P.

Proof. Letx=p/qfor positive integers pandq. Supposexis a number with a unique representation, as otherwise we have seen above that both its representations are repeating, see also . This also means thatx6=1 so p<q.

To compute the first digit we take 10pand divide byq. Letd1be the quotient, and the remainder r1is some integer between 0 andq−1. That is,d1is the largest integer such thatd1q≤10pand thenr1=10p−d1q. As p<q, thend1<10, sod1is a digit. Furthermore,

d1 10 ≤ p q = d1 10+ r1 10q ≤ d1 10+ 1 10.

The first inequality must be strict sincexhas a unique representation. That is,d1really is the first digit. What is left isr1/(10q). This is the same as computing the first digit ofr1/q. To computed2 divide 10r1byq, and so on. After computingn−1 digits, we havep/q=Dn−1+rn−1/(10nq). To get

thenth digit, divide 10rn1byqto get quotientdn, remainderrn, and the inequalities dn 10≤ rn−1 q = dn 10+ rn 10q≤ dn 10+ 1 10. Dividing by 10n−1and addingD

n−1we find

Dn≤Dn−1+10rn−n1q = qp ≤Dn+101n. By uniqueness we really have thenth digitdnfrom the construction.

The new digit depends only the remainder from the previous step. There are at mostqpossible remainders and hence at some step the process must start repeating itself, andPis at mostq.

Example 1.5.4: The number

x=0.101001000100001000001. . . ,

is irrational. That is, the digits arenzeros, then a one, thenn+1 zeros, then a one, and so on and so forth. The fact thatxis irrational follows from the proposition; the digits never start repeating. For everyP, if we go far enough, we find a 1 followed by at leastP+1 zeros.



Exercise1.5.1(Easy): What is the decimal representation of1guaranteed by ? Make sure

to show that it does satisfy the condition.

Exercise1.5.2: Prove the converse of , that is, if the digits in the decimal representation of

x are eventually repeating, then x must be rational.

Exercise1.5.3: Show that real numbers x(0,1)with nonunique decimal representation are exactly the

rational numbers that can be written as 10mn for some integers m and n. In this case show that there exist

exactly two representations of x.

Exercise1.5.4: Let b2be an integer. Define a representation of a real number in[0,1]in terms of base b

rather than base 10 and prove for base b.

Exercise1.5.5: Using the previous exercise with b=2(binary), show that cardinality ofRis the same as

the cardinality ofP(N), obtaining yet another (though related) proof thatRis uncountable. Hint: Construct

two injections, one from[0,1]toP(N)and one fromP(N)to[0,1]. Hint 2: Given a set A⊂N, let the nth

binary digit of x be 1 if n∈A.

Exercise1.5.6(Challenging): Construct a bijection between[0,1]and[0,1]×[0,1]. Hint: Consider even

and odd digits to construct a bijection between[0,1]\A and[0,1]×[0,1]for a countable set A (be careful

about uniqueness of representation). Then construct a bijection between([0,1]×[0,1])\B and[0,1]×[0,1]

for a countable set B (e.g. use thatNand the even natural numbers are bijective).

Exercise1.5.7: Prove that if x=p/q(0,1]is a rational number, q>1, then the period P of repeating digits

in the decimal representation of x is in fact less than or equal to q−1.

Exercise 1.5.8: Prove that if b∈Nand b≥2, then for anyε >0, there is an n∈Nsuch that we have


ε. Hint: One possibility is to first prove that bn>n for all n∈Nby induction. Exercise1.5.9: Explicitly construct an injection f:R→R\Qusing .

If you can’t do it, try to at least construct an injection from[0,1]

In document Basic Analysis: Introduction to Real Analysis (Page 41-47)