Does $x$ always exist?

96 Views Asked by At

If $m$, $n$ and $p$ are fixed positive integers such that $p$ is a prime and $\text{gcd}(m,n) = \text{gcd}(n,p) = 1$, does an integer $x$ always exist, such that,

$$ nx \equiv m \pmod p $$

I was looking at modular equations involving rationals and this question came to mind.

Any help will be appreciated.
Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

You just need $\gcd(n,p)=1$ and $p$ need not be prime.

Indeed, by Bézout’s identity, there exist integers $a$ and $b$ such that $an+bp=1$, so you have $an=1-bp$ and $$ anx=(1-bp)x=x-bpx\equiv x\pmod{p} $$ Thus you get your desired solution to $nx\equiv m\pmod{p}$ by $$ x\equiv am\pmod{p} $$ If you want the minimum positive solution, it will be of the form $$ am+kp $$ for a suitable integer $k$.

5
On

The elements modulo $p$ forment a field $\mathbb F_p$ in which all number $n$ non multiple of $p$ (i.e. $\text{gcd}(n,p) = 1$) represents un element which is invertible in $\mathbb F_p$. Besides $nx \equiv m \pmod p$ with numbers is equivalent to $nx=m$ with the respective elements in $\mathbb F_p$. Therefore $$nx=m\Rightarrow \boxed{ x=n^{-1}\cdot m}$$

Examples in $\mathbb F_{13}$ $$3x=2\Rightarrow x=3^{-1}\cdot2=9\cdot2=5\\3x=6\Rightarrow x=3^{-1}\cdot6=9\cdot6=2$$

You can see in these two examples that the condition $\text{gcd}(m,n) =1$ is not necessary.