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.4-24

Exercise 1.2.4-24

not stated yet in Lean solution written

RatingM20
MarkersM (mathematical), recommended
KindInformal: the exercise has no formal statement, so Lean does not state it from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Find out which of Laws A, B, C and D stay true when the numbers in them are real and not only integers.

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

For a real modulus m≠0m \ne 0, the statement a≡b(modm)a \equiv b \pmod m means a−b=kma - b = km for an integer kk. The proof is the one of Exercise 1.2.4-17, which uses only the floor.

Hint 2

Test each law with small fractions, with the modulus 11. A law that fails there needs an integrality condition.

Solution

Show the solution

Setting. For real numbers, x≡y(modz)x \equiv y \pmod z means x mod z=y mod zx \bmod z = y \bmod z, as in the integer case. The proof of Exercise 1.2.4-17 does not use that the numbers are integers, so x≡y(modz)x \equiv y \pmod z means x−y=kzx - y = kz for an integer kk, also for real xx, yy, zz.

Law C holds for all reals. For a real n≠0n \ne 0, the distributive law n(x mod y)=(nx) mod (ny)n(x \bmod y) = (nx) \bmod (ny) of Exercise 1.2.4-15 holds for real numbers. So a≡b(modm)a \equiv b \pmod m if and only if na≡nb(modnm)na \equiv nb \pmod{nm}. No condition is needed.

Law A holds for sums and differences, and for products only with integrality. If a−b=mra - b = mr and x−y=msx - y = ms with integers rr, ss, then the sum and the difference are congruent for all real numbers. For the product, ax−by=a(x−y)+(a−b)y=m(as+ry)ax - by = a(x - y) + (a - b)y = m(as + ry). This is a multiple of mm by an integer if aa and yy are integers, and the symmetric form ax−by=b(x−y)+(a−b)xax - by = b(x - y) + (a - b)x works when bb and xx are integers. Without such a condition the law is false: modulo 11, 1≡01 \equiv 0 and 12≡12\tfrac12 \equiv \tfrac12, but 1⋅12=12≢0=0⋅121 \cdot \tfrac12 = \tfrac12 \not\equiv 0 = 0 \cdot \tfrac12. In particular a congruence can be multiplied by any integer.

Law B needs integers xx and yy. The relation a⊥ma \perp m has no meaning for general reals, so take this definition: aa and mm are relatively prime if ua+vm=1ua + vm = 1 for integers uu and vv. For integers this is the usual condition, by Exercise 1.2.4-19 and its converse. With this definition, let a≡b(modm)a \equiv b \pmod m and ax≡by(modm)ax \equiv by \pmod m, where xx and yy are integers and aa, bb, mm are real. Write a−b=jma - b = jm and ax−by=kmax - by = km. Then a(x−y)=(ax−by)−(a−b)y=m(k−jy)a(x - y) = (ax - by) - (a - b)y = m(k - jy). So

x−y=(ua+vm)(x−y)=m(u(k−jy)+v(x−y)),x - y = (ua + vm)(x - y) = m\bigl(u(k - jy) + v(x - y)\bigr),

and the factor of mm is an integer, because xx and yy are integers. So x≡y(modm)x \equiv y \pmod m. If xx or yy is not an integer, the law fails even with a=2a = 2 and m=1m = 1, where gcd⁡(2,1)=1\gcd(2, 1) = 1: take b=ab = a, x=12x = \tfrac12 and y=0y = 0. Then ax=1≡0=ay(mod1)ax = 1 \equiv 0 = ay \pmod 1, but 12≢0(mod1)\tfrac12 \not\equiv 0 \pmod 1.

Law D. The half "modulus rsrs gives modulus rr and ss" needs integers: from a−b=krsa - b = krs one gets a−b=(ks)ra - b = (ks)r, and ksks is an integer when ss is. So the congruence modulo rr needs ss to be an integer, and the congruence modulo ss needs rr to be an integer. It fails for the pair r=1r = 1, s=12s = \tfrac12, a=12a = \tfrac12, b=0b = 0: the difference is 12=1⋅rs\tfrac12 = 1 \cdot rs, so a≡b(modrs)a \equiv b \pmod{rs}, but a≢b(mod1)a \not\equiv b \pmod 1. The other half holds for real rr and ss that are relatively prime in the sense above. Let a−b=jr=ksa - b = jr = ks and ur+vs=1ur + vs = 1. Then

a−b=(ur+vs)(a−b)=ur(ks)+vs(jr)=rs(uk+vj),a - b = (ur + vs)(a - b) = u r (ks) + v s (jr) = rs(uk + vj),

so a≡b(modrs)a \equiv b \pmod{rs}. For integers this is a second proof of Exercise 1.2.4-18.

Summary. Law C holds for all reals. Law A holds for sums and differences for all reals and for products when the numbers that multiply the differences are integers. Law B holds for real aa, bb, mm that are relatively prime in the sense of an integer combination, if xx and yy are integers. Law D holds in one direction for real moduli that are relatively prime in that sense, and in the other direction when the other modulus is an integer.

Remarks

A computer run with fractions of denominators 11, 22, 33, 44, 66 and random multiples of the modulus found no counterexample to the product rule with integer aa and yy, to Law B with the integer combination condition, or to the second half of Law D with that condition. The three counterexamples above are exact. The case of integers is Exercises 1.2.4-17 to 1.2.4-20. The book's answer is shorter: it names only the laws that need no extra condition, Law A for sums and differences and Law C.

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.