UcenlyOpen in the app

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.

Open the interactive lesson

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

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)?

  1. a=9, b=2, c=5, m=7 (correct)
  2. a=7, b=1, c=6, m=12
  3. a=5, b=11, c=4, m=8
  4. a=3, b=9, c=10, m=15
Worked solution
  1. ac≡bc ∧ gcd⁡(c,m)=1⇒a≡b(modm)ac\equiv bc\ \wedge\ \gcd(c,m)=1\Rightarrow a\equiv b\pmod m
  2. ac≡bc(modm)⇒a≡b(modm/gcd⁡(c,m))ac\equiv bc\pmod m\Rightarrow a\equiv b\pmod{m/\gcd(c,m)}

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

  1. 1000=142⋅7+6, 142=20⋅7+2, 20=2⋅7+6, 2=0⋅7+21000=142\cdot7+6,\ 142=20\cdot7+2,\ 20=2\cdot7+6,\ 2=0\cdot7+2
  2. 1000=(2626)71000=(2626)_7

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}

  1. d=gcd⁡(3,12)=3∣6⇒3 solutions mod 12d=\gcd(3,12)=3\mid6\Rightarrow3\text{ solutions mod }12
  2. x=2+4t ⇒ x≡2,6,10(mod12)x=2+4t\ \Rightarrow\ x\equiv2,6,10\pmod{12}

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: