Anyone know modular (modulus) arithmetic?

Avalon

Diamond Member
Jul 16, 2001
7,571
178
106
So I had trouble with a homework problem a week ago, and my professor gave me the solution to it for study purposes...however, this also confuses me. Here's the little problem.

Find the modular inverse of f(x) = 17x + 4

f(x) = 17x + 4 (mod 26), so we can set up solving for the inverse function as follows:

x = 17f-1(x) +4 (mod 26)
23*17f-1(x) = 23*(x ? 4) (mod 26), because 17-1 = 23 (mod 26)
f-1(x) = 23*(x ? 4) (mod 26)
f-1(x) = 23x ? 92 (mod 26)
f-1(x) = 23x + 12 (mod 26)

Now, I understand that in mod26, every number 0-25 has a modular inverse...wish I had the list. Apparently 17 and 23 are modular inverses, as shown in this solution. So I understand that. And I understand how he multiplied the function by 23 to cancel out the 17 and get f-1(x) by itself. Finally understood all of this, except how he got from the second to last line to the last line. Why did the -92 turn into +12?
 

chuckywang

Lifer
Jan 12, 2004
20,133
1
0
-92 (mod 26) = -92+4*26 (mod 26) = 12 (mod 26)

And BTW, not every number 0-25 has an inverse mod 26. For example, 13 has no inverse mod 26.
 

Avalon

Diamond Member
Jul 16, 2001
7,571
178
106
Oh, so you just multiply it by a multiple of 26 until you reach a positive number?
 

chuckywang

Lifer
Jan 12, 2004
20,133
1
0
Originally posted by: Avalon
Oh, so you just multiply it by a multiple of 26 until you reach a positive number?

Yep, pretty much. 26 = 0 mod 26 obviously, so you can add/subtract as many 26's as you want without affecting the equality.
 

Avalon

Diamond Member
Jul 16, 2001
7,571
178
106
Awesome. I'm looking back at my old homework stuff and my notes from class that day and all the problems make perfect sense now. Thanks a ton!