NCERT Solutions for Class 9 Maths Chapter 11 — End-of-Chapter Exercises#

Improved Euclid (Āryabhaṭa’s division) algorithm for gcd(m, n):

  1. If $m < n$, reverse the numbers and compute gcd(n, m).
  2. If $n = 0$, report the answer as $m$.
  3. Otherwise, reduce the problem to computing gcd(n, m mod n), where m mod n is the remainder when $m$ is divided by $n$.

1. Compute the following using the improved version of Euclid’s algorithm. #

Each row divides the larger number by the smaller; the next row uses the divisor and the remainder.

(i) gcd(375, 825)
Problem Division Remainder
gcd(825, 375) $825 = 2 \times 375 + 75$ 75
gcd(375, 75) $375 = 5 \times 75 + 0$ 0
gcd(75, 0) stop —

∴ gcd(375, 825) = 75.

(ii) gcd(51000, 81000)
Problem Division Remainder
gcd(81000, 51000) $81000 = 1 \times 51000 + 30000$ 30000
gcd(51000, 30000) $51000 = 1 \times 30000 + 21000$ 21000
gcd(30000, 21000) $30000 = 1 \times 21000 + 9000$ 9000
gcd(21000, 9000) $21000 = 2 \times 9000 + 3000$ 3000
gcd(9000, 3000) $9000 = 3 \times 3000 + 0$ 0
gcd(3000, 0) stop —

∴ gcd(51000, 81000) = 3000.

(iii) gcd(1789287, 237656)
Problem Division Remainder
gcd(1789287, 237656) $1789287 = 7 \times 237656 + 125695$ 125695
gcd(237656, 125695) $237656 = 1 \times 125695 + 111961$ 111961
gcd(125695, 111961) $125695 = 1 \times 111961 + 13734$ 13734
gcd(111961, 13734) $111961 = 8 \times 13734 + 2089$ 2089
gcd(13734, 2089) $13734 = 6 \times 2089 + 1200$ 1200
gcd(2089, 1200) $2089 = 1 \times 1200 + 889$ 889
gcd(1200, 889) $1200 = 1 \times 889 + 311$ 311
gcd(889, 311) $889 = 2 \times 311 + 267$ 267
gcd(311, 267) $311 = 1 \times 267 + 44$ 44
gcd(267, 44) $267 = 6 \times 44 + 3$ 3
gcd(44, 3) $44 = 14 \times 3 + 2$ 2
gcd(3, 2) $3 = 1 \times 2 + 1$ 1
gcd(2, 1) $2 = 2 \times 1 + 0$ 0
gcd(1, 0) stop —

∴ gcd(1789287, 237656) = 1 — the two numbers have no common factor other than 1.

(iv) gcd(2587392, 157656)
Problem Division Remainder
gcd(2587392, 157656) $2587392 = 16 \times 157656 + 64896$ 64896
gcd(157656, 64896) $157656 = 2 \times 64896 + 27864$ 27864
gcd(64896, 27864) $64896 = 2 \times 27864 + 9168$ 9168
gcd(27864, 9168) $27864 = 3 \times 9168 + 360$ 360
gcd(9168, 360) $9168 = 25 \times 360 + 168$ 168
gcd(360, 168) $360 = 2 \times 168 + 24$ 24
gcd(168, 24) $168 = 7 \times 24 + 0$ 0
gcd(24, 0) stop —

∴ gcd(2587392, 157656) = 24.

2. Assume that m ≥ n. Verify that d divides m and n if and only if d divides both n and m mod n. #

Solution

Divide $m$ by $n$: $m = qn + r$, where $q$ is the quotient and $r = m \bmod n$ is the remainder.

If $d$ divides $m$ and $n$: write $m = ad$ and $n = bd$. Then:

$$r = m - qn$$

$$r = ad - qbd$$

$$r = (a - qb)d$$

So $d$ divides $r = m \bmod n$ (and of course $d$ divides $n$).

If $d$ divides $n$ and $r$: write $n = xd$ and $r = yd$. Then:

$$m = qn + r$$

$$m = qxd + yd$$

$$m = (qx + y)d$$

So $d$ divides $m$ (and $n$).

∴ $d$ divides both $m$ and $n$ if and only if it divides both $n$ and $m \bmod n$. The two pairs have exactly the same common divisors, so $\text{gcd}(m, n) = \text{gcd}(n, m \bmod n)$. This justifies Step 3 of the algorithm.

3. Write an algorithm prime(n) to check if n is prime. (Hint: A prime number p has exactly two distinct factors, 1 and p. Can you make use of divisors(n) to write out prime(n)?) #

Algorithm prime(n)
  1. Let list-of-divisors be the list obtained by computing divisors(n).
  2. If list-of-divisors has exactly 2 elements, report “n is prime”.
  3. Otherwise, report “n is not prime”.

Why it works: a prime has exactly two divisors, 1 and itself. The number 1 has only one divisor, and a composite number has three or more — so both are correctly reported as not prime.

Examples: divisors(13) = [1, 13] → prime. divisors(15) = [1, 3, 5, 15] → not prime. divisors(1) = [1] → not prime.

(Faster version: check $j$ from 2 up to $\sqrt{n}$; if any $j$ divides $n$, report “not prime”; if none does and $n > 1$, report “prime”.)

*4. Write an algorithm primedivisors(n) to compute the list of divisors of n that are prime numbers. (Hint: Compute divisors(n) and then filter out the primes in this list.) #

Algorithm primedivisors(n)
  1. Let list-of-divisors be the list obtained by computing divisors(n).
  2. Start with an empty list prime-divisors.
  3. For each number $d$ in list-of-divisors:
    • if prime(d) reports “d is prime”, add $d$ to prime-divisors.
  4. Report prime-divisors.

Example: divisors(60) = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60]. Keeping only the primes gives primedivisors(60) = [2, 3, 5].

*5. We can also find the gcd of two numbers by computing prime factorisation of both the numbers. Try to write an algorithm to compute the prime factorisation of a number. #

Algorithm primefactorisation(n)
  1. Let primes be the list obtained by computing primedivisors(n).
  2. Start with an empty list factorisation, and let $r = n$.
  3. For each prime $p$ in primes:
    • set count to 0;
    • while $p$ divides $r$: divide $r$ by $p$ and add 1 to count;
    • add the pair (p, count) to factorisation.
  4. Report factorisation.

Example: $n = 180$. primedivisors(180) = [2, 3, 5]. Dividing 180 by 2 twice gives 45 (count 2); 45 by 3 twice gives 5 (count 2); 5 by 5 once gives 1 (count 1). So factorisation = [(2, 2), (3, 2), (5, 1)].

(i) The prime factorisation of 180 is 2² × 3² × 5¹. How would you represent this?

As a list of pairs (prime, power), with the primes in increasing order:

$$[(2, 2),\ (3, 2),\ (5, 1)]$$

Each pair says which prime appears and how many times.

(ii) How would you compare the prime factorisations of two numbers?

To find the gcd, go through the primes that appear in both lists; for each such prime, take the smaller of its two powers. Multiply these together. (Primes that appear in only one list do not contribute.)

Example: $180 = [(2, 2), (3, 2), (5, 1)]$ and $168 = [(2, 3), (3, 1), (7, 1)]$. The common primes are 2 and 3, with smaller powers 2 and 1:

$$\text{gcd}(180, 168) = 2^2 \times 3^1 = 12$$

(Taking the larger power of every prime that appears in either list gives the lcm instead.) Because both lists are in increasing order of primes, they can be compared by walking through them together, as in Exercise Set 11.2, Question 1.