0

Let $a$, $b$ be integers, and let $p$ be a prime not dividing $a$. Show that the only solution of the congruence equation $ax \equiv b\pmod{p}$ is $x \equiv a^{p-2}b\pmod{p}$

I've shown that this is a solution to the congruence equation, but how do I show that it is the only solution to the equation.

Bill Dubuque
  • 272,048

2 Answers2

3

Assume that there are two solutions $x_1$ and $x_2$, so $ax_1\equiv b \pmod p$ and $ax_2\equiv b \pmod p$. This implies $ax_1\equiv ax_2 \pmod p$, which means that $p\mid a(x_1-x_2)$. When a prime number divides the product of two integers, it has to divide at least one of them. Since $p\nmid a$, $p\mid x_1-x_2 \Leftrightarrow x_1\equiv x_2 \pmod p$, i.e., the solution has to be unique. Uniqueness here means that there's only $1$ equivalency class (numbers that give the same remainder when divided by $p$) satisfying the equation

bjorn93
  • 6,787
  • +1 excellent explanation! – manooooh Nov 03 '19 at 05:13
  • why does $x_1 \equiv x_2 (mod : p)$ imply that the solution is unique? – baked goods Nov 03 '19 at 05:25
  • @panzershreks In congruences, $\equiv$ is like a $=$ sign. If $x_1$ and $x_2$ were actually different solutions, they wouldn't give you the same remainder modulo $p$. When we're solving congruences, we're interested in congruence classes (see my last sentence). – bjorn93 Nov 03 '19 at 05:32
  • @panzershreks As an example, $2x\equiv 1\pmod 3$ has solutions $x=2,5,8,11,14,17\dots$. There's infinitely many numbers, but all of them give remainder 2 divided by 3. We call this a single solution because the numbers form a single congruence class. – bjorn93 Nov 03 '19 at 05:35
  • @bjorn93 ah ok thank you – baked goods Nov 03 '19 at 05:36
2

$\,ax\equiv b\!\!\overset{\large \times\ a^{p-2}\!\!\!\!\!}\iff x\equiv a^{p-2}b\,$ proves both existence $(\Leftarrow)$ and uniqueness $(\Rightarrow)$. Recall that scaling by a unit (invertible) always yields an equivalent equation (congruence). Here $(\Rightarrow)$ we scaled by $\,a^{-1}\equiv a^{p-2}\,$ by Fermat. The reverse $(\Leftarrow)$ is the inverse operation: scaling by $\,a\equiv (a^{-1})^{-1}$

Remark $ $ Thus the proof is no different from the same proof that $\,ax = b\,$ has a unique solution for rationals or reals, i.e. if $\,a\neq 0\,$ then $\,ax = b\iff x = a^{-1}b,\,$ by scaling by invertibles $\,a\,$ or $\,a^{-1}$.

See here and here for much further discussion of subtleties regarding such uniqueness.

Bill Dubuque
  • 272,048