Skip to content
← All questions

How can I find a modular inverse by hand using the add-the-modulus method?

To find the inverse of a modulo m by hand, start with 1 and repeatedly add the modulus m to generate numbers congruent to 1 modulo m. Stop when you reach a number that is a multiple of a. Factor that number as a times b; then b is the inverse of a modulo m.

Conditions

  • Used to find an inverse of a modulo m.
  • One looks among integers congruent to 1 modulo m for a multiple of a.

Reasoning, step by step

  1. Start with the number 1.
  2. Add the modulus m to get 1+m1+m. Check if it is a multiple of a.
  3. If not, add m again to get 1+2m1+2m. Continue this process.
  4. Stop when you find a number 1+km1+km that is divisible by a.
  5. Factor 1+km1+km as a⋅ba \cdot b.
  6. The integer b is the inverse of a modulo m.

Example

For the inverse of 5 mod 7: Start with 1. Add 7 to get 8 (not a multiple of 5). Add 7 again to get 15. 15 is a multiple of 5 (15=5⋅315 = 5 \cdot 3). So the inverse is 3.

Common misconceptions

  • Thinking you must start with a instead of 1.
  • Forgetting to check if the generated number is actually a multiple of a before factoring.

Watch the explanation

Connected concepts

Explore next

Related questions

Know when to use it

↗
Understand why

↗
Find a method

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.