UNIHIVE

Study Hub UNIPORT MTH 114

MTH 114 · Introduction to Sets, Logic and Algebra

Primes, congruences and the Chinese remainder theorem

Primes and prime factorisation, counting divisors, congruence modulo n and its arithmetic, solving linear congruences, and the Chinese remainder theorem.

Our notes

1 min read

Primes

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.

inᵢMᵢ = N/nᵢMᵢ mod nᵢinverse yᵢaᵢMᵢyᵢ
1335222 × 35 × 2 = 140
2521113 × 21 × 1 = 63
3715112 × 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

Watch

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.

All MTH 114 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.