Discrete Structure · Unit 6
Number Theory and Modular Arithmetic
Exam-focused notes for Number Theory and Modular Arithmetic (Discrete Structure, BIT152): what the TU syllabus asks and how it has actually been tested, with 9 solved past questions from this unit.
Number Theory and Modular Arithmetic in short
Number theory studies the properties of integers. Its ideas, such as gcd, modular arithmetic and primes, are the base of hashing, check digits and modern encryption.
What this unit covers
- Divisibility and division algorithm
- Greatest common divisor
- Euclidean algorithm
- Extended Euclidean algorithm
- Congruence modulo
- Arithmetic modulo m
- Multiplicative inverse
- Chinese Remainder Theorem
- Prime numbers and trial division
Chinese Remainder Theorem
2082 · 10 marks
State division theory.Add two integers 13578 and 45730 using Chinese Remainder Theorem.[2+8]
Show solved answerHide answer
Division Theory and Chinese Remainder Theorem
Part 1: Division Theory (2 marks)
Division Algorithm (Division Theory):
For any integer $a$ and any positive integer $n$, there exist unique integers $q$ (quotient) and $r$ (remainder) such that:
$$a = q \cdot n + r, \qquad 0 \leq r < n$$
where $q = \lfloor a/n \rfloor$ and $r = a \bmod n$.
Part 2: Adding 13578 + 45730 using CRT (8 marks)
The idea of CRT-based arithmetic: pick pairwise coprime moduli whose product exceeds the answer, reduce each operand mod each modulus, add residue-wise, then reconstruct.
Step 1: Choose pairwise coprime moduli
Expected result: $$13578 + 45730 = 59308$$
Choose: $$m_1 = 99,\quad m_2 = 98,\quad m_3 = 97,\quad m_4 = 95$$
These are pairwise coprime, and $$M = 99 \times 98 \times 97 \times 95 = 89{,}403{,}930 \gg 59308 \checkmark$$
Step 2: Residue representation
For $a = 13578$:
- $99 \times 137 = 13563 \Rightarrow 13578 - 13563 = 15$
- $98 \times 138 = 13524 \Rightarrow 13578 - 13524 = 54$
- $97 \times 139 = 13483 \Rightarrow 13578 - 13483 = 95$
- $95 \times 142 = 13490 \Rightarrow 13578 - 13490 = 88$
$$a \to (15,\ 54,\ 95,\ 88)$$
For $b = 45730$:
- $99 \times 461 = 45639 \Rightarrow 45730 - 45639 = 91$
- $98 \times 466 = 45668 \Rightarrow 45730 - 45668 = 62$
- $97 \times 471 = 45687 \Rightarrow 45730 - 45687 = 43$
- $95 \times 481 = 45695 \Rightarrow 45730 - 45695 = 35$
$$b \to (91,\ 62,\ 43,\ 35)$$
(Note: $45730 \bmod 99 = 91$.)
Step 3: Add residues modulo each $m_i$
$$r_i = (a_i + b_i) \bmod m_i$$
| Modulus | $a_i + b_i$ | $r_i$ |
|---|---|---|
| $99$ | $15 + 91 = 106$ | $106 - 99 = \mathbf{7}$ |
| $98$ | $54 + 62 = 116$ | $116 - 98 = \mathbf{18}$ |
| $97$ | $95 + 43 = 138$ | $138 - 97 = \mathbf{41}$ |
| $95$ | $88 + 35 = 123$ | $123 - 95 = \mathbf{28}$ |
So the sum $X$ satisfies: $$X \equiv 7 \pmod{99},\quad X \equiv 18 \pmod{98},\quad X \equiv 41 \pmod{97},\quad X \equiv 28 \pmod{95}$$
Step 4: Verify against 59308
- $99 \times 599 = 59301 \Rightarrow 59308 - 59301 = 7$ ✓
- $98 \times 605 = 59290 \Rightarrow 59308 - 59290 = 18$ ✓
- $97 \times 611 = 59267 \Rightarrow 59308 - 59267 = 41$ ✓
- $95 \times 624 = 59280 \Rightarrow 59308 - 59280 = 28$ ✓
All four residues match, confirming the reconstructed value.
Final Answer
$$\boxed{13578 + 45730 = 59308}$$
represented in CRT residue form as $(7,\ 18,\ 41,\ 28)$ with respect to moduli $(99, 98, 97, 95)$.
2080 · 5 marks
Solve the system of following congruences using Chinese Remainder theorem: x = 2 (mod 3), x = 3 (mod 5), x = 2 (mod 7) [5]
2080.1 · 5 marks
How do you solve computer arithmetic with large integers using Chinese remainder theorem? Give an example. [5]
Extended Euclidean algorithm
2081 · 5 marks
Find the multiplicative inverse of 6 in $\mathbb{Z}_{25}$ using Extended Euclidean Algorithm. [5]
Arithmetic modulo m
2081 · 5 marks
Compute the value of $8 \text{ MOD } 8$, $-9 \text{ MOD } 4$, $7 \text{ MOD } 17$, $6 \text{ MOD } 7$ and $-8 \text{ MOD } 3$. [5]
2079 · 5 marks
What is arithmetic modulo $m$? Use the definition of addition and multiplication in $\mathbb{Z}m$ to find $7 +{11} 9$ and $7 *_{11} 9$. [5]
Show solved answerHide answer
Given
Given data:
- Modulus: $m = 11$
- Set: $\mathbb{Z}_{11} = {0, 1, 2, \ldots, 10}$
- Compute $7 +_{11} 9$
- Compute $7 *_{11} 9$
All required data present.
Solution
Arithmetic Modulo m
Arithmetic modulo m is arithmetic carried out on the finite set
$$\mathbb{Z}_m = {0, 1, 2, \ldots, m-1}$$
where every result of addition or multiplication is replaced by its remainder upon division by $m$. This keeps all results within the set $\mathbb{Z}_m$ (closure).
Addition in $\mathbb{Z}_m$: $$a +_m b = (a + b) \bmod m$$
Multiplication in $\mathbb{Z}_m$: $$a *_m b = (a \cdot b) \bmod m$$
Compute $7 +_{11} 9$
$$7 +_{11} 9 = (7 + 9) \bmod 11 = 16 \bmod 11$$
Since $16 = 1 \times 11 + 5$:
$$7 +_{11} 9 = 5$$
Compute $7 *_{11} 9$
$$7 *_{11} 9 = (7 \times 9) \bmod 11 = 63 \bmod 11$$
Since $63 = 5 \times 11 + 8$:
$$7 *_{11} 9 = 8$$
Summary
| Operation | Ordinary result | $\bmod 11$ | Answer |
|---|---|---|---|
| $7 +_{11} 9$ | $16$ | $16 \bmod 11$ | $\mathbf{5}$ |
| $7 *_{11} 9$ | $63$ | $63 \bmod 11$ | $\mathbf{8}$ |
Congruence modulo
2078 · 5 marks
What is congruent modulo? Determine whether 20 is congruent to 8 modulo 6 and 25 is congruent to 17 modulo 5. [5]
Prime numbers and trial division
2078 · 5 marks
Explain trial division with example? Using trial division, show that 101 is prime. [5]
Euclidean algorithm
0 · 5 marks
Explain Euclidean algorithm. Use Euclidean algorithm to find the greatest common divisor of 414 and 662. [5]
Make Unit 6 stick
Practice BIT152 with flashcards & quizzes