ax ≡ b mod m Has A Solution If And Only If (a, m)|b

Let \(g=(a,m)\). If \(ax ≡ b \bmod m\), then:

$$\begin{gather} ax = b + mk \text{ where } k \in \mathbb{Z} \\ ax - mk = b \end{gather}$$

If \(g\) divides \(a\) and \(m\), then it can divide any linear combination. If \(x\) and \(k\) are integers, then \(ax-mk\) is a linear combination of \(a\) and \(m\), which means \(g\) can divide it. In other words, \(g|b\). The contrapositive of this is that if \(g \nmid b\), then \(x\) and \(k\) cannot be integers.

Styles

(uses cookies)