Where did the following argument go wrong? (The correct answer in $\mathbb{Z}_{100} $is just $81$.)
Working mod 100: $$21x\equiv1$$ $$105x\equiv5$$ $$5x\equiv5$$ $$x\equiv1,21,41,61,81$$
Thank you.
Where did the following argument go wrong? (The correct answer in $\mathbb{Z}_{100} $is just $81$.)
Working mod 100: $$21x\equiv1$$ $$105x\equiv5$$ $$5x\equiv5$$ $$x\equiv1,21,41,61,81$$
Thank you.
Your mistake was multiplying by $5$, which does not have a multiplicative inverse modulo $100$. You can see the problem even more clearly if you try to solve $20x\equiv1\pmod{100}$ that way: you get $100x\equiv5\pmod{100}$, but of course $100x\equiv0\pmod{100}$, so we have $5\equiv0\pmod{100}$, which is clearly nonsense. You’re entitled to multiply both sides of a congrence $\pmod m$ by $a$ iff $a$ has a multiplicative inverse $\pmod m$, which is the case iff $a$ and $m$ are relatively prime.
To solve $21x\equiv1\pmod{100}$ you can either rely on ad hoc methods or simply use the Euclidean algorithm to find $\gcd(21,100)$:
$$\begin{align*} 100&=4\cdot21+16\\ 21&=1\cdot16+5\\ 16&=3\cdot5+1\;, \end{align*}$$
and working back up the chain, we get
$$\begin{align*} 1&=16-3\cdot5\\ &=16-3(21-16)\\ &=4\cdot16-3\cdot21\\ &=4(100-4\cdot21)-3\cdot21\\ &=4\cdot100-19\cdot21\;. \end{align*}$$
Thus, $100\mid 1-(-19)(21)$, so $21(-19)\equiv1\pmod{100}$, and $x\equiv-19\pmod{100}$ is the solution. You probably want the representative that’s in $\{0,\dots,99\}$, so you’d probably rather write it $x\equiv-19+100=81\pmod{100}$. (There are shortcuts for carrying out the calculations above; I left them in their most self-explanatory form.)
For an ad hoc approach I’d probably notice that $21\cdot19=20^2-1=399\equiv-1\pmod{100}$, so $21(-19)\equiv1\pmod{100}$.
When you multiplied by $5$, the nonsolutions entered. $21$ is relatively prime to $100$, so it has a unique multiplicative inverse $\pmod{100}$. If $d$ has common divisor with $m$, then $dx\equiv a \pmod{m}$ may not have or may have exactly $m/\gcd(m,d)$ solutions.
I would do something like (all $\pmod{100}$): $$\begin{align} 21x & \equiv 1 \equiv -99\\ 7x &\equiv -33 \equiv 67 \equiv 567 \\ x &\equiv 81 \end{align}$$
$$a \equiv b \pmod{c} \implies ka \equiv kb \pmod{c}$$ where $k \in \mathbb{Z}$ is always true. However, $$ka \equiv kb \pmod{c} \implies a \equiv b \pmod{c}$$ is true only when $\gcd(k,c) = 1$.
For instance, $$21x \equiv 1 \pmod{100} \implies 105 x \equiv 5 \pmod{100}$$ is true. But $$105x \equiv 5 \pmod{100} \implies 21 x \equiv 1 \pmod{100}$$ is false.
Let us now look at where you have made the mistake in your computation.
EDIT
In your solution, you are finding $x$ such that $$5x \equiv 5 \pmod{100}$$ i.e. $$105x \equiv 5 \pmod{100}$$ However, this does not imply that $$21x \equiv 1 \pmod{100}$$ Only a subset of the values that satisfy $5x \equiv 5 \pmod{100}$ will satisfy $21x \equiv 1 \pmod{100}$
Hint $\rm\displaystyle\ \, mod\ 100\!:\ \, x\equiv \frac{1}{21}\equiv\frac{1}{121}\equiv\left(\frac{1}{11}\right)^2\!\equiv 81\ \ \ by\ \ \ \frac{1}{11}\equiv\frac{9}{99}\equiv\frac{9}{-1}$
Or $\ \, \dfrac{1}{1+2\cdot 10}\equiv \dfrac{1}{1+2\cdot 10}\,\dfrac{1-2\cdot 10}{1-2\cdot 10}\equiv \dfrac{-19}{1}\equiv 81\,$ by simpler multiples, unit+nilpotent
Your error is $\rm\:x\equiv y\iff 5x\equiv 5y.\:$ $(\Rightarrow)$ holds but $(\Leftarrow)$ fails, e.g. $\rm\:5\cdot 20\equiv 5\cdot 0\:$ but $\:20\not\equiv 0$.
Remark $\ $ As above, for "small" manual computations of inverses and fractions, non-algorithmic methods often are quickest since, by the law of small numbers, there are frequently enough coincidences to make the problem easily massaged into one where the inverse or quotient is obvious. Generally one can resort to algorithms such as the Extended Euclidean algorithm (see here for a very convenient manual way to apply it) and Gauss' algorithm.
The problem with the process shown in your question is that everything was multiplied by a zero divisor ($5\cdot20\equiv0\pmod{100}$). This loses information (though not as much information as is lost when multiplying by 0).
The Euclidean Algorithm is the systematic way to do this, but to keep track of things, I use the Euclid-Wallis Algorithm, which combines the Euclidean Algorithm with some ideas from continued fractions. $$ \begin{array}{r} &&4&1&3&5\\\hline 1&0&1&-1&4&-21\\ 0&1&-4&5&-19&100\\ 100&21&16&5&1&0\\ &&&&{\uparrow}&{\star} \end{array} $$ What this shows is that $4\cdot100-19\cdot21=1$. That is, the inverse of $21\bmod{100}$ is $-19\equiv81\pmod{100}$.