I just got started with discrete math and modular arithmetic and I'm trying to get good at modular congruences. I was trying to solve this exercise:
$$18x\equiv1\bmod {25}$$
Here's what I've tried:
$$18x\equiv1\text{ }(25) \iff 18x \equiv 26\text{ } (25) \mathop{\iff}^{\text{div by 2}} 9x \equiv 13\text{ }(25)\iff 9x \equiv -1\text{ }(25)$$
Then I'm not quite sure how to proceed. This is the first exercise of this kind I'm attempting, and for a bit I thought I was onto something.
What am I missing?
Perform the Euclidean algorithm to find $\gcd(18,25)$:
$$25=18\times 1+7$$ $$18=7\times 2+4$$ $$7=4\times 1+3$$ $$4=3\times 1+1$$
which, backwards, gives you:
$$\begin{array}{rl}1&=4\times1+3\times(-1)\\&=4\times 1+(7\times 1+4\times (-1))\times (-1)\\&=7\times(-1)+4\times 2\\&=7\times(-1)+(18\times 1+7\times(-2))\times 2\\&=18\times 2+7\times (-5)\\&=18\times 2+(25\times 1+18\times(-1))\times(-5)\\&=25\times(-5)+18\times 7\end{array}$$
The point of this calculation was to express $1=\gcd(25, 18)$ in the form $25a+18b$ with $a, b$-integers.
Once you have that, you will see that the factor multiplying $18$ (in this case, $7$) acts as an inverse of $18\pmod{25}$. In particular, $7\times 18\equiv 1\pmod{25}$, and also, if $18x\equiv 1\pmod{25}$, by multiplying by $7$ you get $7\times 18x\equiv 7\pmod{25}$, i.e. $x\equiv 7\pmod{25}$.