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-17

Exercise 1.2.4-17

proved in Lean solution written

RatingM15
MarkersM (mathematical)
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Prove Law A (congruences can be added, subtracted and multiplied) from the definition of congruence, and prove that a congruence modulo rsrs gives congruences modulo rr and modulo ss.

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

First show that, for integers, a≡b(modm)a \equiv b \pmod m means that a−ba - b is an integer multiple of mm.

Hint 2

Then write a−b=mka - b = mk and x−y=mlx - y = ml and compute ax−byax - by.

Solution

Show the solution

The criterion. Let aa, bb, mm be integers. Claim: a≡b(modm)a \equiv b \pmod m if and only if a−b=mka - b = mk for an integer kk. For m=0m = 0 both sides say a=ba = b. Let m≠0m \ne 0. If a mod m=b mod ma \bmod m = b \bmod m, then a−b=m(⌊a/m⌋−⌊b/m⌋)a - b = m(\lfloor a/m \rfloor - \lfloor b/m \rfloor). Conversely, let a=b+mka = b + mk and z=b mod mz = b \bmod m. Then a/m=⌊b/m⌋+k+z/ma/m = \lfloor b/m \rfloor + k + z/m with z/m∈[0,1)z/m \in [0, 1), so ⌊a/m⌋=⌊b/m⌋+k\lfloor a/m \rfloor = \lfloor b/m \rfloor + k and a mod m=a−m⌊b/m⌋−mk=b−m⌊b/m⌋=za \bmod m = a - m\lfloor b/m \rfloor - mk = b - m\lfloor b/m \rfloor = z.

Law A. Let a−b=mka - b = mk and x−y=mlx - y = ml with integers kk and ll. Then (a+x)−(b+y)=m(k+l)(a + x) - (b + y) = m(k + l) and (a−x)−(b−y)=m(k−l)(a - x) - (b - y) = m(k - l). For the product,

ax−by=a(x−y)+(a−b)y=m(al+ky),ax - by = a(x - y) + (a - b)y = m(al + ky),

and al+kyal + ky is an integer. By the criterion, a+x≡b+ya + x \equiv b + y, a−x≡b−ya - x \equiv b - y and ax≡by(modm)ax \equiv by \pmod m.

Half of Law D. Let a≡b(modrs)a \equiv b \pmod{rs}. Then a−b=rska - b = rsk for an integer kk. So a−b=r(sk)=s(rk)a - b = r(sk) = s(rk), a multiple of rr and a multiple of ss by integers. So a≡ba \equiv b modulo rr and modulo ss. □\square

Check

Modulo 77: 17≡317 \equiv 3 and 11≡411 \equiv 4. Then 28≡7≡028 \equiv 7 \equiv 0, 6≡−1≡66 \equiv -1 \equiv 6, and 187≡12≡5187 \equiv 12 \equiv 5. For the half of Law D, 100≡16(mod84)100 \equiv 16 \pmod{84} gives 100≡16100 \equiv 16 modulo 33 (both 11) and modulo 2828 (both 1616).

Remarks

Exercise 1.2.4-18 proves the other half of Law D, which needs r⊥sr \perp s. Exercise 1.2.4-24 asks how far the laws go for real numbers.

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

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

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

Something is wrong? Report it.