Divisibility and the greatest common divisor
Divisibility notation and properties, the division algorithm, and the Euclidean algorithm for computing a greatest common divisor.
- State the four basic properties of divisibility, including transitivity and the linear-combination property.
- Apply the division algorithm to write any integer as a=qn+r with 0<=r<n.
- Compute gcd(a, b) by hand using the Euclidean algorithm.
12 min read
Intuition
Every later idea in this module rests on one question: does one number split evenly into another? RSA key generation depends on it directly — an encryption exponent only has a working decryption partner because . Diffie-Hellman, modular inverses, and the extended Euclidean algorithm on the next page all start from the same machinery covered here: divisibility and the greatest common divisor.
Mechanism
A non-zero integer divides if for some integer — dividing by leaves no remainder. This is written , and is called a divisor of . For example, because , and because .
Four properties follow directly from the definition:
- If , then .
- If and , then .
- Any divides .
- Transitivity: if and , then .
Transitivity holds because and mean and for some integers . Substituting the first into the second gives , so . The lecture gives two instances of this: and give ; and give .
A stronger property extends this to combinations. If and , then divides for any integers and — not just or . This is the linear combination property. The lecture’s example: and , so divides for any . Writing and , which is a multiple of regardless of what and are.
The division algorithm formalises ordinary long division. For a positive integer and a non-negative integer , is the quotient, is the remainder, and is the floor function: the greatest integer no larger than the argument. The remainder is always non-negative and strictly less than — this constraint is what makes and unique for a given and .
The greatest common divisor of and , , is the largest integer that divides both. Equivalently, . Because the definition requires a positive result, — sign does not matter. since every integer divides , and is defined to be . Two integers are relatively prime if their only common positive divisor is , equivalently .
The Euclidean algorithm finds by repeated application of the division algorithm: replace with and repeat until the remainder is . The last non-zero remainder is the gcd. Each step is smaller than the last, so the algorithm always terminates.
Worked example
Answergcd(710, 310) = 10
The lecture names this exact example, but the figure showing its working did not survive extraction from the source PDF. The steps below apply the division algorithm repeatedly, exactly as defined above.
- — divide 710 by 310, quotient 2, remainder 90.
- — repeat on (310, 90).
- — repeat on (90, 40).
- — the remainder is 0, so the algorithm stops.
- The last non-zero remainder was , so .
Exam detail
Relatively prime means the only common positive divisor is — neither number has to be prime itself. and are relatively prime: the divisors of are and the divisors of are , and is the only entry on both lists.
Two edge cases are worth having ready: , and by definition. Both follow from “any non-zero divides ” — places no constraint on a common divisor, so the largest one is whatever contributes.
Formula
Division algorithm
- the dividend
- the divisor (positive)
- the quotient
- the remainder, 0 <= r < n
Pitfall
, not rounded or truncated toward zero — for non-negative and positive these agree, but do not carry the habit of “round toward zero” into modular arithmetic on the next page, where negative dividends make the two rules disagree.
Recall
Why does 11 | 66 and 11 | 77 guarantee 11 divides m·66 + n·77 for every integer m and n?
Because and for some integers . Substituting, , which is times an integer — so divides it, whatever and are.
Source
Week 4 Number Theory PDF