Discrete Mathematics and Graphs · BE5B01DMG · Topic 7 of 12
Congruences, positional systems and Fermat
Reduce arithmetic modulo n, solve linear congruences, and justify exponent reductions.
Key ideas
Congruence classes
a≡b modulo n means n divides a−b. Addition and multiplication preserve congruence. Cancelling a factor c is guaranteed when gcd(c,n)=1; otherwise divide the modulus by gcd(c,n).
Linear equations
ax≡b mod n is equivalent to ax+ny=b. It is solvable iff gcd(a,n) divides b. If d=gcd(a,n), all integer solutions differ by multiples of n/d.
Primes and powers
Every integer greater than 1 has a unique prime factorization. If p is prime and p does not divide a, Fermat gives a^(p−1)≡1. The form a^p≡a also holds when p divides a.
Digit criteria and RSA
Expand a base-b number as a sum of digits times powers of b. Since 2≡−1 mod 3, a binary number is divisible by 3 iff its alternating digit sum is. RSA uses distinct primes p,q and exponents ed≡1 mod (p−1)(q−1).
In one line: Always state the primality or coprimality assumption before using a power theorem.
Formulas
- Congruence classes
- Linear equations
- Primes and powers
- Digit criteria and RSA
Practice with worked solutions
Question 1
In each option the congruence ac≡bc (mod m) is true. In which option may the common factor c be cancelled to conclude a≡b (mod m)?
- a=9, b=2, c=5, m=7 (correct)
- a=7, b=1, c=6, m=12
- a=5, b=11, c=4, m=8
- a=3, b=9, c=10, m=15
Worked solution
Cancellation is guaranteed only when gcd(c,m)=1; otherwise one may only divide the modulus too: ac≡bc (mod m) ⇒ a≡b (mod m/gcd(c,m)).
Question 2
Write 1000 in base 7. Give only the digits, with no base subscript.
Worked solution
Answer: 2626
Divide repeatedly by 7: 1000=142·7+6, 142=20·7+2, 20=2·7+6, 2=0·7+2. The remainders read from last to first are 2,6,2,6. Check: 2·343+6·49+2·7+6=686+294+14+6=1000.
Question 3
Find all solutions of 3x≡6 (mod 12) as a set of representatives in {0,1,…,11}.
Worked solution
Answer: {2,6,10}
Here d=gcd(3,12)=3 divides 6, so there are d=3 solutions modulo 12. One solution is x=2, and all solutions differ by multiples of 12/3=4: x≡2,6,10 (mod 12). Check: 3·2=6, 3·6=18≡6, 3·10=30≡6.
More Discrete Mathematics and Graphs practice in Ucenly
Sources
Written by Ucenly. Based on the BE5B01DMG course materials:
- 3 Number Theory, p. 13, 14, 16, 17
- Midterm 2025 (with solutions), p. 3, 4
- 3 Number Theory - tutorial 2026, p. 6, 9, 13, 14