Inverse of b mod n: Find, Steps, Examples

  • Thread starter LordCalculus
  • Start date
  • Tags
    Inverse
In summary, to find the inverse of b modulo n, you must first solve the equation b*x == 1 (mod n), where x is the inverse. This can be done by using the extended Euclidean algorithm and finding two coefficients that solve a linear expression. The GCD of the two numbers must be 1 for the inverse to exist. You can also refer to online resources for more information and examples.
  • #1
LordCalculus
12
0
What's the basic procedure in finding the inverse of b modulo n? What are the steps? Say, for example, the inverse of 5 modulo 7.
 
Physics news on Phys.org
  • #2
Hi,
in your example, you look for the value of x in the equation
5x == 1 (mod 7)
The definition of congruence tells you that 5x-1 must be a multiple of 7. That is,
5x - 1 = 7y
for some integer y. Then
5x - 7y = 1
and you look for integer values of x and y that satisfy this equation; you can throw away the y, and the x is your inverse.

The inverse will exist in your example because 5 and 7 are coprime. This is a general rule: the GCD of the two numbers must be 1. In the last equation, if 5 and 7 had a common factor, then the right-hand side (which is just 1) would have to have that factor too!

To solve this equation, the keyword you have to google for is "extended Euclidean algorithm". The Wikipedia page has all the information, but is not necessarily the clearest explanation. Here are two very simple examples,
http://www.mast.queensu.ca/~math418/m418oh/m418oh04.pdf
In these examples the GCD of the two numbers is not 1, but the method is the same: you obtain two coefficients that solve a linear expression, as in the last equation above.

Hope this helps --

P.S.: Forum admins... is there something wrong with the LaTeX feature? All equations would just show as repetitions of the first one (as if the produced images were going to the same rewritten file, if you wish).
 

FAQ: Inverse of b mod n: Find, Steps, Examples

What is the inverse of b mod n?

The inverse of b mod n is the number that, when multiplied by b and then divided by n, results in a remainder of 1.

Why is finding the inverse of b mod n important?

Finding the inverse of b mod n is important in many areas of mathematics and computer science, such as cryptography and modular arithmetic. It allows us to solve equations involving modular arithmetic and to encrypt and decrypt messages using modular arithmetic operations.

What are the steps to find the inverse of b mod n?

The steps to find the inverse of b mod n are as follows:

  1. Using the extended Euclidean algorithm, find the greatest common divisor (GCD) of b and n.
  2. If the GCD is not equal to 1, then the inverse does not exist.
  3. If the GCD is equal to 1, use the extended Euclidean algorithm to find the coefficients of b and n that satisfy the equation bx + ny = 1.
  4. The coefficient of b is the inverse of b mod n.

Can you provide an example of finding the inverse of b mod n?

Sure, let's say we want to find the inverse of 5 mod 11. First, we use the extended Euclidean algorithm to find the GCD of 5 and 11, which is 1. Then, we use the algorithm to find the coefficients of 5 and 11 that satisfy the equation 5x + 11y = 1. We get x = 9 and y = -4, so the inverse of 5 mod 11 is 9.

Are there any special cases to consider when finding the inverse of b mod n?

Yes, there are a few special cases to consider:

  • If n is not a prime number, then the inverse of b mod n may not exist.
  • If b and n are not relatively prime (i.e. their GCD is not equal to 1), then the inverse of b mod n does not exist.
  • If b is negative, we can find the inverse of b mod n by first finding the inverse of its absolute value and then multiplying it by -1.
Back
Top