taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.2-5

Exercise 1.2.2-5

not stated yet in Lean solution written

Rating05
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.2 of Volume 1. Companion chapter: Numbers, powers and logarithms

The task

Give a definition of the real numbers by binary expansions, to replace Eq. (2) of the section.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Copy the shape of Eqs. (1) and (2) and change the base from 1010 to 22.

Hint 2

Keep the rule on the infinite run of the largest digit.

Solution

Show the solution

A real number is a quantity xx with a binary expansion x=n+(0.b1b2b3…)2x = n + (0.b_1 b_2 b_3 \ldots)_2, where nn is an integer, each bib_i is 00 or 11, and the sequence of bits does not end with infinitely many 11s. The expansion means that n+b12+b24+⋯+bk2k≤x<n+b12+b24+⋯+bk2k+12kn + \frac{b_1}{2} + \frac{b_2}{4} + \cdots + \frac{b_k}{2^k} \le x < n + \frac{b_1}{2} + \frac{b_2}{4} + \cdots + \frac{b_k}{2^k} + \frac{1}{2^k} for every positive integer kk. The rule on the bits is needed for the same reason as in the decimal case: without it the number 1/21/2 would have two expansions, (0.1000…)2(0.1000\ldots)_2 and (0.0111…)2(0.0111\ldots)_2. Both definitions describe the same real numbers. The bit bkb_k of xx is ⌊2kx⌋ mod 2\lfloor 2^k x \rfloor \bmod 2, and the decimal digits are found in the same way with powers of 1010.

Check

Take x=3/4x = 3/4. The bits 1,11, 1 give for k=2k = 2 the bounds 3/4≤x<13/4 \le x < 1, and xx passes. The string (0.10111…)2(0.10111\ldots)_2 ends in ones, so it is not allowed. Its bits 1,01, 0 would give 1/2≤x<3/41/2 \le x < 3/4, which rejects 3/43/4.

Remarks

Any integer base ≥2\ge 2 gives an equivalent definition. Exercise 1.2.2-6 transfers to a binary expansion without change.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

not stated yet The exercise is not stated in Lean yet.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.