MTH 114 · Introduction to Sets, Logic and Algebra
Our notes
1 min readPrimes
A prime is an integer p > 1 whose only positive divisors are 1 and p. 1 is not prime. There are infinitely many primes (Euclid: if p₁, ..., pₙ were all of them, p₁p₂...pₙ + 1 would have a prime factor not in the list).
Fundamental theorem of arithmetic: every integer > 1 is a product of primes in exactly one way (apart from order).
Example. 360 = 2³ × 3² × 5. Number of positive divisors: (3 + 1)(2 + 1)(1 + 1) = 24.
To test if n is prime, try primes up to √n: for 221, √221 ≈ 14.9; 221 = 13 × 17, not prime.
Congruence modulo n
a ≡ b (mod n) means n divides a − b (same remainder on division by n). It is an equivalence relation; you can add, subtract and multiply congruences: if a ≡ b and c ≡ d (mod n) then a + c ≡ b + d and ac ≡ bd.
Worked example. Remainder of 2¹⁰ on division by 7. 2³ = 8 ≡ 1 (mod 7), so 2⁹ = (2³)³ ≡ 1 and 2¹⁰ ≡ 2. Check: 1024 = 7 × 146 + 2. ✓
Example (divisibility test). 10 ≡ 1 (mod 9), so every number is congruent to its digit sum mod 9: 4,527 has digit sum 18, so it is divisible by 9.
Linear congruences
ax ≡ b (mod n) has a solution if and only if gcd(a, n) divides b.
Worked example. 3x ≡ 4 (mod 7). gcd(3, 7) = 1. The inverse of 3 mod 7 is 5 (3 × 5 = 15 ≡ 1). Multiply: x ≡ 20 ≡ 6 (mod 7). Check: 3 × 6 = 18 = 14 + 4. ✓
Chinese remainder theorem
If n₁, n₂, ..., nₖ are pairwise coprime, the system x ≡ aᵢ (mod nᵢ) has a unique solution modulo N = n₁n₂...nₖ.
Worked example. x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7). N = 105.
| i | nᵢ | Mᵢ = N/nᵢ | Mᵢ mod nᵢ | inverse yᵢ | aᵢMᵢyᵢ |
|---|---|---|---|---|---|
| 1 | 3 | 35 | 2 | 2 | 2 × 35 × 2 = 140 |
| 2 | 5 | 21 | 1 | 1 | 3 × 21 × 1 = 63 |
| 3 | 7 | 15 | 1 | 1 | 2 × 15 × 1 = 30 |
Sum 233; 233 − 2 × 105 = 23. So x ≡ 23 (mod 105). Check: 23 = 7 × 3 + 2, 23 = 4 × 5 + 3, 23 = 3 × 7 + 2. ✓
Exams usually ask: prime factorise and count divisors; find remainders of large powers; solve a linear congruence; a three-equation Chinese remainder problem.
Common mistake: "dividing" both sides of a congruence by a number. Multiply by an inverse instead, and only when the inverse exists (gcd 1).
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Contemporary Mathematics, 3.1 Prime and Composite Numbers
(opens openstax.org in a new tab)
OpenStax, Contemporary Mathematics, 3.1 Prime and Composite Numbers, CC BY-NC-SA 4.0 · licence
-
Levin, Discrete Mathematics: An Open Introduction, Section 6.2 Introduction to Number Theory
(opens discrete.openmathbooks.org in a new tab)
Levin, Discrete Mathematics: An Open Introduction, Levin, Discrete Mathematics: An Open Introduction, Section 6.2 Introduction to Number Theory, CC BY-NC-SA 4.0 · licence
-
Chinese remainder theorem
(opens en.wikipedia.org in a new tab)
Wikipedia, Chinese remainder theorem, CC BY-SA 4.0 · licence
-
Levin, Discrete Mathematics: An Open Introduction, 4th edition (whole free textbook)
The whole book online with interactive exercises; a free PDF is linked from the front page.
(opens discrete.openmathbooks.org in a new tab)
Levin, Discrete Mathematics: An Open Introduction, Levin, Discrete Mathematics: An Open Introduction, 4th edition (whole free textbook), CC BY-NC-SA 4.0 · licence
-
OpenStax, Contemporary Mathematics (whole free textbook)
The whole book, free to read online or download as a PDF (the PDF is large: Wi-Fi).
(opens openstax.org in a new tab)
OpenStax, OpenStax, Contemporary Mathematics (whole free textbook), CC BY-NC-SA 4.0 · licence
Watch
-
What does a ≡ b (mod n) mean? Basic Modular Arithmetic, Congruence
6 min · ≈ 27 MB · about ₦15
(opens youtube.com in a new tab)
-
Congruences & Modular Arithmetic ← Number Theory
12 min · ≈ 54 MB · about ₦30
(opens youtube.com in a new tab)
-
The Chinese Remainder Theorem (Solved Example 1)
14 min · ≈ 63 MB · about ₦35
(opens youtube.com in a new tab)
-
Solving congruences, 3 introductory examples
4 min · ≈ 18 MB · about ₦10
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.