Example. [00FM]

Solve for x: 3x \equiv _7 5. We can't divide both sides by 3. But the point of dividing by 3 is that 3/3 = 1, so dividing by 3 "cancels" the 3 on the left. But what if we could cancel the 3 by multiplying both sides by something? In particular, could we find some number s such that 3s \equiv _7 1?

There are only a few possible values to try, since e.g. multiplying by 9 or 16 would be the same as multiplying by 2; we only need to try the values from 0 to 6 (and actually, it would be pointless to try 0 or 1). It turns out that 5 works: 3 \cdot 5 = 15 \equiv _7 1. So if we multiply both sides of the equivalence by 5, we get 15x \equiv _7 25, or, reducing modulo 7, x \equiv _7 4.

When will this work in general? And how can we find s besides just trying different values?