GCD Algorithms: Euclid's Subtraction and Āryabhaṭa's Division
Updated 17 October 2026 · Fact-checked
The gcd (greatest common divisor, also called HCF) of two numbers can be found by listing divisors, by Euclid's subtraction method $\gcd(m, n) = \gcd(n, m - n)$, or by the faster division method $\gcd(m, n) = \gcd(n, m \bmod n)$. Each rule works because the common divisors of the old and the new pair are exactly the same. The division version needs very few steps even for big numbers.
Both methods keep the same common divisors and end at gcd 6, but the division method gets there in far fewer steps.
Illustration drawn for QuestionBuddy.
Understand Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division
*Note: this chapter of the textbook series is not listed in CBSE's Class 9 course structure for 2026-27, so check with your school whether it is examined. It develops the idea of an algorithm, which supports CBSE's computational-thinking goal.*
An algorithm is a precise, step-by-step procedure that gives the correct answer for every input of a given kind. For every algorithm we ask two questions: is it correct (does it always give the right answer?) and how much work does it need as the input grows?
GCD from the definition. The gcd of and is the largest number that divides both. A direct algorithm lists the divisors of and of , keeps the common ones and reports the largest. For and : divisors of are ; of : ; common divisors ; so the gcd is . This is clearly correct, but it checks every number up to and , so the work grows with the size of the numbers.
Euclid's subtraction algorithm. *Key fact:* if , then . *Why:* if divides both and it divides (since when and ), and if divides both and it divides their sum . The two pairs have exactly the same common divisors, so they have the same greatest one.
*The steps:* (1) if , swap them; (2) if , the answer is ; (3) otherwise replace by and repeat. For : swap , so the gcd is , in subtractions. It is correct but slow for numbers far apart: needs about subtractions.
Āryabhaṭa's division algorithm. Repeated subtraction of from ends with the remainder , so one division does many subtractions at once: . The steps are the same as Euclid's, except that step (3) uses the remainder. For : ; ; ; so the gcd is in only steps. The number of steps grows with the number of digits of the numbers, not with their size, just as column addition does.
Using the gcd. The lcm follows from : for and , and . Packing problems use the gcd: the largest square tile that exactly covers a floor cm by cm has side cm, giving tiles. For three numbers apply the gcd twice: .
Scanning downwards. Another improvement of the definition-based method checks candidates from down to and stops at the first common divisor: this is already the largest. For it checks , which is numbers, whereas the division method finishes in steps: , , , .
How to present an algorithm answer. Write the input and output, list the numbered steps, run the example in a table (one row per step), state the stopping rule, and give a one-line reason why the rule keeps the gcd unchanged.
Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division: formulas to remember
- Euclid's reduction
- Same common divisors.
- Āryabhaṭa's reduction
- Many subtractions in one division.
- Stopping rule
- When the second number reaches 0.
- Remainder notation
- Example: .
- lcm from gcd
- Product of the two numbers divided by the gcd.
- Three numbers
- Apply the two-number rule twice.
How to solve Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division questions
Choose the algorithm, run it in a table and state the answer.
- 1Write the pair with (swap if needed).
- 2For the definition method, list the divisors of both numbers and pick the largest common one.
- 3For the subtraction method, replace by , swapping when the first number is smaller, until the second number is 0.
- 4For the division method, replace by until the remainder is 0; the last non-zero number is the gcd.
- 5Count the steps and compare methods.
- 6Use the gcd for lcm, equal grouping and tiling problems.
Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division in real life
Each concept, met in an everyday situation. Read the situation, try the problem, then check the solution. The one-line hook is what to remember.
GCD for equal packing
Suppose a craft shop has ribbons of length 84 cm and 126 cm that are to be cut into pieces of the same greatest possible length with nothing left over.
Find the length of each piece and the number of pieces.
Try it first, then show the solutionSolution
- Piece length . , , so the gcd is cm.
- Pieces: .
Answer: Each piece is 42 cm long, and there are 5 pieces.
Memory hook: The greatest equal cut is the gcd.
Tricks to remember Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division
Short memory aids. Say each one aloud once, then use it on a question the same day.
Subtract or divide
Subtraction keeps the gcd; division is many subtractions at once and leaves the remainder.
Use it when: Choosing the algorithm.
Stop at zero
The answer is the last non-zero number before the second entry becomes 0.
Use it when: Reading the final answer.
Product over gcd
Multiply the two numbers and divide by their gcd to get the lcm.
Use it when: lcm questions.
Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division: solved examples
Ordered from board level to HOTS. Try each one before you open the solution.
Example 1: GCD from the definition · 3 marks · Short answerBoard level
Find by listing the divisors of each number.
Try it first, then show the solutionSolution
- Divisors of : . (1)
- Divisors of : . (½)
- Common divisors: ; the greatest is . (1½)
Answer: .
Example 2: Euclid's subtraction method · 3 marks · Short answerBoard level
Use Euclid's subtraction algorithm to find , showing every step, and count the subtractions.
Try it first, then show the solutionSolution
- since ; then , so swap to . (1)
- . (1)
- The second number is 0, so ; there were subtractions: , , and (the swap is not a subtraction). (1)
Answer: .
Example 3: Āryabhaṭa's division method · 5 marks · Long answerHarder board level
Find using the division algorithm, showing each step, and explain why the answer is correct.
Try it first, then show the solutionSolution
- , so . (1)
- , so . (1)
- , so . (1)
- Each step is a block of repeated subtractions, which keeps the common divisors unchanged (a number dividing and divides ). (1)
- Only division steps were needed; subtraction would need many more. (1)
Answer: .
Example 4: gcd and lcm · 3 marks · Short answerHarder board level
Use the division algorithm to find and then the lcm of and .
Try it first, then show the solutionSolution
- ; ; . (1)
- So . (1)
- . (1)
Answer: and .
Example 5: Tiling a floor · 4 marks · Case-basedHOTS / competency
Case: a rectangular floor is 2160 cm long and 1260 cm wide and is to be covered with identical square tiles, as large as possible, with no cutting. (i) Find the side of the tile using the division algorithm and show the steps. (ii) How many tiles are needed? (iii) How many division steps were used? (iv) Why is the division method better than listing the divisors of 2160 and 1260?
Try it first, then show the solutionSolution
- (i) ; ; ; . The tile side is cm. (1½)
- (ii) tiles. (1)
- (iii) Four division steps. (½)
- (iv) Listing divisors means testing over a thousand candidates for each number; the division method needed only four steps. (1)
Answer: (i) 180 cm; (ii) 84 tiles; (iii) 4 steps; (iv) far fewer steps.
Where students lose marks in Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division
The slips examiners see most often, and what to write instead.
Mistake: Stopping at the remainder instead of the divisor
Giving the last remainder (0) as the answer.
Wrong working
.
Right working
The last non-zero value, , is the gcd.
Do this: The answer is the number paired with 0.
Usually costs: The whole answer.
Mistake: Not swapping when the first number is smaller
Subtracting a larger number from a smaller one.
Wrong working
.
Right working
Swap to first.
Do this: Check at every step.
Usually costs: 2 marks.
Mistake: Forgetting to justify correctness
Showing steps but giving no reason.
Wrong working
Only computations.
Right working
Add "the new pair has the same common divisors, so the same gcd".
Do this: Write the reason in one line.
Usually costs: 1 mark.
Exam tips
- Show each step as a pair in a table.
- State the stopping rule: second number .
- Mention why the rule is correct (same common divisors).
- Count steps when asked to compare algorithms.
Practice questions on Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division
Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.
Q1 · 1 mark · MCQBoard level
is
(a) 9
(b) 18
(c) 27
(d) 54Hint
; then .
Answer
(c) 27.
Q2 · 3 marks · Short answerBoard level
Find by the division method and by the subtraction method (swapping when the first number is smaller), and count the steps in each.
Hint
Write each pair in a table.
Answer
Division: ; , so in steps. Subtraction: , so with subtractions.
Q3 · 3 marks · Short answerHarder board level
Show that for , and use it to find .
Hint
Show that the pairs have the same common divisors.
Answer
If divides and , then divides . If divides and , then divides . So both pairs have the same common divisors, hence the same greatest one. ; ; ; . .
Q4 · 5 marks · Long answerHarder board level
A teacher has 84 pencils, 126 erasers and 210 sharpeners. They are packed into identical kits using all items. Find the greatest number of kits and the contents of one kit, using the gcd algorithm.
Hint
Find .
Answer
: ; , so . : , so . The greatest number of kits is . Each kit has pencils, erasers and sharpeners.
Q5 · 4 marks · Case-basedHOTS / competency
Case: to find a student scans the numbers from 625 downwards and stops at the first common divisor of 1000 and 625. (i) What is the gcd? (ii) How many numbers does the student examine? (iii) How many division steps does the division method need? (iv) State which method grows more slowly if the numbers become much larger, and why.
Hint
The first common divisor met while scanning down is the largest.
Answer
(i) (the first number from 625 downwards dividing both). (ii) The numbers : . (iii) ; ; ; : four steps. (iv) The division method: its number of steps grows with the number of digits, while the scan grows with the size of the numbers.
Test your recall
Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.
1.Euclid's reduction?Show answer
.
2.Āryabhaṭa's reduction?Show answer
.
3.gcd(m, 0)?Show answer
.
4.lcm in terms of gcd?Show answer
.
5.What does the division method's work depend on?Show answer
The number of digits of the numbers.
Computing the GCD: Definition, Euclid's Subtraction and Āryabhaṭa's Division: frequently asked questions
Why does the division method always stop?
Because the remainder is smaller than the divisor, so the second number strictly decreases until it reaches 0.
Does the order of m and n matter?
No. If m < n the first step simply swaps them.
Is the gcd the same as the HCF?
Yes, they are two names for the greatest common divisor.