Solving Linear Congruences and Fermat's Little Theorem | OCR B (MEI) A Level Further Maths notes

Free preview: Solving Linear Congruences and Fermat's Little Theorem

Solving Linear Congruences ax ≡ b (mod n)

Year 1 (AS) for OCR A for linear congruences (8.02, in the AS Additional Pure list); for Fermat's little theorem, check your own specification. Edexcel: Further Pure 2 (FP2 5.1 to 5.7). OCR B (MEI): Further Pure with Technology (Y436).

In ordinary algebra, 7x = 3 is easy: divide by 7. But in modular arithmetic there are no fractions. So how do we solve 7x≡3(mod26)? We want every integer x that makes 7x leave remainder 3 on division by 26.

The coprime case: multiply by the inverse

  1. Check hcf(a, n) = 1. Why: then a has an inverse mod n.
  2. Find a−1 mod n (Euclid and back-substitution, or trial for small n). Why: multiplying by the inverse is how we "divide".
  3. Multiply both sides by a−1 and reduce. Why: a−1a≡1, so x is left on its own.
  4. Check by substituting.

👀 Watch me do it: solve 7x≡3(mod26)

What I writeWhy I do it
hcf(7, 26) = 1.26 = 2 × 13 and 7 shares no factor, so an inverse exists.
7−1≡15(mod26)From the previous note: 7×15=105=4×26+1.
x≡15×3=45≡19(mod26)Multiply both sides by 15, then reduce 45 − 26 = 19.
Check: 7×19=133=5×26+3.Correct.
x = 19, 45, 71, ... and −7, ...The solution is a whole class: all are "x≡19".

✏️ YOUR TURN 1

Try this first:

Solve 5x≡4(mod13).

Answer:

  • Inverse of 5 mod 13: try multiples of 5 until one is 1 more than a multiple of 13: 5×8=40=39+1. So 5−1≡8.
  • x≡8×4=32≡6(mod13).
  • Check: 5×6=30=26+4.

✏️ YOUR TURN 2

Try this first:

Solve 11x≡5(mod26). Find the inverse of 11 using Euclid's algorithm and back-substitution.

Answer:

  • Euclid: 26=2×11+4, 11=2×4+3, 4=1×3+1. So hcf = 1 and an inverse exists.
  • Back-substitute: 1=4−3=4−(11−2×4)=3×4−11=3(26−2×11)−11=3×26−7×11.
  • So −7×11≡1 and 11−1≡−7≡19(mod26).
  • x≡19×5=95=3×26+17, so x≡17(mod26). Check: 11×17=187=7×26+5.

How many solutions?

ax≡b(modn) has solutions⟺d=hcf(a,n) divides b; then there are exactly d solutions mod n

💡 In plain words

  • If a and n are coprime (d = 1): exactly one answer mod n.
  • If d divides b: d answers mod n, spaced n/d apart.
  • If d does not divide b: no answers at all.
  • Why? ax≡b means ax−ny=b for some integer y. From the previous note, that has integer solutions exactly when hcf(a, n) divides b.

When a and n Share a Factor

The method

  1. Find d = hcf(a, n). If d∤b, stop: no solutions. Why: ax − ny is always a multiple of d.
  2. Divide a, b and n all by d: a′x≡b′(modn′), where now hcf(a', n') = 1. Why: dividing the modulus too is the safe way to divide (the trap from the last note).
  3. Find the inverse of a' mod n' and multiply: x≡x0(modn′).
  4. List the d answers mod n: x0, x0+n′, x0+2n′, …. Why: the question is mod n, and each step of n' is a different residue mod n.

👀 Watch me do it: solve 6x≡4(mod10)

What I writeWhy I do it
d = hcf(6, 10) = 2, and 2 divides 4.So there are 2 solutions mod 10.
3x≡2(mod5)Divide a, b and n by 2.
3−1≡2(mod5)Because 3×2=6≡1.
x≡2×2=4(mod5)Multiply by the inverse.
x≡4 or x≡9(mod10)Add n' = 5 once to get the second answer below 10.
Check: 6×4=24≡4, 6×9=54≡4.Both correct.

Diagram: Each dot shows 6x 10 for one value of x from 0 to 9.

What the picture shows

  • Each dot shows 6xmod10 for one value of x from 0 to 9.
  • The orange line is 4. It meets the dots at x = 4 and x = 9 (green): the two solutions mod 10.
  • They are 5 apart, because nd=102=5 and 6×5=30≡0.
  • Every value of 6x mod 10 is even, so an odd right-hand side such as 3 would never be hit: no solutions.
  • By contrast 4x≡3(mod6) has no solutions: d = 2 and 2 does not divide 3 (4x − 3 is odd, and multiples of 6 are even).

📝 Here's the trap

  • Right: 6x≡4(mod10)⇒3x≡2(mod5), then two answers mod 10.
  • Wrong: 3x≡2(mod10) (forgetting to divide the modulus), or giving only x = 4.
  • Always end by listing every answer in the range the question asks for.

Unlock the full note: start 7 days free.

Log in or subscribe to read the rest of this note. Members also get the AI tutor, practice quizzes, mock exams and flashcards for this topic.

Log in · Subscribe · Start free trial

All notes in Number Theory

  1. The Division Algorithm, Euclid's Algorithm and Bézout's Identity
  2. Modular Arithmetic, Number Bases and Divisibility Tests
  3. Solving Linear Congruences and Fermat's Little Theorem

What's inside for this topic

3 teacher notes, 95 practice questions, 40 flashcards, 2 quizzes.

Get the full notes, every practice question, flashcards, quizzes and mock papers.

Start your free 7-day trial

Questions? Chat with us on WhatsApp · Try one live lesson

Previous note: Modular Arithmetic, Number Bases and Divisibility Tests

Solving Linear Congruences and Fermat's Little Theorem on other exam boards

All OCR B (MEI) A Level Further Maths topics · A Level Further Maths