# linear congruent modulo with only one solution

$n \cdot x ≡ k \mod{20} \\n,k \in \mathbb{Z}$

Choose $n,k$ so there is only $(a)$ one, $(b)$ no solution in $\mathbb{Z_{20}}$.

If $n = 0$, then two solution exist, and that is $k=20$ and $k=-20$, as we are in $\mathbb{Z_{20}}$

If $n,k = 0$, then there is one solution, because $0 ≡\mod{20} = 0$

Stuck on the question how to find no solution. Basically you could just put $n \geq 21$ and $\mod{20}$ will never be able to generate a number $\geq 20$

-
$20 \equiv -20\pmod{20}$ so they are regarded as the same. – JavaMan Dec 10 '12 at 6:56

## 3 Answers

For one solution, say $n=1$, $k=1$. Clearly, $x\equiv 1\pmod{20}$ is the only solution.

For no solution, $n=2$, $k=1$. If $n=2$, then $nx$ is always even, so cannot be congruent to any odd number modulo $20$.

For more than $1$ solution, $n=4$, $k=0$. Note that $x\equiv 0\pmod{20}$ is a solution, but so is $x\equiv 5\pmod{20}$. Also, $10$ and $15$ work.

For exactly two solutions, $n=2$, $k=0$ works, the only solutions are $x\equiv 0\pmod{20}$ and $x\equiv 10\pmod{20}$.

Surely you could have found these, or ones like them. For all the questions, there are several answers that work.

Your calculation was not correct, $20$ and $-20$ and $0$ are all the same modulo $20$. In fact, if we take $n=0$, $k=0$, there are $20$ solutions (any $x$ works).

-
no solution, because even on the left and odd on the right? i'm such a dumbass. – blacksmth Dec 10 '12 at 7:01
Well, it's a bit more subtle, because for example $18\equiv 3\pmod{15}$. The key is that $20$ is even. – André Nicolas Dec 10 '12 at 7:07
Thank you for your detailed answer. much appreciated :) – blacksmth Dec 10 '12 at 7:15

Hint: $ax \equiv b \pmod{m}$ has a unique solution if and only if $\gcd(a,m) = 1$.

-
Thank your for your answer :) saved my morning – blacksmth Dec 10 '12 at 7:10

More generally, using Linear congruence theorem, this equation is solvable $\iff$ $(20,n)\mid k$

In that case,we have exactly $(20,n)$ solutions.

-