next up previous
Next: Up: Previous:

Solving Modular Linear Equations

ax $\equiv$ b (mod n)

Given a, b, n > 0; find x.



Let d = gcd(a, n)



Solvable iff d $\mid$ b

Theorem 31.23 If d $\mid$ b and d = ax' + ny' (as computed by Extended-Euclid) then one solution is x0 = x'(b/d) mod n.

Theorem 31.24 Given one solution x0, there are exactly d distinct solutions, modulo n, given by \(x_i \;=\; x_0 \;+\; i(n/d)\)for i = 0, 1, 2, $\ldots$, d-1.


next up previous
Next: Up: Previous: