CSC165 · 2081 · 5 marks
Find the GCD of 12 and 16 using Extended Euclidean Algorithm.
Find the GCD of 12 and 16 using Extended Euclidean Algorithm. [5]
GCD of 12 and 16 using the Extended Euclidean Algorithm
Given
- $a = 16$, $b = 12$ (arranged so larger is first)
- Goal: find $\gcd(12,16)$ and integers $s, t$ such that $\gcd = s\cdot 12 + t\cdot 16$
Step 2 - Apply the Euclidean Algorithm (Successive Division)
| Step | Division | Equation |
|---|---|---|
| 1 | $16 \div 12$ | $16 = 1 \times 12 + 4$ |
| 2 | $12 \div 4$ | $12 = 3 \times 4 + 0$ |
The last non-zero remainder is $4$.
$$\gcd(12, 16) = 4$$
Step 3 - Back-Substitution (Express as Linear Combination)
From Step 1, isolate the remainder $4$:
$$4 = 16 - 1 \times 12$$
Rewrite explicitly as a linear combination of $12$ and $16$:
$$4 = (-1)\times 12 + (1)\times 16$$
So the coefficients are:
$$s = -1, \qquad t = 1$$
Check
$$s\cdot 12 + t\cdot 16 = (-1)(12) + (1)(16) = -12 + 16 = 4 \ \checkmark$$
Result
| Result | Value |
|---|---|
| $\gcd(12, 16)$ | $4$ |
| Linear combination | $(-1)\times 12 + (1)\times 16 = 4$ |
$$\boxed{\gcd(12, 16) = 4 = (-1)\cdot 12 + (1)\cdot 16}$$
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.