Divisibility is exact
b | a means the division leaves no remainder. It is a statement about integers, not an operation.
a = qb + r with 0 ≤ r < b, and both q and r are unique. That single theorem is the foundation of everything else in this course.
Core ideas
Divisibility is a relation on the integers, and the division algorithm is what makes it computable.
b | a means the division leaves no remainder. It is a statement about integers, not an operation.
That convention is what makes mod a function. −7 mod 3 is 2, not −1.
d | a and d | b imply d | (ax + by) for any integers x, y. Almost every proof in this course uses that one line.
The material
The definition, the theorem, and the properties everything else rests on.
For integers a and b with b ≠ 0, b | a ("b divides a") means there is an integer k with a = bk. Then b is a divisor or factor of a.
For integers a, b, c, d: if d | a and d | b then d | (ax + by) for all integers x, y; if a | b and b | c then a | c; and d | a with a ≠ 0 implies |d| ≤ |a|.
For the first: a = dm and b = dn, so ax + by = d(mx + ny), and mx + ny is an integer.
For the second: b = am and c = bn, so c = a(mn).
For the third: a = dk with a ≠ 0 forces k ≠ 0, so |k| ≥ 1 and |a| = |d||k| ≥ |d|.
□
The first property is the workhorse. It is what lets the Euclidean algorithm work, what proves Euclid's theorem on primes, and what makes Bézout's identity useful — and it is one line.
For any integer a and any positive integer b, there are unique integers q and r with a = qb + r and 0 ≤ r < b.
Existence. Let S = {a − qb : q ∈ ℤ, a − qb ≥ 0}. It is nonempty (take q very negative) and consists of non-negative integers, so by well-ordering (“The Well-Ordering Principle” in Induction and Recursion) it has a least element r = a − qb.
If r ≥ b then r − b = a − (q+1)b is in S and smaller than r, contradicting minimality. So 0 ≤ r < b.
Uniqueness. If a = qb + r = q'b + r' with both remainders in [0, b), then b(q − q') = r' − r. The right side has absolute value less than b, and the left is a multiple of b, so both are 0. Hence r = r' and q = q'.
□
Uniqueness is what makes the notation legitimate: a div b and a mod b name specific integers rather than one of several possibilities.
−7 = (−3)(3) + 2, so q = −3 and r = 2. Not (−2)(3) + (−1), because the theorem requires 0 ≤ r < b. The quotient rounds toward negative infinity, not toward zero.
Many programming languages disagree with the theorem here: C-style % returns −1 for −7 % 3, while Python returns 2. The mathematical convention is Python's, and it is the one that makes modular arithmetic work — classes should not depend on the sign of a representative.
a mod b denotes the unique remainder r from the division algorithm, so 0 ≤ a mod b < b always.
Interactive
Algorithms with their traces
Method
Replace the statement by the equation it abbreviates.
Divisibility claims are unusable until unfolded. Almost every proof in this course starts here.
d | a and d | b give d | (ax + by). This is the step that appears in nearly every argument.
a = qb + r with 0 ≤ r < b, and both are unique.
The remainder is never negative. If a computation produces one, add b.
Why the digit-sum test works, using nothing but this lesson's property.
The whole argument is the linear-combination property used twice: once to see that Σ dᵢ(10ⁱ − 1) is a multiple of 3, and once to pass divisibility between n and its digit sum, whose difference that sum is. Nine divides every 10ⁱ − 1 too, so the same test works for 9. “Modular Arithmetic” will give the argument a notation — 10ⁱ ≡ 1 (mod 3) — that makes it one line, and will handle 11, where 10ⁱ − (−1)ⁱ is the multiple.
Prove that if d | (a + b) and d | a then d | b. It is one application of the property, and it is the shape of argument that every lesson from “Primes and Unique Factorisation” to “Bézout's Identity and Modular Inverses” repeats.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.