Number Theory · Topic 1 of 2
1. Euclid's Algorithm
Theory
Euclid's algorithm finds the greatest common divisor (gcd) of two positive integers by repeated division. Write each step as with , then replace with and repeat until the remainder is . The last non-zero remainder is the gcd.
The gcd can then be written as a linear combination of the two numbers, for integers , by back-substituting through the equations.
The Golden Rule: keep dividing until the remainder is ; the gcd is the last non-zero remainder. For the linear combination, work backwards through the algorithm's equations.
⚠️ Common Examiner Traps
- Reading the wrong remainder: the gcd is the last non-zero remainder, not the final .
- Back-substitution slips: substitute one equation at a time and keep the two original numbers visible so the coefficients stay correct.
- Division form: each line must be with .
Worked examples
Example 1
Use Euclid's algorithm to find .
Step 1: Apply repeated division:
Step 2: The last non-zero remainder is , so .
Example 2
Express as a linear combination of and .
Step 1: Rearrange the algorithm's equations to make the remainders the subject:
Step 2: Substitute the expression for and collect:
Step 3: So .