Class 9 Mathematics Chapter 11: The World of Algorithms

The World of Algorithms is Chapter 11 of NCERT / CBSE Class 9 Mathematics. This page has the complete chapter notes across 3 topics , 141 practice MCQs with answers and explanations , 42 important short and long questions and 60 flashcards — all written to the NCERT / CBSE syllabus and free to read.

Adding Numbers, Digit by Digit

Adding by counting dots works, and stops being practical almost at once. The column method is the same answer reached a different way: align the digits from the right so place values meet, add each column, and carry a new group of ten to the left. Written out precisely it becomes an algorithm, and the reason it scales is that its work depends on how many digits there are rather than how large the numbers are.

Full explanation

Two ways to add, and only one of them scales

We first learned to add by drawing dots and counting them. For $5+7$ that is reasonable. For $473+695$ it is nearly twelve hundred dots.

The method we actually use

Write the numbers one below the other with the digits aligned from the right, so that units sit under units and tens under tens. Add each column from right to left. When a column reaches ten or more, write the units digit and carry one group of ten into the next column. If a carry is left at the end, it becomes a new leading digit.

Writing it down precisely makes it an algorithm

An algorithm is a step-by-step procedure described precisely enough that no step needs judgement. Our addition method becomes one as soon as we state the five steps, including the easily forgotten last step that writes the final carry.

Why it beats counting

Counting depends on the size of the numbers: each extra digit means ten times as many dots. The algorithm depends on the number of digits: each extra digit means one more column. At one dot per second $3347+2729$ takes over an hour and forty minutes to count, and about a minute to add.

And why it is correct

Each column is one place-value group. Groups can be totalled separately, and a group of ten units is exactly one ten, which is why it can be carried left instead of counted again.

Watch out for these

Practice MCQs with answers (47)

Q1 What is $473 + 695$? beginner
  • A 1168
  • B 1068
  • C 1158
  • D 1178
Show answer
Answer: 1168
Why:

Units $3+5=8$. Tens $7+9=16$, so write 6 and carry 1. Hundreds $4+6+1=11$, so write 1 and carry 1, and the last carry becomes the leading 1.

Q2 Counting dots the way we first learned, what is $5 + 7$? beginner
  • A 11
  • B 12
  • C 13
  • D 57
Show answer
Answer: 12
Why:

Five dots and seven more dots tally to twelve, which is the same answer the column method gives.

Q3 What is $33 + 27$? beginner
  • A 50
  • B 54
  • C 60
  • D 66
Show answer
Answer: 60
Why:

Units $3+7=10$, so write 0 and carry 1. Tens $3+2+1=6$.

Q4 What is $334 + 272$? beginner
  • A 596
  • B 616
  • C 706
  • D 606
Show answer
Answer: 606
Why:

Units $4+2=6$. Tens $3+7=10$, write 0 and carry 1. Hundreds $3+2+1=6$.

Q5 What is $3347 + 2729$? intermediate
  • A 6076
  • B 5076
  • C 6066
  • D 6086
Show answer
Answer: 6076
Why:

Units $7+9=16$, write 6 carry 1. Tens $4+2+1=7$. Hundreds $3+7=10$, write 0 carry 1. Thousands $3+2+1=6$.

Q6 In this algorithm, what is the largest value the carry can ever hold? beginner
  • A 0
  • B 1
  • C 2
  • D 9
Show answer
Answer: 1
Why:

Two single digits total at most $9+9=18$, and at most 19 once an incoming carry is added, so only one new group of ten can ever form.

Q7 Including an incoming carry, what is the largest total one column can reach? intermediate
  • A 18
  • B 20
  • C 19
  • D 81
Show answer
Answer: 19
Why:

The largest column is $9+9$ plus a carry of 1.

Q8 At most how many digits can the sum of two 4-digit numbers have? beginner
  • A 4
  • B 6
  • C 8
  • D 5
Show answer
Answer: 5
Why:

Four columns give four digits, and Step 5 can add one more when the leftmost column overflows.

Q9 How many columns are worked when a 3-digit number is added to a 4-digit one? beginner
  • A 4
  • B 3
  • C 5
  • D 7
Show answer
Answer: 4
Why:

Aligning on the right, the number of columns is set by the longer number.

Q10 What is $999 + 1$? intermediate
  • A 0900
  • B 1000
  • C 1010
  • D 1100
Show answer
Answer: 1000
Why:

Every column overflows in turn, and the final carry supplies the leading 1.

Q11 What is $56 + 55$? beginner
  • A 101
  • B 121
  • C 111
  • D 211
Show answer
Answer: 111
Why:

Units $6+5=11$, write 1 and carry 1. Tens $5+5+1=11$, write 1 and the last carry gives the leading 1.

Q12 What is $4589 + 3439$? intermediate
  • A 7028
  • B 8018
  • C 8038
  • D 8028
Show answer
Answer: 8028
Why:

Units $9+9=18$ writes 8 carry 1; tens $8+3+1=12$ writes 2 carry 1; hundreds $5+4+1=10$ writes 0 carry 1; thousands $4+3+1=8$.

Q13 What is $195 + 105$? beginner
  • A 300
  • B 200
  • C 310
  • D 390
Show answer
Answer: 300
Why:

Units $5+5=10$ writes 0 carry 1; tens $9+0+1=10$ writes 0 carry 1; hundreds $1+1+1=3$.

Q14 How many more columns does adding two 5-digit numbers need than two 3-digit ones? intermediate
  • A 1
  • B 2
  • C 3
  • D 4
Show answer
Answer: 2
Why:

Two extra digits mean exactly two extra columns, however large the numbers are.

Q15 With no carry coming in, what is the largest total two single digits can reach? beginner
  • A 17
  • B 19
  • C 18
  • D 81
Show answer
Answer: 18
Why:

The largest single digits are 9 and 9.

Q16 What is the largest sum of two 4-digit numbers that still needs no fifth digit? advanced
  • A 9998
  • B 8999
  • C 9989
  • D 9999
Show answer
Answer: 9999
Why:

No column may overflow at the left, so the total must stop one short of ten thousand.

Q17 What is $9999 + 1$? advanced
  • A 10000
  • B 09999
  • C 10001
  • D 11000
Show answer
Answer: 10000
Why:

All four columns overflow and Step 5 writes the fifth digit.

Q18 In $473 + 695$, what is the total of the tens column? beginner
  • A 15
  • B 16
  • C 17
  • D 61
Show answer
Answer: 16
Why:

The tens digits are 7 and 9, and no carry has reached them yet.

Q19 What is $47 + 95$? beginner
  • A 132
  • B 152
  • C 142
  • D 242
Show answer
Answer: 142
Why:

Units $7+5=12$ writes 2 carry 1; tens $4+9+1=14$ writes 4 and the carry gives the leading 1.

Q20 Aligning the decimal points, what is $2.5 + 1.75$? advanced
  • A 3.25
  • B 4.15
  • C 5.25
  • D 4.25
Show answer
Answer: 4.25
Why:

Written as $2.50 + 1.75$ the places line up: hundredths $0+5=5$, tenths $5+7=12$ writes 2 carry 1, units $2+1+1=4$.

Q21 How many columns does adding two 6-digit numbers need? beginner
  • A 6
  • B 5
  • C 7
  • D 9
Show answer
Answer: 6
Why:

One column per place value, with a possible seventh digit from the final carry.

Q22 What is an algorithm? beginner
  • A A number set out in the Indian place-value system
  • B A step-by-step procedure that arrives at an answer
  • C A shortcut that works for some numbers but not others
  • D A guess that is checked afterwards by counting
Show answer
Answer: A step-by-step procedure that arrives at an answer
Why:

An algorithm is a precisely described sequence of steps, which is why it can be followed without judgement at each stage.

Q23 Why must the two numbers be aligned from the right? beginner
  • A So that the longer of the two numbers is always written on top
  • B So that each carry sits above the right digit
  • C So that digits of the same place value meet in one column
  • D So that the answer has the same number of digits
Show answer
Answer: So that digits of the same place value meet in one column
Why:

Units must meet units and tens meet tens, because the method adds each place-value group separately.

Q24 What goes wrong if Step 5 is left out? intermediate
  • A Nothing at all would change, because the final carry is always zero
  • B The answer would gain an extra digit that it should never have had
  • C Only sums of one-digit numbers would fail
  • D The final carry would be lost and large sums would come out short
Show answer
Answer: The final carry would be lost and large sums would come out short
Why:

Without the last step, $473+695$ would read 168 instead of 1168 whenever the leftmost column overflows.

Q25 What does this algorithm assume we can already do? intermediate
  • A That we can add two single digits without counting them out
  • B That both of the numbers being added have the same number of digits
  • C That the two numbers have been written down in ascending order first
  • D That no column total in the whole sum ever reaches as much as ten
Show answer
Answer: That we can add two single digits without counting them out
Why:

Every algorithm rests on basic steps taken as given; here it is single-digit addition.

Q26 Why does adding column by column give the correct total? advanced
  • A Repeated counting of the dots, only arranged into neat columns
  • B Grouping into units, tens and hundreds and adding each group
  • C The fact that addition can be done in any order
  • D A rule that holds only in the Indian number system
Show answer
Answer: Grouping into units, tens and hundreds and adding each group
Why:

Each column is one place-value group, and a group of ten units is carried into the tens group.

Q27 Going from 3-digit to 4-digit numbers, what happens to the work? intermediate
  • A Ten times as many dots and ten times as many columns
  • B The same number of dots and one more column
  • C Ten times as many dots but only one more column
  • D One more dot and one more column
Show answer
Answer: Ten times as many dots but only one more column
Why:

Counting grows with the size of the number; the column method grows with the number of digits.

Q28 Why can the carry never be more than 1? intermediate
  • A Because the digits of the two numbers were not aligned on the right
  • B Because single-digit sums are assumed to be known without counting
  • C Because the leftmost column is added last
  • D Because a column total of ten or more forms one new group of ten
Show answer
Answer: Because a column total of ten or more forms one new group of ten
Why:

Ten units make exactly one ten, so at most one group is ever carried.

Q29 At one dot per second, how long would counting out $3347 + 2729$ take? intermediate
  • A About one hour and forty minutes
  • B Rather less than ten minutes of steady counting
  • C A little under one minute of careful column work
  • D About half a minute, counting one dot each second
Show answer
Answer: About one hour and forty minutes
Why:

The two numbers together are over six thousand dots, and six thousand seconds is about an hour and three quarters.

Q30 At fifteen seconds a column, how long does $3347 + 2729$ take by the algorithm? intermediate
  • A About forty-five seconds
  • B About one minute
  • C About ten minutes
  • D About one hour and forty minutes
Show answer
Answer: About one minute
Why:

Four columns at fifteen seconds each is about a minute, however large the digits are.

Q31 What does the work of the column method really depend on? advanced
  • A The sheer size of the numbers, and not how many digits they have
  • B The number of carries that happen to occur
  • C The number of digits, not the size of the numbers
  • D Whether the numbers are odd or even
Show answer
Answer: The number of digits, not the size of the numbers
Why:

Adding one more column is one more step, which is why the method scales so much better than counting.

Q32 Do the written steps handle a 5-digit number added to a 3-digit one? intermediate
  • A No, the steps as written only work for two numbers of equal length
  • B No, because a carry cannot cross from the third column to the fourth
  • C Yes, but only when the shorter of the two numbers is written on top
  • D Yes, because the shorter number simply has no digit in the high columns
Show answer
Answer: Yes, because the shorter number simply has no digit in the high columns
Why:

Aligning on the right leaves the high columns with a single digit, which is added to the carry alone.

Q33 How would you modify the algorithm to add two decimal fractions? advanced
  • A Write each number with its decimal points aligned
  • B Remove the decimal points and add as whole numbers
  • C Add the whole parts first and the fractions afterwards
  • D Multiply both numbers by ten before adding
Show answer
Answer: Write each number with its decimal points aligned
Why:

Alignment by place value is what the right-to-left rule really means, and the decimal point marks where the places turn.

Q34 What makes a description of a procedure a usable algorithm? intermediate
  • A A description short enough to memorise quickly
  • B A precise description that needs no judgement at any step
  • C A description that works for the largest numbers first
  • D A description written in symbols rather than words
Show answer
Answer: A precise description that needs no judgement at any step
Why:

Precision is what lets a procedure be followed mechanically and still give the right answer.

Q35 A column total comes to less than ten. What does the algorithm say? beginner
  • A Set the carry to 1 and write only the units digit below it
  • B Move left without writing anything in that column
  • C Set the carry to 0 and write the total below the column
  • D Add the two digits again, including the carry
Show answer
Answer: Set the carry to 0 and write the total below the column
Why:

A column total under ten forms no new group of ten, so nothing is carried.

Q36 A column total comes to ten or more. What does the algorithm say? beginner
  • A Write the whole of the total below and set the carry to 0
  • B Write the tens digit of the total below and set the carry to 0
  • C Write nothing and carry the whole total left
  • D Write the units digit below and set the carry to 1
Show answer
Answer: Write the units digit below and set the carry to 1
Why:

The ten in the total becomes one group in the next place up.

Q37 What does Step 4 of the algorithm tell you to do? beginner
  • A Repeat the column step until no digits remain on the left
  • B Repeat the column step exactly three more times and then stop there
  • C Stop as soon as a carry of 0 appears in any one of the columns
  • D Return to the units column and check the whole sum through again
Show answer
Answer: Repeat the column step until no digits remain on the left
Why:

The procedure ends when the columns run out, not after a fixed count.

Q38 What is both the strength and the risk of an algorithm? advanced
  • A It gives an approximate answer extremely quickly
  • B It can be followed without understanding why it works
  • C It needs fewer basic steps than counting dots
  • D It works only for numbers under one thousand
Show answer
Answer: It can be followed without understanding why it works
Why:

Correctness is argued once, and after that the steps can be trusted without re-deriving them.

Q39 How do counting dots and the column method compare? intermediate
  • A Counting is the more reliable of the two for large numbers
  • B The column method needs three-digit numbers
  • C Both give the same answer, but one is far faster
  • D They can disagree when a carry is involved
Show answer
Answer: Both give the same answer, but one is far faster
Why:

Counting defines what addition means; the column method is a faster route to the same total.

Q40 Going from 3-digit to 5-digit numbers, what happens to the work? advanced
  • A One hundred times as many dots, and two more rows
  • B Twice as many dots and two more columns
  • C The same dots arranged in two more columns
  • D One hundred times as many dots but only two more columns
Show answer
Answer: One hundred times as many dots but only two more columns
Why:

Two extra digits multiply the dots by a hundred and add two column steps.

Q41 Why are the columns worked from right to left? advanced
  • A Because the carry always moves towards higher place values
  • B Because the leftmost digits of the two numbers are the largest ones
  • C Because the units column never has a carry coming into it at all
  • D Because the answer is read from left to right
Show answer
Answer: Because the carry always moves towards higher place values
Why:

A new group of ten belongs one place to the left, so the work has to travel in that direction.

Q42 If Step 5 is omitted, what kind of procedure is left? advanced
  • A The steps would simply never finish at all, ever
  • B The steps would still finish, but the answer could be wrong
  • C The steps would finish and always be right
  • D The steps could not be started
Show answer
Answer: The steps would still finish, but the answer could be wrong
Why:

It still terminates, which is why the fault is easy to miss; it is simply incorrect whenever the last column overflows.

Q43 Without Step 5, when is the answer still right? advanced
  • A Only when both numbers are the same length exactly
  • B Only when no column total reaches ten
  • C Only when the leftmost column total is under ten
  • D Only when the numbers are both even
Show answer
Answer: Only when the leftmost column total is under ten
Why:

If the final column does not overflow there is no last carry to write, so the missing step costs nothing.

Q44 Assertion (A): In this algorithm the carry is never more than 1. Reason (R): Two single digits and an incoming carry total at most $9+9+1=19$. beginner
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: Both A and R are true, and R is the correct explanation of A
Why:

Both are true, and R is exactly why A holds: 19 is one ten and nine units, so at most one new group of ten can form.

Q45 Assertion (A): The two numbers are written with their digits aligned from the right. Reason (R): The rightmost column of a whole number holds its units. intermediate
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: Both A and R are true, but R is not the correct explanation of A
Why:

Both are true, but R is not the reason. We align from the right so that digits of the SAME place value share a column; that the rightmost column holds units is a fact about place value, not the justification.

Q46 Assertion (A): Adding two 4-digit numbers can produce a 5-digit answer. Reason (R): The carry out of a column can be 2 when both digits are 9. intermediate
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: A is true but R is false
Why:

A is true: the final carry supplies a fifth digit. R is false, because $9+9+1=19$ gives a carry of 1 and never 2.

Q47 Assertion (A): Leaving out Step 5 stops the algorithm from finishing. Reason (R): Step 5 writes the final carry to the left of the bottom row. advanced
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: A is false but R is true
Why:

A is false: without Step 5 the steps still terminate normally and simply give a wrong answer whenever the last column overflows. R correctly describes what Step 5 does.

Important short questions (10)

State what an algorithm is, and give one example from this topic.

An algorithm is a precise step-by-step procedure that arrives at an answer, described so that each step can be followed without judgement. The column method for adding two numbers is an example.

Why must the two numbers be written with their digits aligned from the right?

So that digits of the same place value fall in the same column. The method adds units to units and tens to tens, so a right alignment is what makes each column one place-value group.

Explain why the carry can never be larger than 1.

The largest total a column can reach is $9+9+1=19$. That forms exactly one new group of ten, so only 1 is ever carried.

What goes wrong if Step 5 is omitted? Give an example where the answer is still correct and one where it is not.

Without Step 5 the final carry is never written, so the answer loses its leading digit whenever the leftmost column overflows. $473+695$ would read 168 instead of 1168. If the leftmost column totals less than ten, as in $123+45$, there is no final carry and the answer is unaffected.

Compare the work of counting dots with the work of the column method as the numbers get longer.

Counting grows with the size of the number: one more digit means ten times as many dots. The column method grows with the number of digits: one more digit means one more column. Going from 3-digit to 5-digit numbers is a hundred times the dots but only two extra columns.

The algorithm assumes something it does not explain. What is it, and why is that acceptable?

It assumes we can add two single digits without counting them out. That is acceptable because every algorithm is built from basic steps taken as given; without some such step the description would never end.

Does the algorithm as written handle a 5-digit number added to a 3-digit number? Justify your answer.

Yes. Aligned on the right, the two highest columns contain a digit from the longer number only. Step 3 adds that digit to the incoming carry, which the steps already allow, so nothing has to change.

Justify why adding each column separately gives the sum of the two whole numbers.

Each number is a sum of place-value groups: units, tens, hundreds and so on. Addition can be regrouped, so the totals of corresponding groups can be added separately. Whenever a group of units reaches ten it forms one new ten, which is carried into the tens group. Doing this column by column therefore produces the same total as combining and counting everything at once.

How would you modify the algorithm to add two decimal fractions? Explain why your change is the same rule as before.

Write the numbers with their decimal points aligned rather than their right-hand edges, padding with zeros so both have the same number of decimal places. This is the same rule, because aligning on the right was only ever a way of making place values meet, and the decimal point is where the place values turn from units to tenths.

A student says the algorithm proves that addition works. Explain why that is the wrong way round.

Addition is defined by combining and counting. The algorithm is a faster procedure that is claimed to give the same answer, so it is the algorithm that needs justifying against the definition, not the other way round. That justification is the grouping argument.

Long answer questions (4)

Write out the addition algorithm in your own words as five numbered steps, then use it to work $4589 + 3439$, showing each carry.

Steps. 1 Write the numbers one below the other with digits aligned from the right. 2 Add the units, writing the total if it is under ten and setting the carry to 0, or writing the units digit and setting the carry to 1 if it is ten or more. 3 Move one column left and add the two digits and the carry, applying the same rule. 4 Repeat until no digits remain. 5 If the carry is 1 at the end, write it to the left.

Working: units $9+9=18$, write 8 carry 1; tens $8+3+1=12$, write 2 carry 1; hundreds $5+4+1=10$, write 0 carry 1; thousands $4+3+1=8$, write 8 carry 0. No final carry, so the answer is 8028.

Explain, with the figures from this topic, why the column method scales so much better than counting dots.

Counting is driven by the size of the number. Each extra digit multiplies the quantity of dots by ten, so 3-digit numbers give ten times the dots of 2-digit ones and 5-digit numbers a hundred times the dots of 3-digit ones. The column method is driven by the number of digits: each extra digit adds exactly one column. Concretely, one dot a second makes $33+27$ a minute's work, $334+272$ ten times that, and $3347+2729$ a little over a hundred minutes. At fifteen seconds a column the same three sums take about half a minute, about forty-five seconds and about one minute.

A student follows Steps 1 to 4 correctly but always forgets Step 5. Describe exactly which sums they will get right, which they will get wrong, and why the mistake is hard to notice.

They will be right whenever the leftmost column totals less than ten, because then the carry is 0 at the end and there is nothing for Step 5 to write. $123+45$ or $412+376$ are unaffected. They will be wrong whenever the leftmost column reaches ten or more, losing the leading digit: $473+695$ gives 168 rather than 1168, and $56+55$ gives 11 rather than 111. The mistake is hard to notice because the procedure still terminates normally and produces a plausible-looking number; nothing about the steps signals that anything was dropped.

Justify the addition algorithm from the definition of addition, then state what the algorithm assumes.

Addition is defined by combining two collections and counting the result. Any whole number can be written as a sum of place-value groups, so $473$ is four hundreds, seven tens and three units. Combining two numbers therefore combines their groups, and since the order of addition does not matter, corresponding groups can be totalled separately. When a group reaches ten it is exactly one group of the next size, which is why it can be carried one place left rather than counted again. Working column by column from the right performs precisely this grouping, so it yields the same total as counting everything. The algorithm assumes two basic steps: that single digits can be added without counting, and that numbers are written in the base-ten place-value system.

Flashcards (20)

What is an algorithm?
A precise step-by-step procedure that reaches an answer, described so that no judgement is needed at any step.
Why are the numbers aligned from the right?
So that digits of the same place value meet in one column: units under units, tens under tens.
What is a carry?
A new group of ten formed in one column and moved one place to the left.
What values can the carry take?
Only 0 or 1, because a column reaches at most $9+9+1=19$.
What does Step 5 do?
It writes the final carry to the left of the bottom row, which is where the extra leading digit comes from.
What happens if Step 5 is left out?
The steps still finish, but the answer loses its leading digit whenever the last column overflows. $473+695$ would read 168.
What basic step does this algorithm assume?
That we can add two single digits without counting them out.
Why does adding column by column give the right total?
Each column is one place-value group. Adding groups separately and carrying each new ten left gives the same total as counting.
Going from 3-digit to 4-digit numbers, what changes?
Ten times as many dots to count, but only one more column to add.
Going from 3-digit to 5-digit numbers, what changes?
One hundred times as many dots, but only two more columns.
At one dot per second, how long is $3347+2729$ by counting?
About one hour and forty minutes, because the two numbers are over six thousand dots.
At fifteen seconds a column, how long is $3347+2729$ by the algorithm?
About one minute, since there are only four columns.
What does the work of the algorithm really depend on?
The number of digits, not the size of the numbers.
Does the algorithm handle a 5-digit plus a 3-digit number?
Yes. Aligned on the right, the two high columns hold one digit each, added to the carry alone.
How do you adapt the algorithm to decimals?
Align the decimal points rather than the right-hand edge; the point marks where the place values turn.
What is $473+695$, and where does each digit come from?
1168. Units $3+5=8$; tens $7+9=16$ writes 6 carry 1; hundreds $4+6+1=11$ writes 1 carry 1; Step 5 writes the leading 1.
Why is the work done right to left?
Because a carry always belongs one place to the left, so the work has to travel in that direction.
What is both the strength and the risk of an algorithm?
It can be followed without understanding why it works: correctness is argued once, then the steps are trusted.
At most how many digits can the sum of two 4-digit numbers have?
Five. Four columns give four digits and Step 5 can add one more.
Do counting and the column method ever disagree?
No. Counting defines what addition means; the column method is a faster route to the same total.

Play this topic

  • Match each piece to what it does
  • True or false about the algorithm
  • Complete the statement
  • Unscramble the vocabulary

The Greatest Common Divisor, from the Definition

The gcd of two numbers -- the same thing as their hcf -- can be found without prime factorisation at all, by working straight from the definition. List every divisor of each number, keep the ones that appear in both lists, and report the largest. Writing that down precisely needs two algorithms, one of which reuses the other, and the lists come out in increasing order for free so the answer is simply the last entry. It is plainly correct and, for large numbers, plainly slow.

Full explanation

A familiar answer, found a different way

The greatest common divisor of two numbers is the same number as their highest common factor. We have found it before using prime factorisation. Here we find it from the definition instead, which means saying exactly what a common divisor is and then looking for the greatest one.

Break the problem into pieces you can already do

We need the divisors of both numbers, and then the largest value present in both collections. Each piece is something we know how to do, which is what makes the problem tractable.

Listing the divisors of a number

Start with an empty list. Test every $j$ from 1 to $n$, and whenever $j$ divides $n$, add it to the end of the list. For $n = 18$ this gives $[1, 2, 3, 6, 9, 18]$. Notice the list comes out in increasing order, because the candidates were tried in increasing order.

Comparing the two lists

For 375 and 825 the lists are short enough to inspect, and the answer is 75. For 54000 and 81000 each list holds eighty entries and inspection stops being reliable, so the comparison becomes a step of its own: start an empty common-divisor list and keep every entry of the first list that also appears in the second.

Reading off the answer

Both lists increase, so the common list increases too, and the greatest common divisor is simply its rightmost entry. The list is never empty, because 1 divides every number.

Correct, and slow

This method is obviously right, since it follows the definition exactly. It is also expensive: finding the six divisors of 775 takes 775 divisibility tests, and $\gcd(54000, 81000)$ needs 81000 of them to produce 27000.

Watch out for these

Practice MCQs with answers (47)

Q1 What is $\gcd(375, 825)$? beginner
  • A 75
  • B 25
  • C 15
  • D 55
Show answer
Answer: 75
Why:

The common divisors are $[1, 3, 5, 15, 25, 75]$ and the greatest of them is 75.

Q2 How many divisors does 18 have? beginner
  • A 4
  • B 6
  • C 5
  • D 9
Show answer
Answer: 6
Why:

They are $[1, 2, 3, 6, 9, 18]$.

Q3 How many divisors does 15 have? beginner
  • A 3
  • B 5
  • C 4
  • D 8
Show answer
Answer: 4
Why:

They are $[1, 3, 5, 15]$.

Q4 How many divisors does 135 have? intermediate
  • A 6
  • B 7
  • C 9
  • D 8
Show answer
Answer: 8
Why:

They are $[1, 3, 5, 9, 15, 27, 45, 135]$.

Q5 How many divisors does 775 have? intermediate
  • A 6
  • B 4
  • C 5
  • D 8
Show answer
Answer: 6
Why:

They are $[1, 5, 25, 31, 155, 775]$, since $775 = 5^2 \times 31$.

Q6 How many divisors does 375 have? intermediate
  • A 6
  • B 8
  • C 7
  • D 9
Show answer
Answer: 8
Why:

They are $[1, 3, 5, 15, 25, 75, 125, 375]$.

Q7 How many divisors does 825 have? intermediate
  • A 10
  • B 11
  • C 12
  • D 14
Show answer
Answer: 12
Why:

They are $[1, 3, 5, 11, 15, 25, 33, 55, 75, 165, 275, 825]$.

Q8 How many common divisors do 375 and 825 have? intermediate
  • A 4
  • B 5
  • C 8
  • D 6
Show answer
Answer: 6
Why:

The common list is $[1, 3, 5, 15, 25, 75]$.

Q9 What is the third divisor in the list for 18? beginner
  • A 3
  • B 2
  • C 6
  • D 9
Show answer
Answer: 3
Why:

The list $[1, 2, 3, 6, 9, 18]$ is built in increasing order, so the third entry is 3.

Q10 What is the rightmost entry of the common-divisor list for 375 and 825? beginner
  • A 25
  • B 75
  • C 15
  • D 55
Show answer
Answer: 75
Why:

The list is in increasing order, so its rightmost entry is the greatest common divisor.

Q11 Which divisor of 375 is NOT a divisor of 825? intermediate
  • A 105
  • B 165
  • C 125
  • D 275
Show answer
Answer: 125
Why:

Only 125 and 375 fail; the other six divisors of 375 appear in 825's list too.

Q12 What is $\gcd(54000, 81000)$? advanced
  • A 13500
  • B 18000
  • C 40500
  • D 27000
Show answer
Answer: 27000
Why:

It is the rightmost entry of their common-divisor list.

Q13 How many divisors does 54000 have? advanced
  • A 80
  • B 64
  • C 72
  • D 81
Show answer
Answer: 80
Why:

Checking every $j$ from 1 to 54000 finds 80 of them.

Q14 How many divisors do 54000 and 81000 have in common? advanced
  • A 60
  • B 64
  • C 72
  • D 80
Show answer
Answer: 64
Why:

Their common-divisor list has 64 entries, ending at 27000.

Q15 How many numbers does the divisors algorithm test for $n = 18$? beginner
  • A 6
  • B 9
  • C 18
  • D 17
Show answer
Answer: 18
Why:

It tests every $j$ in $1, 2, \ldots, n$, whether or not $j$ divides $n$.

Q16 How many numbers does the divisors algorithm test for $n = 375$? intermediate
  • A 125
  • B 187
  • C 374
  • D 375
Show answer
Answer: 375
Why:

Every $j$ from 1 to $n$ is tested, so the work grows with $n$ itself.

Q17 At the start of the algorithm, how many entries are in list-of-divisors? beginner
  • A 0
  • B 1
  • C 2
  • D 9
Show answer
Answer: 0
Why:

It starts empty, and entries are appended as divisors are found.

Q18 How many entries does any common-divisor list have at minimum? beginner
  • A 0
  • B 1
  • C 2
  • D 3
Show answer
Answer: 1
Why:

1 divides every number, so it is always common.

Q19 What is the smallest divisor of 775 above 1? intermediate
  • A 3
  • B 7
  • C 5
  • D 31
Show answer
Answer: 5
Why:

$775 = 5^2 \times 31$, so 3 and 7 do not divide it and 5 comes first.

Q20 What is the second-largest divisor of 135? intermediate
  • A 27
  • B 15
  • C 90
  • D 45
Show answer
Answer: 45
Why:

The list is $[1, 3, 5, 9, 15, 27, 45, 135]$, so 45 sits just below 135.

Q21 What is $\gcd(375, 375)$? beginner
  • A 375
  • B 125
  • C 175
  • D 275
Show answer
Answer: 375
Why:

Every number is its own greatest divisor, so the gcd of a number with itself is the number.

Q22 What does the gcd algorithm report as its answer? beginner
  • A The leftmost entry of the common-divisor list
  • B The rightmost entry of the common-divisor list
  • C The longest of the two divisor lists
  • D The first divisor found in both lists
Show answer
Answer: The rightmost entry of the common-divisor list
Why:

The lists are built in increasing order, so the greatest common divisor is the last entry.

Q23 Why is the list of divisors always in increasing order? intermediate
  • A Because the list is sorted once it is complete
  • B Because divisors always come in pairs
  • C Because the numbers are tested in order from 1 upwards
  • D Because the smallest divisor is always 1
Show answer
Answer: Because the numbers are tested in order from 1 upwards
Why:

Appending each divisor as it is found, while testing $j$ from 1 to $n$, produces an increasing list without any sorting step.

Q24 What basic step does the divisors algorithm assume? intermediate
  • A That we can list the prime factors of any number
  • B That we can sort a list of numbers
  • C That we already know the gcd
  • D That we can tell when a smaller number divides a larger one
Show answer
Answer: That we can tell when a smaller number divides a larger one
Why:

Division testing is the step taken as given; everything else is built from it.

Q25 Why must the common-divisor list have at least one entry? beginner
  • A Because 1 divides every number
  • B Because every number has at least two divisors of its own
  • C Because the numbers may be equal
  • D Because the list starts with 1 by definition
Show answer
Answer: Because 1 divides every number
Why:

1 is a divisor of everything, so it is common to any pair.

Q26 What does it mean to execute an algorithm? beginner
  • A To prove that the algorithm gives the right answer every time
  • B To run through its steps one at a time
  • C To write the algorithm down precisely
  • D To find a faster algorithm for the same job
Show answer
Answer: To run through its steps one at a time
Why:

Executing is carrying the steps out; justifying is a separate matter.

Q27 Why does the algorithm give names like list-of-divisors and $j$? intermediate
  • A So that the algorithm can be translated into any programming language
  • B So that the reader knows which number is larger
  • C So that each step can refer to a value unambiguously
  • D So that the list stays in increasing order
Show answer
Answer: So that each step can refer to a value unambiguously
Why:

Without names, describing what to do each time a divisor is found becomes clumsy and imprecise.

Q28 Why is inspecting the two lists by eye not good enough for 54000 and 81000? intermediate
  • A The lists are not produced in any particular useful order at all
  • B The two lists turn out to have nothing at all in common
  • C Because 1 divides them both
  • D Each list has 80 entries
Show answer
Answer: Each list has 80 entries
Why:

At 80 entries each, picking the largest shared value by eye is unreliable, which is why the comparison is made a step of its own.

Q29 What is the second step of the overall gcd procedure? beginner
  • A Compare the two lists for shared entries
  • B Sort both of the divisor lists into increasing order first
  • C Factorise both of the numbers into their prime factors
  • D Report the rightmost entry
Show answer
Answer: Compare the two lists for shared entries
Why:

First the divisors of each number are listed, then the lists are compared, and only then is the answer read off.

Q30 How does the work of the divisors algorithm grow as $n$ grows? advanced
  • A In step with the number of divisors that $n$ happens to have
  • B In step with $n$ itself
  • C In step with the number of digits that $n$ is written with
  • D It does not grow
Show answer
Answer: In step with $n$ itself
Why:

Every $j$ from 1 to $n$ is tested, so doubling $n$ doubles the testing, however few divisors are found.

Q31 What is gcd another name for? beginner
  • A A prime factor
  • B The l.c.m.
  • C The hcf
  • D The mean
Show answer
Answer: The hcf
Why:

Greatest common divisor and highest common factor are the same thing.

Q32 Which number is in every divisor list? beginner
  • A The smallest prime factor
  • B Any prime
  • C Zero
  • D 1
Show answer
Answer: 1
Why:

1 divides every number. ($n$ is also always in its own list, but the question asks for the number common to all of them.)

Q33 When is a divisor added to the list? intermediate
  • A As soon as it is found
  • B Only after a duplicate check
  • C After the range is tested
  • D Only if it divides both
Show answer
Answer: As soon as it is found
Why:

Appending on discovery is what keeps the list in increasing order.

Q34 Why can the gcd be read off without searching the common list? intermediate
  • A Because the list is sorted before reading
  • B Because that list is itself in increasing order
  • C Because the gcd is always the first entry
  • D Because there is only one common divisor
Show answer
Answer: Because that list is itself in increasing order
Why:

Both divisor lists are increasing, so the common list is too, and its last entry is the largest.

Q35 What goes wrong if the divisors algorithm starts with the list $[1]$ instead of empty? advanced
  • A The list would then no longer be in increasing order at all
  • B The gcd reported at the end would always be 1
  • C Nothing, because 1 divides every number
  • D The list would hold 1 twice
Show answer
Answer: Nothing, because 1 divides every number
Why:

1 is appended on the first test anyway, so pre-seeding it would only duplicate the entry; starting empty keeps the rule uniform.

Q36 Which two divisors of 375 are missing from the list for 825? intermediate
  • A 25 and 75, because they are not factors of 825 at all
  • B 5 and 15, because 825 is not divisible by either of them
  • C 3 and 11
  • D 125 and 375
Show answer
Answer: 125 and 375
Why:

The other six divisors of 375 all appear in 825's list, which is why the common list runs $[1, 3, 5, 15, 25, 75]$.

Q37 What does the first algorithm for gcd reuse? beginner
  • A The divisors algorithm
  • B The prime factorisation method taught in earlier classes
  • C A sorting step on lists
  • D The addition algorithm from the previous topic
Show answer
Answer: The divisors algorithm
Why:

Steps 1 and 2 are each a call to the divisors algorithm.

Q38 Why is breaking the problem into smaller pieces the first step? intermediate
  • A Because the pieces can be done in any order
  • B Because each piece is something we already know how to do
  • C Because it makes the algorithm shorter
  • D Because the gcd is hard to define
Show answer
Answer: Because each piece is something we already know how to do
Why:

Listing divisors and comparing lists are both familiar jobs; the gcd becomes easy once it is expressed in terms of them.

Q39 If $m$ divides $n$, what is $\gcd(m, n)$? advanced
  • A $n$, since it is the larger of the two numbers given
  • B $1$, since that is in every common-divisor list
  • C $m$
  • D $mn$
Show answer
Answer: $m$
Why:

Every divisor of $m$ divides $n$ too, so the common list is just the divisors of $m$ and its last entry is $m$.

Q40 Why does the algorithm test $j$ right up to $n$? advanced
  • A Because divisors above $n/2$ are the ones most easily missed
  • B Because the list must be built in order
  • C Because 1 must be tested first
  • D Because $n$ is a divisor of itself
Show answer
Answer: Because $n$ is a divisor of itself
Why:

Stopping earlier would leave $n$ out of its own divisor list, and $n$ is needed for cases like $\gcd(375, 375)$.

Q41 What is the list of common divisors for two numbers with no shared factor above 1? intermediate
  • A Just $[1]$
  • B The smaller number's divisors
  • C Both lists joined
  • D Empty, nothing
Show answer
Answer: Just $[1]$
Why:

1 is always common, so the list is never empty and the gcd is 1.

Q42 What makes the gcd procedure an algorithm rather than a method? intermediate
  • A It uses lists rather than prime factors
  • B Every step is described precisely enough to follow
  • C It works for any two numbers
  • D It reuses an earlier algorithm
Show answer
Answer: Every step is described precisely enough to follow
Why:

Precision is the test: the five steps leave nothing to judgement.

Q43 Why is the gcd of two numbers never larger than the smaller of them? advanced
  • A Because the common-divisor list is always shorter than both lists
  • B Because the lists are built in increasing order
  • C Because a divisor cannot exceed the number it divides
  • D Because 1 is always a common divisor
Show answer
Answer: Because a divisor cannot exceed the number it divides
Why:

Every entry of the common list divides the smaller number, so none of them can be bigger than it.

Q44 Assertion (A): The list of common divisors of two numbers is never empty. Reason (R): 1 divides every number. beginner
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: Both A and R are true, and R is the correct explanation of A
Why:

Both are true, and R is why: 1 is a divisor of both numbers whatever they are, so it is always in the common list and the gcd is at least 1.

Q45 Assertion (A): The list of divisors comes out in increasing order. Reason (R): The divisors of a number include 1 and the number itself. intermediate
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: Both A and R are true, but R is not the correct explanation of A
Why:

Both are true, but R is not the reason. The order comes from testing $j$ from 1 upwards and appending each divisor as it is found.

Q46 Assertion (A): Finding the divisors of 775 takes 775 divisibility tests. Reason (R): 775 has 775 divisors. intermediate
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: A is true but R is false
Why:

A is true, since every $j$ from 1 to $n$ is tested. R is false: 775 has only six divisors, $[1, 5, 25, 31, 155, 775]$.

Q47 Assertion (A): The gcd is the leftmost entry of the common-divisor list. Reason (R): The common-divisor list is in increasing order. beginner
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: A is false but R is true
Why:

A is false: the leftmost entry is always 1. R is true, and it is why the RIGHTMOST entry is the one to report.

Important short questions (10)

Write down the divisors of 18 in the order the algorithm finds them, and say why they come out in that order.

$[1, 2, 3, 6, 9, 18]$. The algorithm tests $j$ from 1 upwards and appends each divisor as it is found, so the list is increasing without any sorting step.

Why is the common-divisor list of any two numbers never empty?

Because 1 divides every number, so 1 is a common divisor of any pair. The gcd is therefore at least 1.

State what the last step of the gcd algorithm does and why it is enough.

It reports the rightmost entry of the common-divisor list. That is enough because both divisor lists were built in increasing order, so the common list increases too and its last entry is the greatest.

Use the algorithm to find $\gcd(375, 825)$, showing the lists you build.

divisors(375) is $[1, 3, 5, 15, 25, 75, 125, 375]$ and divisors(825) is $[1, 3, 5, 11, 15, 25, 33, 55, 75, 165, 275, 825]$. Checking each entry of the first against the second keeps $[1, 3, 5, 15, 25, 75]$, since 125 and 375 are missing from the second list. The rightmost entry is 75, so $\gcd(375, 825) = 75$.

Finding the divisors of 775 gives only six numbers. How many tests does the algorithm make, and what does that tell you about its cost?

It makes 775 tests, one for each $j$ from 1 to 775, and finds $[1, 5, 25, 31, 155, 775]$. The cost therefore depends on the size of the number rather than on how many divisors it turns out to have.

Why does the algorithm test $j$ all the way up to $n$ instead of stopping halfway?

Because $n$ divides itself and belongs in its own divisor list. Stopping early would leave it out, and it is needed for cases such as $\gcd(375, 375)$, whose answer is 375.

Explain why the gcd of two numbers can never be larger than the smaller of them.

Every entry of the common-divisor list divides both numbers, and a divisor of a number cannot be larger than that number. So every common divisor is at most the smaller number, and the greatest of them is too.

The first gcd algorithm reuses an earlier algorithm. Identify where, and explain why writing the earlier one down precisely made this possible.

Steps 1 and 2 are each a call to the divisors algorithm, once on $m$ and once on $n$. Because that algorithm was written out precisely -- start with an empty list, test every $j$ from 1 to $n$, append on discovery -- it can be invoked as a single step here without restating it. Its guarantee that the list comes out in increasing order is what lets step 5 simply read off the last entry.

For 54000 and 81000 the chapter abandons reading the lists by eye. Explain what makes that necessary and what replaces it.

Each number has 80 divisors, so the two lists are far too long to scan reliably for the largest shared value. What replaces it is an explicit step: start an empty common list, and for each entry of the first list check whether it appears in the second, appending it if so. The 64 shared entries then end at 27000, which is the gcd.

This algorithm is correct but slow. Explain both halves of that statement.

It is correct because it works directly from the definition: it finds every divisor of each number, keeps exactly those that are common, and reports the greatest. Nothing is assumed beyond being able to test divisibility. It is slow because the work grows with the numbers themselves: $\gcd(54000, 81000)$ needs 81000 divisibility tests to produce an answer of 27000, and almost all of those tests fail.

Long answer questions (4)

Write out the algorithm for finding the divisors of $n$, execute it for $n = 15$ showing the list at each stage, and say what basic step it assumes.

Algorithm: 1 start with an empty list-of-divisors; 2 for each $j$ in $1, 2, \ldots, n$, if $j$ divides $n$ then append $j$ to list-of-divisors.

Executing for 15: the list begins empty. 1 divides 15, giving $[1]$. 2 does not. 3 divides 15, giving $[1, 3]$. 4 does not. 5 divides 15, giving $[1, 3, 5]$. 6 to 14 do not divide 15. 15 divides itself, giving $[1, 3, 5, 15]$.

The basic step assumed is that we can tell whether a smaller number divides a larger one.

Write out the five-step algorithm for $\gcd(m, n)$ and use it on 375 and 825.

Algorithm: 1 let divisors-of-m be divisors($m$); 2 let divisors-of-n be divisors($n$); 3 start with an empty list common-divisors; 4 for each $x$ in divisors-of-m, if $x$ also appears in divisors-of-n then append $x$ to common-divisors; 5 report the rightmost entry of common-divisors as $\gcd(m, n)$.

On 375 and 825: divisors(375) is $[1, 3, 5, 15, 25, 75, 125, 375]$ and divisors(825) is $[1, 3, 5, 11, 15, 25, 33, 55, 75, 165, 275, 825]$. Of the eight entries in the first list, 125 and 375 are absent from the second, so common-divisors is $[1, 3, 5, 15, 25, 75]$. Its rightmost entry is 75, so $\gcd(375, 825) = 75$.

Explain why the common-divisor list comes out in increasing order, and why that matters to the algorithm.

Each divisor list is built by testing $j$ from 1 upwards and appending every divisor as it is found, so each list is in increasing order by construction, with no sorting step. Step 4 walks the first list from left to right and appends the entries that also appear in the second, so it preserves that order and the common list increases too.

It matters because step 5 can then simply read the rightmost entry. Without the ordering guarantee the algorithm would need an extra step to search the common list for its largest member, and the justification for the answer being the greatest common divisor would have to be made separately.

A student proposes stopping the divisors algorithm at $n/2$ to save work, since no divisor other than $n$ itself can be larger. Assess the proposal.

The observation is true: apart from $n$, every divisor of $n$ is at most $n/2$. So testing $j$ beyond $n/2$ finds nothing new except $n$ itself. The proposal as stated is nonetheless wrong, because it would leave $n$ out of its own divisor list, and $n$ is needed: $\gcd(375, 375)$ must come out as 375, and divisors(18) must end at 18.

The repair is to test $j$ up to $n/2$ and then append $n$ directly, which keeps every list correct and roughly halves the testing. It is still slow, because the work remains proportional to $n$.

Flashcards (20)

What does gcd stand for?
Greatest common divisor. It is the same number as the highest common factor, or hcf.
What is $\gcd(375, 825)$?
75, the rightmost entry of their common-divisor list $[1, 3, 5, 15, 25, 75]$.
How does the divisors algorithm start?
With an empty list. Every $j$ from 1 to $n$ is then tested, and each divisor is appended as it is found.
What are the divisors of 18?
$[1, 2, 3, 6, 9, 18]$ -- six of them, in increasing order.
What are the divisors of 15?
$[1, 3, 5, 15]$ -- four of them.
What are the divisors of 775?
$[1, 5, 25, 31, 155, 775]$, since $775 = 5^2 \times 31$.
Why is the divisor list already in increasing order?
Because $j$ is tested from 1 upwards and each divisor is appended on discovery, so no sorting step is needed.
Why is the common-divisor list never empty?
Because 1 divides every number, so 1 is always a common divisor and the gcd is at least 1.
Where in the common list does the gcd sit?
At the right-hand end. The list increases, so its last entry is the greatest.
Which divisors of 375 are not divisors of 825?
125 and 375. The other six -- 1, 3, 5, 15, 25 and 75 -- are common.
What basic step does the divisors algorithm assume?
That we can tell whether a smaller number divides a larger one.
How much work does finding divisors(775) take?
775 tests, even though only 6 divisors are found. The work tracks the number, not the answer.
What is $\gcd(54000, 81000)$?
27000. Each number has 80 divisors and they share 64 of them.
Why can the two lists not simply be eyeballed for 54000 and 81000?
Each list holds 80 entries, so picking the largest shared value by eye is unreliable. The comparison is made its own step.
What does it mean to execute an algorithm?
To run through its steps one at a time on particular values.
Why does the algorithm name things like list-of-divisors and $j$?
So each step can refer to a value without ambiguity. Without names the description becomes clumsy.
If $m$ divides $n$, what is $\gcd(m, n)$?
$m$. Every divisor of $m$ also divides $n$, so the common list is just the divisors of $m$.
Can the gcd exceed the smaller of the two numbers?
No. Every common divisor divides the smaller number, so none of them can be larger than it.
What does the gcd algorithm reuse?
The divisors algorithm, once for each number. Steps 1 and 2 are both calls to it.
Is this gcd method fast?
It is correct but slow: for 54000 and 81000 it tests every number up to 81000. Faster methods come later in the chapter.

Play this topic

  • Match each name to what it holds
  • True or false about the gcd algorithm
  • Complete the statement
  • Unscramble the vocabulary

Data Structures, and Two Faster Algorithms

Naming the values an algorithm keeps track of, and choosing how to hold them, is part of the algorithm itself: a list is a data structure. Three refinements then cut the gcd scan from m + n candidates to min(m, n) and finally replace the list with one running value. Euclid goes further by reducing the pair itself, and Aryabhata's division step turns a run of subtractions into a single remainder.

Full explanation

The values an algorithm keeps

Running an algorithm produces intermediate quantities, and they need names -- divisors-of-m, most-recent-common-divisor -- so that later steps can refer to them. They are also rarely simple numbers. Here they are lists held in ascending order, and a list is an example of a data structure: a way of organising information so the work can be done more efficiently.

Three refinements, same answer

Scanning for the divisors of $m$ and then of $n$ checks $m + n$ candidates. Merging the two passes into one cuts that to $\max(m, n)$. Collecting the COMMON divisors directly removes the two separate lists altogether, and since no common divisor can exceed the smaller number the scan can stop at $\min(m, n)$. Finally the list itself is unnecessary: each larger common divisor makes the earlier ones useless, so a single value started at 1 and updated on each improvement is enough.

Euclid reduces the problem instead

For $m \geq n$, $\gcd(m, n) = \gcd(n, m - n)$. Any common divisor $d$ of $m$ and $n$ divides the difference, since $m - n = (a - b)d$; and any $d$ dividing $n$ and $m - n$ divides their sum, which is $m$. The two pairs therefore share the same common divisors. Repeating the reduction shrinks the numbers until the second reaches 0, and then the first is the answer.

But subtraction is still too slow

On $\gcd(375, 825)$ it takes seven reductions. On $\gcd(99, 2)$ it takes about fifty-one, because it can only remove 2 at a time. The step count tracks the VALUE of the numbers, which is the very thing the chapter wanted to escape.

Aryabhata changes one line

Reduce to $\gcd(n, m \bmod n)$ rather than $\gcd(n, m - n)$. Subtracting $n$ from $m$ repeatedly ends at exactly $m \bmod n$, so one division finishes a whole run of subtractions. $\gcd(99, 2)$ falls from about fifty-one steps to two. The ordering step and the stopping rule are unchanged; only step 3 differs.

Watch out for these

Practice MCQs with answers (47)

Q1 How many Step-3 reductions does Euclid's subtraction algorithm make on $\gcd(375, 825)$? intermediate
  • A 7
  • B 5
  • C 9
  • D 12
Show answer
Answer: 7
Why:

The chapter's trace runs $\gcd(825,375) \to \gcd(375,450) \to \gcd(450,375) \to \gcd(375,75) \to \gcd(75,300) \to \gcd(300,75) \to \ldots \to \gcd(75,0)$, with seven subtraction steps.

Q2 What is $17 \bmod 5$? beginner
  • A 1
  • B 2
  • C 3
  • D 7
Show answer
Answer: 2
Why:

$17 = 3 \times 5 + 2$, so the remainder is 2.

Q3 What is $33 \bmod 7$? beginner
  • A 3
  • B 4
  • C 5
  • D 6
Show answer
Answer: 5
Why:

$33 = 4 \times 7 + 5$.

Q4 What is $825 - 375$? beginner
  • A 350
  • B 440
  • C 550
  • D 450
Show answer
Answer: 450
Why:

This is the first subtraction Euclid's algorithm performs on the pair.

Q5 Euclid's algorithm reaches $\gcd(75, 0)$. What does it report? beginner
  • A 75
  • B 0
  • C 25
  • D 50
Show answer
Answer: 75
Why:

Step 2 says that if $n = 0$ the answer is $m$.

Q6 What is $\gcd(23, 23)$? beginner
  • A 0
  • B 23
  • C 1
  • D 46
Show answer
Answer: 23
Why:

Reducing gives $\gcd(23, 0)$, and Step 2 reports 23.

Q7 How many reductions does Aryabhata's division algorithm need for $\gcd(99, 2)$? intermediate
  • A 1
  • B 4
  • C 2
  • D 51
Show answer
Answer: 2
Why:

$99 \bmod 2 = 1$, then $2 \bmod 1 = 0$, so the answer 1 arrives in two steps.

Q8 How many reductions does the SUBTRACTION algorithm need for $\gcd(99, 2)$? advanced
  • A 12
  • B 33
  • C 99
  • D 51
Show answer
Answer: 51
Why:

Subtracting 2 at a time from 99 takes about half of 99 steps, which is why the division step replaces it.

Q9 How many divisor pairs does 18 have? beginner
  • A 3
  • B 2
  • C 4
  • D 6
Show answer
Answer: 3
Why:

They are $(1, 18)$, $(2, 9)$ and $(3, 6)$.

Q10 Scanning $k$ from 2 to $\min(6, 12)$, how many times is most-recent-common-divisor updated? intermediate
  • A 2
  • B 3
  • C 4
  • D 5
Show answer
Answer: 3
Why:

It updates at $k = 2$, $k = 3$ and $k = 6$; 4 and 5 do not divide 6.

Q11 What is $\gcd(6, 12)$? beginner
  • A 2
  • B 3
  • C 6
  • D 4
Show answer
Answer: 6
Why:

The last update in the scan sets most-recent-common-divisor to 6.

Q12 Two scans of $m$ and $n$ separately check how many candidates? intermediate
  • A $m - n$
  • B $m \times n$
  • C $\max(m, n)$
  • D $m + n$
Show answer
Answer: $m + n$
Why:

One scan to $m$ and another to $n$; combining them into a single pass reduces this.

Q13 Combining the two scans into one reduces the count to what? intermediate
  • A $\max(m, n)$
  • B $\min(m, n)$
  • C $m + n$
  • D $m - n$
Show answer
Answer: $\max(m, n)$
Why:

A single pass of $j$ from 1 to the larger of the two numbers suffices for both lists.

Q14 Searching only for COMMON divisors reduces the count further to what? intermediate
  • A $\max(m, n)$
  • B $\min(m, n)$
  • C $m + n$
  • D $m \times n$
Show answer
Answer: $\min(m, n)$
Why:

A common divisor cannot exceed the smaller number, so there is no point scanning past it.

Q15 What is most-recent-common-divisor set to before the scan begins? beginner
  • A 0
  • B 2
  • C 1
  • D $m$
Show answer
Answer: 1
Why:

1 is always a common divisor, so it is a safe starting value.

Q16 At which value of $k$ does the scan for $\gcd(6, 12)$ first fail to update? intermediate
  • A 2
  • B 3
  • C 5
  • D 4
Show answer
Answer: 4
Why:

4 does not divide 6, so most-recent-common-divisor stays at 3.

Q17 In which year was the Aryabhatiya written? beginner
  • A 499 CE
  • B 199 CE
  • C 399 CE
  • D 599 CE
Show answer
Answer: 499 CE
Why:

The chapter dates it to 499 CE.

Q18 What is $450 - 375$? beginner
  • A 25
  • B 75
  • C 85
  • D 95
Show answer
Answer: 75
Why:

This subtraction brings Euclid's algorithm to the pair $(375, 75)$.

Q19 What is $99 \bmod 2$? beginner
  • A 0
  • B 2
  • C 1
  • D 49
Show answer
Answer: 1
Why:

99 is odd, so dividing by 2 leaves 1.

Q20 Starting from an odd $2k + 1$, roughly how many subtraction reductions does $\gcd(2k+1, 2)$ need? advanced
  • A $2$
  • B $2k$
  • C $3k$
  • D $k$
Show answer
Answer: $k$
Why:

Subtracting 2 each time from an odd number takes about half its value in steps.

Q21 Going from a 3-digit to a 5-digit smaller number, the scan work grows by what factor? intermediate
  • A 100
  • B 10
  • C 25
  • D 50
Show answer
Answer: 100
Why:

Each extra digit multiplies the range by ten, so two digits multiply it by a hundred.

Q22 What is a list an example of? beginner
  • A A kind of basic step
  • B A data structure
  • C An unnamed intermediate
  • D A reduction to a simpler problem
Show answer
Answer: A data structure
Why:

A data structure organises information so that an algorithm can work more efficiently.

Q23 Why do intermediate values get names like divisors-of-m? beginner
  • A So that the lists stay in ascending order
  • B So that the algorithm can be justified
  • C So that later steps can refer to them
  • D So that the work tracks the digits
Show answer
Answer: So that later steps can refer to them
Why:

Naming is what lets an algorithm be written down concisely.

Q24 What does Euclid's key observation say? intermediate
  • A $\gcd(m, n) = \gcd(m, n - m)$ for any two numbers at all
  • B $\gcd(m, n)$ is the product of the two numbers divided by their lcm
  • C $\gcd(m, n) = \gcd(m - n, n - m)$
  • D $\gcd(m, n) = \gcd(n, m - n)$ when $m \geq n$
Show answer
Answer: $\gcd(m, n) = \gcd(n, m - n)$ when $m \geq n$
Why:

Replacing the larger number by the difference leaves the set of common divisors untouched.

Q25 Why does a common divisor $d$ of $m$ and $n$ also divide $m - n$? advanced
  • A Because $m - n = (a - b)d$ when $m = ad$ and $n = bd$
  • B Because $d$ divides every number below $m$ too
  • C Because subtraction preserves divisors
  • D Because $d$ is at most the smaller
Show answer
Answer: Because $m - n = (a - b)d$ when $m = ad$ and $n = bd$
Why:

Factoring $d$ out of the difference shows it divides the difference too.

Q26 What is the stopping condition of Euclid's algorithm? beginner
  • A $m$ equals 0
  • B $n = 0$
  • C $m = n$ exactly
  • D $n = 1$, since 1 divides all
Show answer
Answer: $n = 0$
Why:

On reaching $\gcd(m, 0)$ the answer is $m$.

Q27 What does Step 1 of Euclid's algorithm do? beginner
  • A Checks whether $n$ is zero yet
  • B Subtracts the smaller at once
  • C Reverses the pair if $m < n$
  • D Replaces $m$ with the remainder
Show answer
Answer: Reverses the pair if $m < n$
Why:

The reduction step assumes $m \geq n$, so the pair is ordered first.

Q28 What is the single change Aryabhata's algorithm makes to Euclid's? intermediate
  • A Step 1 orders the pair with the smaller first
  • B Step 2 stops once $n$ reaches 1
  • C It drops the lists for one value
  • D Step 3 uses $m \bmod n$ instead of $m - n$
Show answer
Answer: Step 3 uses $m \bmod n$ instead of $m - n$
Why:

The stopping condition and the ordering step are identical; only the reduction differs.

Q29 Why is repeated division better than repeated subtraction? intermediate
  • A One division does the work of many subtractions
  • B Division is a basic step, subtraction is not
  • C Subtraction fails on close numbers
  • D Division keeps the pair ordered
Show answer
Answer: One division does the work of many subtractions
Why:

What remains after subtracting $n$ from $m$ as often as possible IS $m \bmod n$, so the division reaches it in one step.

Q30 Why does the chapter abandon the list of common divisors? intermediate
  • A Because the list cannot be kept in ascending order once it is built
  • B Each new common divisor makes the earlier ones useless
  • C Because a list is not a real data structure
  • D Because 1 would appear twice
Show answer
Answer: Each new common divisor makes the earlier ones useless
Why:

Only the largest found so far matters, so a single running value replaces the whole list.

Q31 Why can the common-divisor scan stop at $\min(m, n)$? intermediate
  • A Because the larger number's divisors have all been found by that point
  • B Because the scan would repeat a divisor
  • C A common divisor cannot exceed the smaller number
  • D Because the list ascends
Show answer
Answer: A common divisor cannot exceed the smaller number
Why:

Every common divisor divides the smaller number, so nothing above it can qualify.

Q32 Did Euclid discover this algorithm? beginner
  • A Yes, the Elements is the first mention
  • B No, it is Aryabhata's method
  • C Yes, and later Greeks refined it
  • D He was the first to write it down
Show answer
Answer: He was the first to write it down
Why:

Historians believe other Greek mathematicians knew it already; Euclid recorded it in the Elements.

Q33 Why are the refined algorithms still known to be correct? advanced
  • A Each refinement changes the effort, not what is computed
  • B Because each one was justified afresh from scratch
  • C Because they were checked on examples
  • D Because the gcd is unique
Show answer
Answer: Each refinement changes the effort, not what is computed
Why:

The first algorithm follows the definition, and every later version computes the same thing more cheaply.

Q34 What was the goal the chapter set for a gcd algorithm? advanced
  • A Effort proportional to the smaller value
  • B Effort proportional to the number of digits
  • C Effort independent of the numbers
  • D Effort tracking how many divisors
Show answer
Answer: Effort proportional to the number of digits
Why:

That is the standard the addition algorithm met, and the subtraction version of Euclid does not.

Q35 Does Euclid's subtraction algorithm meet that goal? advanced
  • A Yes, since each reduction drops a whole digit
  • B Yes, so the chapter stops here
  • C No, $\gcd(2k+1, 2)$ needs about $k$ steps
  • D No, it cannot handle a zero
Show answer
Answer: No, $\gcd(2k+1, 2)$ needs about $k$ steps
Why:

The step count tracks the value, not the number of digits, which is exactly what the division step repairs.

Q36 What does $m \bmod n$ stand for? beginner
  • A The whole-number part of the quotient of $m$ divided by $n$
  • B The number of times $n$ can be subtracted from $m$ altogether
  • C The smaller of $m$ and $n$
  • D The remainder when $m$ is divided by $n$
Show answer
Answer: The remainder when $m$ is divided by $n$
Why:

For instance $17 \bmod 5 = 2$ and $33 \bmod 7 = 5$.

Q37 What does the tiling picture in the chapter justify? advanced
  • A That $d$ tiles $m$ and $n$ exactly when it tiles $n$ and $m - n$
  • B That the gcd is the largest single block that fits $m$ exactly
  • C That any number tiles with blocks of 1
  • D That $m - n$ is smaller than both
Show answer
Answer: That $d$ tiles $m$ and $n$ exactly when it tiles $n$ and $m - n$
Why:

Blocks of size $d$ filling $m$ and $n$ also fill the difference, and conversely, which is why the common divisors are the same.

Q38 What do data structures let an algorithm do? beginner
  • A Avoid having to name the intermediate values it computes along the way
  • B Organise information to work more efficiently
  • C Guarantee the answer is correct
  • D Reduce a problem to a simpler one
Show answer
Answer: Organise information to work more efficiently
Why:

Here the structure is a list, kept in ascending order.

Q39 If divisors are listed in PAIRS, how far must the scan go? advanced
  • A Up to $n$ itself, exactly as the original algorithm already does
  • B Up to $n/2$, since no divisor other than $n$ can be larger than that
  • C Up to about $\sqrt{n}$
  • D Up to $\min(m, n)$
Show answer
Answer: Up to about $\sqrt{n}$
Why:

Each divisor below the square root pairs with one above it, so examining the small ones finds them all.

Q40 What happens to the gcd algorithm if divisors are collected in pairs? advanced
  • A Nothing changes at all, because the same divisors are still collected
  • B It stops working, because the pairs cannot be compared between lists
  • C It becomes proportional to the number of digits
  • D The list no longer arrives in ascending order
Show answer
Answer: The list no longer arrives in ascending order
Why:

Pairing produces the divisors out of order, so step 5's reading of the rightmost entry would no longer give the greatest.

Q41 What is the relationship between the three refinements and the first algorithm? intermediate
  • A They compute the same answer more cheaply
  • B They compute a different answer that happens to agree most of the time
  • C They each need their own justification
  • D They are slower but clearer
Show answer
Answer: They compute the same answer more cheaply
Why:

That is why correctness carries over without being re-argued each time.

Q42 Why does the chapter present the slow algorithm first? intermediate
  • A Because Euclid was the one who wrote that version down
  • B Because it follows the definition and is easy to justify
  • C Because only it works for every pair
  • D Because the faster ones differ
Show answer
Answer: Because it follows the definition and is easy to justify
Why:

Correctness is established on the obvious version, then efficiency is improved without changing what is computed.

Q43 How many Step-3 reductions does Aryabhata's algorithm need for $\gcd(375, 825)$? intermediate
  • A 3
  • B 5
  • C 2
  • D 7
Show answer
Answer: 2
Why:

$825 \bmod 375 = 75$, then $375 \bmod 75 = 0$, so the answer 75 arrives in two steps where subtraction took seven.

Q44 Assertion (A): For $m \geq n$, $\gcd(m, n) = \gcd(n, m - n)$. Reason (R): Any common divisor of $m$ and $n$ also divides $m - n$, and any common divisor of $n$ and $m - n$ also divides $m$. advanced
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: Both A and R are true, and R is the correct explanation of A
Why:

Both are true, and R is the justification: the two pairs have exactly the same set of common divisors, so they have the same greatest one.

Q45 Assertion (A): Aryabhata's algorithm is faster than Euclid's subtraction version. Reason (R): Aryabhata's algorithm stops when the second number reaches 0. intermediate
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: Both A and R are true, but R is not the correct explanation of A
Why:

Both are true, but R is not the reason. Both algorithms stop at the same condition; the speed comes from reducing by $m \bmod n$ instead of $m - n$.

Q46 Assertion (A): Euclid's subtraction algorithm needs about $k$ reductions for $\gcd(2k+1, 2)$. Reason (R): Each subtraction step removes at least one digit from the larger number. advanced
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: A is true but R is false
Why:

A is true, which is why the subtraction version misses the chapter's goal. R is false: subtracting 2 from 99 gives 97, which has the same number of digits.

Q47 Assertion (A): Aryabhata's algorithm changes the stopping condition of Euclid's. Reason (R): $m \bmod n$ is the remainder when $m$ is divided by $n$. intermediate
  • A Both A and R are true, and R is the correct explanation of A
  • B Both A and R are true, but R is not the correct explanation of A
  • C A is true but R is false
  • D A is false but R is true
Show answer
Answer: A is false but R is true
Why:

A is false: only Step 3 changes, and the ordering and stopping steps are identical. R is a correct definition of the remainder.

Important short questions (10)

State Euclid's observation and its stopping condition.

For $m \geq n$, $\gcd(m, n) = \gcd(n, m - n)$. The process stops when the second number reaches 0, and then the answer is the first number.

What is a data structure, and which one does this chapter use?

A data structure is a way of organising information so that an algorithm can work more efficiently. The chapter uses lists, kept in ascending order.

What is the only difference between Euclid's algorithm and Aryabhata's?

Step 3. Euclid reduces $\gcd(m, n)$ to $\gcd(n, m - n)$; Aryabhata reduces it to $\gcd(n, m \bmod n)$. Steps 1 and 2 are identical.

Show that any common divisor of $m$ and $n$ also divides $m - n$.

Let $d$ be a common divisor, so $m = ad$ and $n = bd$ for natural numbers $a$ and $b$. Then $m - n = ad - bd = (a - b)d$, which is a multiple of $d$, so $d$ divides $m - n$.

Trace the running-value method on $\gcd(6, 12)$.

$\min(6, 12) = 6$, and most-recent-common-divisor starts at 1. $k = 2$ divides both, so it updates to 2. $k = 3$ divides both, so it updates to 3. $k = 4$ and $k = 5$ do not divide 6, so it stays at 3. $k = 6$ divides both, so it updates to 6. The scan ends and the gcd is 6.

Explain the three refinements that cut the number of candidates scanned.

First, the two separate scans of $m$ and of $n$ are combined into one pass, cutting $m + n$ candidates to $\max(m, n)$. Second, the common divisors are computed directly rather than building two lists and comparing them. Third, since no common divisor can exceed the smaller number, the scan need only run to $\min(m, n)$.

Why is $\gcd(99, 2)$ a bad case for the subtraction algorithm but not for the division one?

Subtracting 2 repeatedly from 99 takes about 51 reductions, because each step removes only 2. The division step goes straight to the remainder: $99 \bmod 2 = 1$ and then $2 \bmod 1 = 0$, so it finishes in two.

Explain why the refined algorithms do not need to be justified again from the definition.

The first algorithm was derived straight from the definition of the gcd: it finds every divisor of each number, keeps the common ones and reports the greatest, so its correctness is immediate. Each refinement then changes only how much work is done -- combining scans, computing the common list directly, keeping one running value instead of a list, or reducing by difference or remainder -- while computing the same quantity. Since what is computed is unchanged, the original justification carries over to each of them.

The chapter wanted an algorithm whose effort is proportional to the number of digits. Explain how far each version gets.

The scanning versions are proportional to the VALUE of the smaller number: going from a 3-digit to a 5-digit number multiplies the work by a hundred. Euclid's subtraction version is no better in the worst case, since $\gcd(2k+1, 2)$ takes about $k$ reductions. Aryabhata's division version is the one that improves matters, because each remainder step can shrink the numbers enormously: $\gcd(99, 2)$ falls from 51 steps to 2.

Exercise 3 of the chapter notes that divisors occur in pairs. Explain the speed-up and the cost.

The divisors of 18 pair up as $(1, 18)$, $(2, 9)$ and $(3, 6)$, so every divisor below the square root has a partner above it. Examining only the numbers up to about $\sqrt{n}$ therefore finds all of them, which is a large saving on scanning to $n$. The cost is that the divisors no longer arrive in ascending order, so the gcd algorithm can no longer simply report the rightmost entry of the common list; it would need a separate step to find the largest.

Long answer questions (4)

Write out Euclid's subtraction algorithm in three steps and apply it to $\gcd(375, 825)$, listing each pair.

Algorithm: Step 1, when the first number is the smaller, swap the pair over. Step 2, once the second number has fallen to zero, the first number is the answer. Step 3, in every other case replace the pair by $(n, m - n)$ and begin again.

Applying it: $\gcd(375, 825)$ reverses to $\gcd(825, 375)$, then reduces through $\gcd(375, 450)$, $\gcd(450, 375)$, $\gcd(375, 75)$, $\gcd(75, 300)$, $\gcd(300, 75)$, $\gcd(75, 225)$, $\gcd(225, 75)$, $\gcd(75, 150)$, $\gcd(150, 75)$, $\gcd(75, 75)$ and finally $\gcd(75, 0)$. Step 2 then reports 75. There are seven Step-3 reductions in all.

Justify Euclid's observation that $\gcd(m, n) = \gcd(n, m - n)$ for $m \geq n$, in both directions.

Suppose $d$ is a common divisor of $m$ and $n$. Write $m = ad$ and $n = bd$. Then $m - n = (a - b)d$, so $d$ divides $m - n$ as well, and $d$ is therefore a common divisor of $n$ and $m - n$.

Now suppose instead that $d$ divides both $n$ and $m - n$. Write $n = xd$ and $m - n = yd$. Then $m = n + (m - n) = xd + yd = (x + y)d$, so $d$ divides $m$ and is a common divisor of $m$ and $n$.

The two pairs therefore have exactly the same set of common divisors, so they have the same greatest one. The chapter shows this as a tiling: blocks of size $d$ that fill $m$ and $n$ also fill the leftover $m - n$.

Describe the three ways the chapter improves the list-based gcd algorithm, and say what is gained each time.

First, the two scans are merged: instead of running 1 to $m$ and then 1 to $n$, a single pass of $j$ from 1 to $\max(m, n)$ adds $j$ to whichever lists it divides. The candidates checked fall from $m + n$ to $\max(m, n)$.

Second, the common divisors are computed directly: for each $j$, if $j$ divides both numbers it goes into one common list. The two separate lists and the comparison step disappear. Since a common divisor cannot exceed the smaller number, the scan can stop at $\min(m, n)$.

Third, the list itself goes. Each larger common divisor makes the earlier ones useless, so a single value most-recent-common-divisor is kept, started at 1 and updated whenever a larger common divisor appears. At the end it holds the gcd.

Compare Euclid's subtraction step with Aryabhata's division step, using the chapter's own examples.

Euclid reduces $\gcd(m, n)$ to $\gcd(n, m - n)$; Aryabhata reduces it to $\gcd(n, m \bmod n)$. The justification is the same in form: a divisor tiles $m$ and $n$ exactly when it tiles $n$ and the remainder.

The difference is speed. Subtracting is the slow way of finding a remainder: what is left when $n$ can no longer be taken from $m$ IS $m \bmod n$. So one division replaces a whole run of subtractions. On $\gcd(375, 825)$ subtraction needs seven reductions and division needs two. On $\gcd(99, 2)$ the gap is extreme: subtraction grinds down 97, 95, 93 and so on for about 51 steps, while division gives $99 \bmod 2 = 1$ and then $2 \bmod 1 = 0$ in two.

Only the division version approaches the chapter's goal of effort proportional to the number of digits rather than to the value.

Flashcards (20)

What is Euclid's key observation?
For $m \geq n$, $\gcd(m, n) = \gcd(n, m - n)$. Replacing the larger number by the difference leaves the common divisors unchanged.
Why does a common divisor of $m$ and $n$ divide $m - n$?
If $m = ad$ and $n = bd$ then $m - n = (a - b)d$, so $d$ divides the difference too. The converse holds as well.
What is Euclid's stopping condition?
$n = 0$, at which point the answer is $m$. So $\gcd(23, 23)$ reduces to $\gcd(23, 0)$ and reports 23.
What does Step 1 do?
Swaps the pair if $m < n$, because the reduction step assumes the first number is the larger.
What single change does Aryabhata's algorithm make?
Step 3 reduces to $\gcd(n, m \bmod n)$ instead of $\gcd(n, m - n)$. Everything else is identical.
What does $m \bmod n$ mean?
The remainder when $m$ is divided by $n$. For example $17 \bmod 5 = 2$ and $33 \bmod 7 = 5$.
Why is dividing faster than subtracting here?
What remains after subtracting $n$ from $m$ as often as possible IS $m \bmod n$, so one division does the work of many subtractions.
How many reductions does $\gcd(99, 2)$ take each way?
About 51 by repeated subtraction, but only 2 by repeated division.
How many reductions does $\gcd(375, 825)$ take by subtraction?
Seven, following the chapter's trace down to $\gcd(75, 0)$.
Why is the subtraction version still not efficient enough?
Starting from an odd $2k+1$, $\gcd(2k+1, 2)$ needs about $k$ steps, so the work tracks the VALUE rather than the number of digits.
What is a data structure?
A way of organising information so that an algorithm can work more efficiently. A list is the example used here.
Why do intermediate values get names?
So that later steps can refer to them. Naming is what lets an algorithm be written down concisely.
How do the three scan refinements reduce the work?
From $m + n$ candidates to $\max(m, n)$ by combining the passes, then to $\min(m, n)$ by looking only for COMMON divisors.
Why can the common-divisor scan stop at $\min(m, n)$?
Because no common divisor can be larger than the smaller of the two numbers.
Why keep only most-recent-common-divisor?
Each larger common divisor makes the earlier ones useless, so a single running value replaces the whole list. It starts at 1.
Trace $\gcd(6, 12)$ by the running-value method.
min is 6. Start at 1. $k = 2$ updates to 2, $k = 3$ updates to 3, 4 and 5 do not divide 6, $k = 6$ updates to 6. The gcd is 6.
Why do the refinements not need new correctness proofs?
Each changes the effort, not what is computed, so the justification of the definition-following first algorithm carries over.
Did Euclid discover the algorithm?
Probably not. Historians believe other Greek mathematicians knew it; Euclid was the first to write it down, in the Elements.
Where does the division method appear in Indian mathematics?
In Aryabhata's Aryabhatiya of 499 CE, as the long-division method for finding the gcd using place-value numerals.
If divisors are collected in PAIRS, what breaks?
They no longer arrive in ascending order, so reading the rightmost entry of the common list stops being a valid way to get the greatest.

Play this topic

  • Match each step to what it does
  • True or false about the refinements
  • Complete the statement
  • Unscramble the vocabulary

Class 9 Mathematics Chapter 11 — frequently asked questions

State what an algorithm is, and give one example from this topic.

An algorithm is a precise step-by-step procedure that arrives at an answer, described so that each step can be followed without judgement. The column method for adding two numbers is an example.

Why must the two numbers be written with their digits aligned from the right?

So that digits of the same place value fall in the same column. The method adds units to units and tens to tens, so a right alignment is what makes each column one place-value group.

Explain why the carry can never be larger than 1.

The largest total a column can reach is $9+9+1=19$. That forms exactly one new group of ten, so only 1 is ever carried.

Write down the divisors of 18 in the order the algorithm finds them, and say why they come out in that order.

$[1, 2, 3, 6, 9, 18]$. The algorithm tests $j$ from 1 upwards and appends each divisor as it is found, so the list is increasing without any sorting step.

Why is the common-divisor list of any two numbers never empty?

Because 1 divides every number, so 1 is a common divisor of any pair. The gcd is therefore at least 1.

State what the last step of the gcd algorithm does and why it is enough.

It reports the rightmost entry of the common-divisor list. That is enough because both divisor lists were built in increasing order, so the common list increases too and its last entry is the greatest.

State Euclid's observation and its stopping condition.

For $m \geq n$, $\gcd(m, n) = \gcd(n, m - n)$. The process stops when the second number reaches 0, and then the answer is the first number.

What is a data structure, and which one does this chapter use?

A data structure is a way of organising information so that an algorithm can work more efficiently. The chapter uses lists, kept in ascending order.

What is the only difference between Euclid's algorithm and Aryabhata's?

Step 3. Euclid reduces $\gcd(m, n)$ to $\gcd(n, m - n)$; Aryabhata reduces it to $\gcd(n, m \bmod n)$. Steps 1 and 2 are identical.

All Class 9 Mathematics chapters

All Mathematics chapters · Every Class 9 subject · The whole NCERT library

Study this chapter properly, free

Everything above is on this page to read. In the Veda app the same chapter becomes spaced-repetition flashcards, timed tests that mark themselves, Veda Bites you can swipe, and games — with your progress tracked topic by topic.

Get Veda free