Modular arithmetic $(2n+1)x \equiv -7 \pmod 9$

elementary-number-theorymodular arithmetic

Find a solution $(2n+1)x \equiv -7 \pmod 9$

I’m sure this is trivial but I still have doubts about it.

I know the equation has solution for certain $n \in \mathbb {Z}$. Actually I have tried a few and got a similar results (with Diophantine equations ). I wonder if there’s general solution for the equation without changing the n for an integer.

Thanks in advance.

Best Answer

Hint $\,\bmod 9\,$ invertibles have form $\,2^{\large n}$ so $\,2^{\large n} x\equiv 2 \iff x \equiv 2^{\large\:\! 7-n},\,\ n = 0,1,2,\ldots,5 $

Example $\ $ For $\,n = 2\,$ the above says that $\, 2^{\large 2} x\equiv 2\iff x\equiv 2^{\large 5}\equiv 5.\,$ Indeed $\,2^{\large 2} 5\equiv 2\,\color{#c00}\checkmark$

Remark $\ $ Since $\,-7\equiv 2\,$ is invertible $\bmod 9\,$ so too is its factor $\,a := 2n\!+\!1.\,$ Or, more explicitly, $\,ax\equiv 2\,\iff ax\,2^{-1}\equiv 1\iff a^{-1}\equiv 2^{-1}x\equiv 5x$

That every invertible has form $\,2^{\large n}$ follows because $\,2\,$ is a primitive root $\bmod 3^{\large 2}\,$ (generally a p.r. $\,g \bmod p\,$ persists as a p.r. $\bmod p^k\,$ except if $\, g^{\large p-1}\!\equiv 1\pmod{\!p^2};\,$ where instead $\,g\! +\! p\,$ works).


Directly: $\,a\,$ invertible $\!\bmod 9\iff a\,$ invertible $\!\bmod 3\iff a = \pm1 + 3j,\,$ so

$\!\bmod \color{#c00}9\!:\,\ ax = (\pm1 + 3j)x \equiv 2\iff x\equiv \dfrac{2}{\pm1 + 3j} \equiv \dfrac{2(1-\color{#c00}9j^2)}{\pm1 + 3j\ \ } \equiv 2(\pm1 -3j)$

Example $\ \ \ \ \ \ a = 1+3\iff x \equiv 2(1-3)\equiv 5,\,$ same as above

Related Question