Euclid's division algorithm — find HCF step by step with examples

medium CBSE 3 min read

Question

How do we use Euclid’s division algorithm to find the HCF (Highest Common Factor) of two numbers step by step?

Solution — Step by Step

For any two positive integers aa and bb (where a>ba > b), there exist unique integers qq (quotient) and rr (remainder) such that:

a=bq+r,0r<ba = bq + r, \quad 0 \leq r < b

This is the foundation. The algorithm applies this lemma repeatedly.

To find HCF(aa, bb) where a>ba > b:

  1. Apply the division lemma: a=bq1+r1a = bq_1 + r_1
  2. If r1=0r_1 = 0, then HCF = bb. Stop.
  3. If r10r_1 \neq 0, replace aa with bb and bb with r1r_1. Go to step 1.

Repeat until the remainder becomes 0. The last non-zero remainder is the HCF.

Step 1: 455=42×10+35455 = 42 \times 10 + 35 (remainder = 35)

Step 2: 42=35×1+742 = 35 \times 1 + 7 (remainder = 7)

Step 3: 35=7×5+035 = 7 \times 5 + 0 (remainder = 0)

The last non-zero remainder is 7.

HCF(455,42)=7\boxed{\text{HCF}(455, 42) = 7}

Always start with the larger number:

38220=196×195+038220 = 196 \times 195 + 0

The remainder is 0 in the very first step. So:

HCF(38220,196)=196\text{HCF}(38220, 196) = 196

This tells us 196 divides 38220 exactly.

The key insight: HCF(a,b)=HCF(b,r)\text{HCF}(a, b) = \text{HCF}(b, r) where rr is the remainder when aa is divided by bb.

This is because any common factor of aa and bb must also divide r=abqr = a - bq. And any common factor of bb and rr must also divide a=bq+ra = bq + r. So the set of common factors is the same, meaning the HCF is preserved.

flowchart TD
    A["Find HCF of a and b"] --> B["Divide a by b: a = bq + r"]
    B --> C{"Is r = 0?"}
    C -->|"Yes"| D["HCF = b"]
    C -->|"No"| E["Replace: a becomes b, b becomes r"]
    E --> B

Why This Works

Euclid’s algorithm works because it reduces the problem size at each step without changing the answer. The pair (a,b)(a, b) is replaced by (b,r)(b, r) where r<br < b, so the numbers get strictly smaller. Since we are working with positive integers that decrease at each step, the process must terminate — and it terminates when the remainder hits 0.

The algorithm is over 2300 years old and is one of the earliest known algorithms in mathematics. It is computationally very efficient, requiring at most about 5×5 \times the number of digits steps.

Alternative Method

For small numbers, prime factorization is often faster: factorize both numbers, then take the product of common prime factors with the lowest powers. For example, 24=23×324 = 2^3 \times 3 and 36=22×3236 = 2^2 \times 3^2, so HCF =22×3=12= 2^2 \times 3 = 12. But for large numbers, Euclid’s algorithm is far more practical.

Common Mistake

Students sometimes apply the algorithm with a<ba < b (smaller divided by larger). While the algorithm still works (the first step just swaps them, since a=b×0+aa = b \times 0 + a), it wastes one step. Always start with a>ba > b to be efficient. More importantly, when showing work in CBSE exams, starting with a<ba < b confuses the examiner and may cost a step mark.

Want to master this topic?

Read the complete guide with more examples and exam tips.

Go to full topic guide →

Try These Next