Step by step
The question
Question: find gcd(48, 18) by Euclid's algorithm.
1 Divide the bigger by the smaller
Divide the bigger number by the smaller: 18 goes into 48 2 times, and 12 is left over.
Here is the trick.
A number that goes into 48 and 18 also goes into 12, because 12 is 48 minus 2 × 18.
So the gcd does not change, and the numbers get smaller.
2 Keep going
Now the same with 18 and 12: the divisor moves left, the remainder becomes the new divisor.
12 = 2 × 6, and the remainder is 0.
We stop.
3 The last remainder before 0
Careful!
0 only tells us to stop.
The answer is the last remainder before it: 6.
The last remainder that is not 0 is 6.
So gcd(48, 18) = 6.
4 Check
6 goes into both: 48 ÷ 6 is 8, and 18 ÷ 6 is 3.
And 8 and 3 have no common factor, so nothing bigger than 6 goes into both.
Right!
Let's look back.
First: divide the bigger by the smaller.
Then: keep going.
Then: the last remainder before 0.
Last: check.