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 ? We want every integer x that makes 7x leave remainder 3 on division by 26.
The coprime case: multiply by the inverse
- Check hcf(a, n) = 1. Why: then a has an inverse mod n.
- Find mod n (Euclid and back-substitution, or trial for small n). Why: multiplying by the inverse is how we "divide".
- Multiply both sides by and reduce. Why: , so x is left on its own.
- Check by substituting.
👀 Watch me do it: solve
| What I write | Why I do it |
|---|---|
| hcf(7, 26) = 1. | 26 = 2 × 13 and 7 shares no factor, so an inverse exists. |
| From the previous note: . | |
| Multiply both sides by 15, then reduce 45 − 26 = 19. | |
| Check: . | Correct. |
| x = 19, 45, 71, ... and −7, ... | The solution is a whole class: all are "". |
✏️ YOUR TURN 1
Try this first:
Solve .
Answer:
- Inverse of 5 mod 13: try multiples of 5 until one is 1 more than a multiple of 13: . So .
- .
- Check: .
✏️ YOUR TURN 2
Try this first:
Solve . Find the inverse of 11 using Euclid's algorithm and back-substitution.
Answer:
- Euclid: , , . So hcf = 1 and an inverse exists.
- Back-substitute: .
- So and .
- , so . Check: .
How many solutions?
💡 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 apart.
- If d does not divide b: no answers at all.
- Why? means 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
- Find d = hcf(a, n). If , stop: no solutions. Why: ax − ny is always a multiple of d.
- Divide a, b and n all by d: , where now hcf(a', n') = 1. Why: dividing the modulus too is the safe way to divide (the trap from the last note).
- Find the inverse of a' mod n' and multiply: .
- List the d answers mod n: . Why: the question is mod n, and each step of n' is a different residue mod n.
👀 Watch me do it: solve
| What I write | Why I do it |
|---|---|
| d = hcf(6, 10) = 2, and 2 divides 4. | So there are 2 solutions mod 10. |
| Divide a, b and n by 2. | |
| Because . | |
| Multiply by the inverse. | |
| or | Add n' = 5 once to get the second answer below 10. |
| Check: . | Both correct. |

What the picture shows
- Each dot shows 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 and .
- 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 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: , then two answers mod 10.
- Wrong: (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.
All notes in Number Theory
- The Division Algorithm, Euclid's Algorithm and Bézout's Identity
- Modular Arithmetic, Number Bases and Divisibility Tests
- 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.
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