Discrete Structures · Unit 2 · 6 hrs
Integers and Matrices
Exam-focused notes for Integers and Matrices (Discrete Structures, CSC165): what the TU syllabus asks and how it has actually been tested, with 11 solved past questions from this unit.
Integers and Matrices in short
This chapter covers number theory, the branch of discrete mathematics that studies the integers and their properties, and matrices restricted to Boolean values, both of which underpin cryptography, hashing and the internal representation of numbers in a computer.
What this unit covers
- Integers
- Integers and Division
- Primes and Greatest Common Divisor
- Extended Euclidean Algorithm
- Integers and Algorithms
- Applications of Number Theory (Linear Congruencies, Chinese Remainder Theorem, Computer Arithmetic with Large Integers)
- Matrices
- Zero-One Matrices
- Boolean Matrix Operations
Extended Euclidean Algorithm
2081 · 5 marks
Find the GCD of 12 and 16 using Extended Euclidean Algorithm. [5]
Show solved answerHide answer
GCD of 12 and 16 using the Extended Euclidean Algorithm
Given
- $a = 16$, $b = 12$ (arranged so larger is first)
- Goal: find $\gcd(12,16)$ and integers $s, t$ such that $\gcd = s\cdot 12 + t\cdot 16$
Step 2 - Apply the Euclidean Algorithm (Successive Division)
| Step | Division | Equation |
|---|---|---|
| 1 | $16 \div 12$ | $16 = 1 \times 12 + 4$ |
| 2 | $12 \div 4$ | $12 = 3 \times 4 + 0$ |
The last non-zero remainder is $4$.
$$\gcd(12, 16) = 4$$
Step 3 - Back-Substitution (Express as Linear Combination)
From Step 1, isolate the remainder $4$:
$$4 = 16 - 1 \times 12$$
Rewrite explicitly as a linear combination of $12$ and $16$:
$$4 = (-1)\times 12 + (1)\times 16$$
So the coefficients are:
$$s = -1, \qquad t = 1$$
Check
$$s\cdot 12 + t\cdot 16 = (-1)(12) + (1)(16) = -12 + 16 = 4 \ \checkmark$$
Result
| Result | Value |
|---|---|
| $\gcd(12, 16)$ | $4$ |
| Linear combination | $(-1)\times 12 + (1)\times 16 = 4$ |
$$\boxed{\gcd(12, 16) = 4 = (-1)\cdot 12 + (1)\cdot 16}$$
2080 · 5 marks
Find the multiplicative inverse of 4 in $\mathbb{Z}_{11}$ using extended euclidean algorithm. [5]
2079 · 5 marks
Find the GCD of 24 and 32 using Extended Euclidean algorithm. [5]
Show solved answerHide answer
GCD of 24 and 32 Using the Extended Euclidean Algorithm
Given
- $a = 32$, $b = 24$ (arrange larger first)
- Goal: find $\gcd(24, 32)$ and Bezout coefficients $s, t$ such that $\gcd = s \cdot a + t \cdot b$.
Solution
Euclidean Algorithm (successive division)
| Step | Equation | Quotient | Remainder |
|---|---|---|---|
| 1 | $32 = 1 \cdot 24 + 8$ | 1 | 8 |
| 2 | $24 = 3 \cdot 8 + 0$ | 3 | 0 |
The last non-zero remainder is $8$.
$$\gcd(24, 32) = 8$$
Back-Substitution (Extended part)
From Step 1:
$$32 = 1 \cdot 24 + 8$$
Solve for the remainder $8$:
$$8 = 32 - 1 \cdot 24$$
Written as a linear combination:
$$\boxed{8 = (1)\cdot 32 + (-1)\cdot 24}$$
So the Bezout coefficients are $s = 1$ (for 32) and $t = -1$ (for 24).
Verification
$$(1)\cdot 32 + (-1)\cdot 24 = 32 - 24 = 8 \checkmark$$
Final Result
$$\gcd(24, 32) = 8 = (1)\cdot 32 + (-1)\cdot 24$$
Labelling the coefficients by which number they multiply gives $s = -1$ for 24 and $t = 1$ for 32, the same combination: $8 = 32 - 24$. The GCD result of $8$ is unchanged.
Boolean Matrix Operations
2081 · 5 marks
Discuss about meet and join operation between Boolean matrices. What are the values of 5 mod 75 and -5 mod 77? [5]
Applications of Number Theory
2080 · 5 marks
Using Chinese remainder theorem solve the following congruences.x = 1 (MOD 3), x = 3 (MOD 5), x = 6 (MOD 7) [5]
2079 · 5 marks
Use Chinese remainder Theorem to find the value of x such that x = 0 (MOD 2), x = 2 (MOD 3), x = 3 (MOD 5). [5]
2076 · 10 marks
Find the value of x such that x = 1 (mod 3), x = 1 (mod 4), x = 1 (mod 5) and x = 0 (mod 7) using Chinese remainder theorem.[10]
2075 · 5 marks
Find the values of x such that x = 1 (mod 5) and x = 2 (mod 7) using Chinese remainder theorem. [5]
Integers and Division
2079 · 5 marks
Find the value of $-2 \bmod 3$ and $3153^{15} \bmod 5$. Illustrate an example to show the join operation between any two Boolean matrices. [5]
2080.1 · 5 marks
What is congruent modulo? Determine whether 37 is congruent to 3 modulo 7 and whether -29 is congruent to 5 modulo 17. [5]
Show solved answerHide answer
Congruent Modulo: Definition and Examples
Given Data
- Check 1: Is $37 \equiv 3 \pmod{7}$?
- Check 2: Is $-29 \equiv 5 \pmod{17}$?
STEP 1 - Definition
If $a$ and $b$ are integers and $m$ is a positive integer, then $a$ is congruent to $b$ modulo $m$ if $m$ divides $(a - b)$.
Notation: $$a \equiv b \pmod{m}$$
If they are not congruent, we write $a \not\equiv b \pmod{m}$.
Equivalent test: $a \equiv b \pmod{m}$ if and only if $a \bmod m = b \bmod m$.
Solution
Part 1: Is $37 \equiv 3 \pmod 7$?
Check if $7 \mid (37 - 3)$: $$37 - 3 = 34$$ $$34 = 7 \times 4 + 6$$
Since $7$ does not divide $34$ (remainder $6 \neq 0$): $$\boxed{37 \not\equiv 3 \pmod{7}}$$
Verification:
- $37 \bmod 7 = 2$ (since $37 = 7 \times 5 + 2$)
- $3 \bmod 7 = 3$
- $2 \neq 3$, confirmed NOT congruent.
Note: the difference method gives the correct result, and the check $37 \bmod 7 = 2$ confirms it. (The remainder of $34 \div 7$ is $6$.)
Part 2: Is $-29 \equiv 5 \pmod{17}$?
Check if $17 \mid (-29 - 5)$: $$-29 - 5 = -34$$ $$-34 = 17 \times (-2) + 0$$
Since $17$ divides $-34$ exactly: $$\boxed{-29 \equiv 5 \pmod{17}}$$
Verification:
- $-29 = 17 \times (-2) + 5 \Rightarrow -29 \bmod 17 = 5$
- $5 \bmod 17 = 5$
- $5 = 5$, confirmed congruent.
Summary
| Check | Difference | Divisible by $m$? | Result |
|---|---|---|---|
| $37 \equiv 3 \pmod 7$ | $34$ | No ($34 = 7\cdot4+6$) | $37 \not\equiv 3 \pmod 7$ |
| $-29 \equiv 5 \pmod{17}$ | $-34$ | Yes ($-34 = 17\cdot(-2)$) | $-29 \equiv 5 \pmod{17}$ |
Zero-One Matrices
2078 · 5 marks
Define zero-one matrix. Explain the types of function. [5]
Make Unit 2 stick
Practice CSC165 with flashcards & quizzes