Congruence Inverses modulo m When solving equations on the reals (or rationals), we make use of multiplicative inverses; solving 4x = 8 by dividing both sides by 4 is equivalent to solving by multiplying both sides by 41 : 1 · (4x) 1 ·4 x 4 1x x 4 = = = = 1 4 ·8 2 2 2 4 and 14 are multiplicative inverses: their product is 1, the multiplicative identity. Since all real numbers other than 0 have multiplicative inverses, we can solve 7x = 8 as easily as 4x = 8, and we all know the answer is x = 87 . If we restrict ourselves to the integers, then we do not have multiplicative inverses for any integers other than 1 and −1. There is no integer x such that 2x = 1 This doesn’t make it impossible to solve equations on the integers - there is a cancellation rule that if rx = ry, then x = y. On the integers, we can solve 4x = 8 4x = 4 · 2 x = 2 ...but not 7x = 8, since 7 is not a factor of 8. Working on the integers, we can generalize that (1) sometimes we can solve linear equations in the form ax = b (when a|b), and (2) we can almost never solve ax = 1, except when a = ±1. How does this carry over to linear congruences? Multiplicative inverses modulo m We call x a multiplicative inverse of a modulo m if it is a solution to ax ≡ 1 (mod m) This is analogous to multiplicative inverses on the reals with equality: x = a−1 iff ax = a(a−1 ) = 1. Here, we have x = a−1 iff ax = a(a−1 ) ≡ 1 (mod m) Example: x = 2 is a multiplicative inverse of a = 5, modulo 3, because 2 · 5 = 10, and 10 ≡ 1 (mod 3). Note than when we’re working with linear congruences, we say *an* inverse, not *the* inverse there’s more than one. x = 5 is also an inverse of a = 5, modulo 3, since 5 · 5 = 25 ≡ 1 (mod 3). All members of the congruence class [2]3 are inverses here. Existence of inverses We already know under what conditions an integer will have an inverse, because we already know under what conditions ax ≡ 1 (mod m) will have a solution. Recall: Proposition: ax ≡ b (mod m) has a solution if and only if gcd(a, m) divides b. Since b = 1, a will have an inverse iff gcd(a, m) divides 1; i.e. iff a and m are relatively prime. Example: In a modulo 6 system, all the integers sort into one of [0]6 , [1]6 , [2]6 , [3]6 , [4]6 , [5]6 , so, using their principal representatives, there are really only 6 possible values we need to consider: which of a = 0, 1, 2, 3, 4, 5, 6 have multiplicative inverses modulo 6, and which don’t? Finding inverses Nothing new here; “find an inverse of a modulo m” translates to “solve ax ≡ 1 (mod m), and at that point you’re just back to congruence solving. Previous results about solutions apply: if a solution exists, it will consist of one equivalence class, since in order for a solution to exist, gcd(a, m) must equal 1. Example: Find multiplicative inverses of 1 modulo 6 and 5 modulo 6. Example: • Which of 0, 1, 2, 3, 4, 5, 6 have multiplicative inverses modulo 7? • Find inverses for all the elements that have them. Using inverses to solve congruences As with linear equations, we can use multiplicative inverses to solve linear congruences by multiplying both sides. Example: Solve 33x ≡ 7 (mod 5) by • First finding a multiplicative inverse of 33 modulo 5 (solve 33x ≡ 1 (mod 5)) • And then multiplying both sides of the original congruence by that value and reducing mod 5 as needed. Downsides While we regularly use multiplicative inverses to solve equations on the reals, they have some limitations for solving linear congruences: • It may be easier to just solve the congruence outright rather than breaking the process down into two steps: 33x ≡ 7 (mod 5) 3x ≡ 7 (mod 5) [since 33 mod 5 = 3 ] 3x ≡ 2 (mod 5) [since 7 mod 5 = 2 ] 3x ≡ 12 (mod 5) [since 12 mod 5 = 2 ] x ≡ 4 (mod 5) gets you the solution to the last example directly. • It’s possible to have a solution to a particular congruence without having an inverse. Example Solve 2x ≡ 6 (mod 8) However, does 2 have an inverse modulo 8?