In Class 9 Mathematics Part II (Ganita Manjari) Chapter 11: The World of Algorithms, students explore the foundational logic of computational mathematics and algorithm design. To master this chapter for class assessments and term examinations, explore our complete
An algorithm is a well-defined, step-by-step procedure to solve a specific mathematical problem. This chapter begins by comparing elementary dot counting with the efficient Indian base-ten place-value addition algorithm, demonstrating how systematic procedures reduce computational effort from exponential magnitude to the number of digits. It then develops the computation of the Greatest Common Divisor (GCD / HCF) across multiple algorithmic iterations—from brute-force divisor listing using list data structures, to linear range scans, to Euclid's subtraction algorithm, and finally to Aryabhata's division algorithm (long division / modulo method). The chapter concludes with the historical origin of the word algorithm through the Persian mathematician Al-Khwarizmi and the global transmission of Indian numeral operations.
When you first learned to add, you probably counted dots. To add 5 and 7, you'd draw 5 dots, then 7 more, and count them all: 12. But imagine adding 473 and 695 that way! You'd need hundreds of dots. Luckily, we have a much faster method.
[Diagram: Draw 5 yellow dots in a row, then 7 more dots below them. Show a child counting them to get 12.]
This faster method is an algorithm. Here's how it works:
This is an example of an algorithm, a step-by-step procedure to arrive at an answer.
Let's see it in action with 473 + 695:
[Diagram: Show column addition of 473 and 695. Units: 3+5=8, carry 0. Tens: 7+9=16, write 6, carry 1. Hundreds: 4+6+1=11, write 1, carry 1. Final carry 1 gives 1168.]
Why does this work? Because we group numbers into units, tens, hundreds, and add each group separately. Whenever a smaller group makes a ten, we carry it over to the next group.
The best part? This algorithm is super fast. Counting dots for 4-digit numbers takes 10 times longer than for 3-digit numbers, but the algorithm just adds one more column. For 5-digit numbers, it's 100 times more dots, but only two more columns.
Think and Reflect:
The greatest common divisor (gcd) of two numbers is the largest number that divides both. For example, gcd(12, 18) = 6, because 6 is the biggest number that divides both 12 and 18.
To find the gcd, we first need all divisors of each number. Here's a simple algorithm:
Let's try n = 18. We check 1 (divides, add), 2 (divides, add), 3 (divides, add), 4 (no), 5 (no), 6 (divides, add), 7 (no), 8 (no), 9 (divides, add), 10-17 (no), 18 (divides, add). The list becomes [1, 2, 3, 6, 9, 18].
[Diagram: Show a list growing step by step as we check each number from 1 to 18 for 18. Highlight the divisors as they are added.]
Think and Reflect: Try this for 15, 135, and 775. How does the work grow as numbers get bigger?
Once we have the lists of divisors for two numbers, we find the largest number that appears in both. For example, divisors of 375 are [1, 3, 5, 15, 25, 75, 125, 375] and divisors of 825 are [1, 3, 5, 11, 15, 25, 33, 55, 75, 165, 275, 825]. The common divisors are [1, 3, 5, 15, 25, 75]. The largest is 75, so gcd(375, 825) = 75.
For big numbers like 54000 and 81000, the lists are huge. We need a systematic way. We create a new list of common divisors. For each divisor of the first number, we check if it's also in the second list. If yes, we add it to the common list. Since both original lists are in increasing order, the common list is too, so the last element is the gcd.
Here's the complete algorithm:
For gcd(375, 825), the common list is [1, 3, 5, 15, 25, 75], so the answer is 75.
When we run an algorithm, we need to keep track of things like lists of divisors. We give them names so we can use them later. A list is an example of a data structure — a way to organise information so our algorithm works better.
A list is an example of a data structure. Data structures allow us to organise information in a manner that helps make an algorithm more efficient.
Our first gcd algorithm works, but we can make it faster.
Instead of scanning from 1 to m and then 1 to n, we scan from 1 to max(m,n). For each j, if it divides m, we add to divisors-of-m; if it divides n, we add to divisors-of-n. This reduces checks from m+n to max(m,n).
Even better: we can directly find common divisors. Scan j from 1 to min(m,n). If j divides both m and n, add it to common-divisors. A common divisor can't be bigger than the smaller number.
Do we really need to store all common divisors? No! We only care about the largest one found so far. We keep a variable most-recent-common-divisor, starting at 1. Then for k from 2 to min(m,n), if k divides both, we update the variable to k. At the end, the variable is the gcd.
Example: m=6, n=12. min=6. Start with 1. k=2 divides both → update to 2. k=3 divides both → update to 3. k=4 doesn't divide 6. k=5 doesn't divide 6. k=6 divides both → update to 6. gcd = 6.
Our improved algorithm still checks numbers from 1 to min(m,n). So if the smaller number goes from 3 digits to 4 digits, we do 10 times more work. From 3 to 5 digits, 100 times more. Can we do better? Can we make the work proportional to the number of digits, not the value? Yes! That's where Euclid and Aryabhata come in.
Euclid, a Greek mathematician, gave a clever method. The key idea: if m ≥ n, then gcd(m,n) = gcd(n, m - n). Why? Any common divisor of m and n also divides m - n, and any common divisor of n and m - n also divides m.
[Diagram: Show a long bar of length m and a shorter bar of length n, both made of blocks of size d. Then show that the difference m - n is also made of blocks of size d.]
This observation tells us that any common divisor of m and n is also a common divisor of n and m - n, and the converse is also true. Hence gcd(m,n) = gcd(n, m - n).
Algorithm:
For gcd(375, 825): swap to (825, 375). Then 825 - 375 = 450 → (375, 450). Then 450 - 375 = 75 → (375, 75). Then 375 - 75 = 300 → (75, 300). Then 300 - 75 = 225 → (75, 225). Then 225 - 75 = 150 → (75, 150). Then 150 - 75 = 75 → (75, 75). Then 75 - 75 = 0 → (75, 0). Answer: 75.
But this can be slow! For gcd(99, 2), we subtract 2 repeatedly: 99→97→95→...→3→1. That's about 49 steps! So the number of steps is proportional to the value, not the digits.
Aryabhata, an Indian mathematician, improved this in 499 CE. Instead of repeated subtraction, use division with remainder. The key idea: gcd(m,n) = gcd(n, m mod n), where m mod n is the remainder when m is divided by n.
Instead of reducing gcd(m,n) to gcd(n, m - n) we reduce it to gcd(n, m mod n).
Algorithm:
For gcd(99, 2): 99 mod 2 = 1 → (2, 1). 2 mod 1 = 0 → (1, 0). Answer: 1. Just two steps!
This can be written neatly using long division. For gcd(825, 375):
[Diagram: Show long division: 375 divides 825 with quotient 2 and remainder 75. Then 75 divides 375 with quotient 5 and remainder 0. So gcd is 75.]
For gcd(99, 2):
[Diagram: Show long division: 2 divides 99 with quotient 49 and remainder 1. Then 1 divides 2 with quotient 2 and remainder 0. So gcd is 1.]
The number of steps in Aryabhata's algorithm is proportional to the number of digits, making it super efficient!
Al-Khwarizmi (780–850 CE) was a Persian mathematician at the "House of Wisdom" in Baghdad. He learned Sanskrit and wrote a book about Indian numerals and arithmetic. It was translated into Latin as Liber Algorismi de numero Indorum. His name became linked with these methods, and the word algorismus (from Algoritmi) came to mean any Indian method of calculation. Later it became "algorism" and then "algorithm".
Al-Khwarizmi's name became so closely tied to these methods that the word algorismus — from Algoritmi, the Latin form of his name — came to mean any Indian method for numerical computation; it later contracted to algorism and then algorithm.
So "algorithm" originally meant an Indian method of arithmetic, before it became a general term for any step-by-step procedure.
Definition of an Algorithm: A precise, systematic sequence of basic operations and instructions used to solve a specific class of problems.
Digit-by-Digit Addition Algorithm:
Aligns numbers from right to left based on the place-value system (units, tens, hundreds).
Adds columns from right to left while managing a carry (0 or 1).
Efficiency: While counting dots takes time proportional to the value of the numbers, column addition takes time proportional only to the number of digits, making large calculations exponentially faster.
Data Structures (Lists):
A list is a structured collection used to store and organize intermediate values in an algorithm (e.g., maintaining divisors in ascending order).
Evolution of GCD / HCF Algorithms:
Brute-Force Divisor Listing: Computes all divisors of m and n between 1 and each number, checks for common elements, and picks the largest. Requires checking up to m + n numbers.
Optimized Range Scan: Scans numbers from 1 up to min(m, n) and updates a variable called most-recent-common-divisor whenever a common divisor is found, eliminating the memory overhead of lists.
Euclid's Subtraction Algorithm: Based on the principle that gcd(m, n) = gcd(n, m - n) for m >= n. Stops when n = 0, returning m. While conceptually sound, for cases like gcd(2k + 1, 2) it requires k subtraction steps, making its run-time proportional to the magnitude rather than the number of digits.
Aryabhata's Division Algorithm (Division by Remainder): Described in the Aryabhatiya (499 CE), it replaces repeated subtraction with the modulo operation: gcd(m, n) reduces to gcd(n, m mod n). The number of reduction steps is proportional to the number of digits in m and n, achieving peak efficiency.
Etymology & "A Pinch of History":
The word algorithm derives from the Latinized name of Al-Khwarizmi (Algoritmi), who wrote Liber Algorismi de numero Indorum (c. 820 CE) expounding the Indian place-value number system and arithmetic procedures. Originally, algorism referred specifically to Indian methods of arithmetic.
Q1: Why is column addition significantly faster than counting dots? A: Counting dots requires work proportional to the actual magnitude (size) of the numbers. For example, adding two 5-digit numbers involves counting tens of thousands of dots. Column addition groups numbers into powers of ten (units, tens, hundreds) and only requires adding individual columns right to left. Thus, adding a 5-digit number takes only 5 basic column addition operations.
Q2: Why can the carry never exceed 1 when adding two numbers in base-ten? A: The largest single digit in base-ten is 9. When adding two single digits with a maximum possible incoming carry of 1, the largest sum is 9 + 9 + 1 = 19. In 19, the units digit is 9 and the carry to the next column is 1. Because the sum cannot reach 20 or higher, the carry can never be 2 or more.
Q3: Why is Aryabhata's division method faster than Euclid's subtraction method for finding GCD? A: Euclid's subtraction algorithm reduces gcd(m, n) by subtracting the smaller number from the larger one. When one number is very large and the other is very small (such as gcd(99, 2)), it subtracts 2 repeatedly, taking 49 steps. Aryabhata's division algorithm calculates the remainder directly in a single step (99 mod 2 = 1), reaching the answer in just two steps.
Q1: (Exercise Set 11.1, Q2 & Q3) Why must the columns of numbers be aligned from right to left in the addition algorithm, and how does it handle numbers of different lengths (e.g., a 5-digit number and a 3-digit number)? A:
Right-to-Left Alignment: Columns must be aligned from the rightmost digit so that digits with the same place value are added together (units with units, tens with tens, hundreds with hundreds).
Different Lengths: When adding a 5-digit number and a 3-digit number, aligning to the right leaves blank spaces on the left for the 3-digit number, which are treated as leading zeros (0 thousands and 0 ten-thousands). The algorithm proceeds through Step 3 until all columns of the larger number are processed.
Q2: (Section 11.3.3) Justify why gcd(m, n) is equal to gcd(n, m - n) for any natural numbers m >= n. A:
Let d be any common divisor of m and n. Then m = ad and n = bd for some positive integers a and b.
Subtracting the two gives m - n = ad - bd = (a - b)*d. Because (a - b) is an integer, d must also divide m - n. Hence, every common divisor of m and n is a divisor of n and m - n.
Conversely, if d divides both n and m - n, then n = xd and m - n = yd. Adding them gives m = (m - n) + n = yd + xd = (x + y)*d. Thus d also divides m.
Because the set of common divisors of (m, n) is identical to the set of common divisors of (n, m - n), their greatest common divisor must be identical: gcd(m, n) = gcd(n, m - n).
Q3: (End-of-Chapter Exercises, Q1) Compute gcd(375, 825) and gcd(51000, 81000) using the improved division algorithm. A:
Part (i): gcd(375, 825)
Step 1: 825 mod 375 = 75 (since 825 = 375 * 2 + 75). Problem reduces to gcd(375, 75).
Step 2: 375 mod 75 = 0 (since 375 = 75 * 5 + 0). Problem reduces to gcd(75, 0).
Step 3: When the second number is 0, the answer is the first number.
Result: gcd(375, 825) = 75.
Part (ii): gcd(51000, 81000)
Step 1: 81000 mod 51000 = 30000 (since 81000 = 51000 * 1 + 30000).
Step 2: 51000 mod 30000 = 21000 (since 51000 = 30000 * 1 + 21000).
Step 3: 30000 mod 21000 = 9000 (since 30000 = 21000 * 1 + 9000).
Step 4: 21000 mod 9000 = 3000 (since 21000 = 9000 * 2 + 3000).
Step 5: 9000 mod 3000 = 0 (since 9000 = 3000 * 3 + 0).
Result: gcd(51000, 81000) = 3000.
1. What is the fundamental definition of an algorithm in mathematics?
A) A single algebraic equation with multiple unknown variables
B) A step-by-step procedure designed to solve a specific problem
C) A graphical representation of statistical data
D) An unproven mathematical conjecture
Answer: B) A step-by-step procedure designed to solve a specific problem
2. In the column addition algorithm, how does the number of operations scale when moving from a 4-digit number to a 5-digit number?
A) The number of steps increases by a factor of 10
B) The number of steps increases by a factor of 100
C) Only 1 additional column operation is required
D) It doubles the required operations
Answer: C) Only 1 additional column operation is required
3. In Euclid's original subtraction algorithm, finding gcd(m, n) for m >= n is recursively reduced to finding:
A) gcd(m + n, n)
B) gcd(m * n, m - n)
C) gcd(n, m - n)
D) gcd(m / n, 0)
Answer: C) gcd(n, m - n)
4. What mathematical operation makes Aryabhata's GCD algorithm significantly faster than repeated subtraction?
A) Finding square roots
B) Computing division by remainder (modulo operation)
C) Cross-multiplication of prime factors
D) Calculating the arithmetic mean
Answer: B) Computing division by remainder (modulo operation)
5. Historically, the word "algorithm" originated from the Latinized name of which mathematician?
A) Brahmagupta
B) Euclid
C) Al-Khwarizmi
D) Aryabhata
Answer: C) Al-Khwarizmi
An algorithm is a precise, unambiguous sequence of steps to solve a problem.
The place-value addition algorithm requires effort proportional to the number of digits, unlike counting dots which scales with numerical magnitude.
The carry in two-number base-ten addition can only be 0 or 1.
A list is an ordered data structure used to store intermediate values during execution.
Euclid's Subtraction Principle: gcd(m, n) = gcd(n, m - n).
Aryabhata's Modulo Principle: gcd(m, n) = gcd(n, m mod n), matching the traditional long-division method.
The word algorithm traces back to Al-Khwarizmi's 9th-century Latin translation Liber Algorismi, which originally denoted Indian computational arithmetic.
Interactive Quiz:
Chapter Notes:
Full Solutions:
Next Chapter: Quadrilaterals- Class 9 Maths Solutions