-2

Really simple question regarding the Affine Cipher.

Can someone tell me how $3^{-1}$ is supposed to result in 9 in the following explanation below?

enter image description here

e-sushi
  • 17,891
  • 12
  • 83
  • 229

1 Answers1

2

If you want to find the multiplicative inverse of an integer a (mod n) you can use the extended Euclidean algorithm. For two integers a and b, the Extendend Euclidean Algorithm not only calculate the greatest common divisor d but also two integers x and y that satisfy the following equation:

ax + by = d = gcd(a,b) (where gcd is the greatest common divisor)

So if a and b are relatively prime (gcd(a,b)=1), x is the multiplicative inverse of a (mod y), and y is the multiplicative inverse of b (mod x).

Wikipedia seems to provide a good explanation of the algorithm

Hope I was helpful!

ssh3ll
  • 128
  • 8
  • The wikipedia article regarding "Modular multiplicative inverse" helped me to bring some light into the topic - the Euclidean algorithm will be covered later in the book. Thanks anway! – HansMusterWhatElse Mar 10 '16 at 15:47
  • Good!! I thought you wanted to find the multiplicative inverse of an integer (mod n). Was I wrong? – ssh3ll Mar 10 '16 at 17:51