Find the smallest $x$ for $9x \equiv 3 \pmod {23}$ $9x \equiv 3 \pmod {23}$
How to derive the smallest $x$. I understand I can use the extended euclidean algorithm for eg $19x = 1 \pmod {35}$. 
However, I not too sure how to work on it when it is $3 \pmod {23}$. 
I am able to reach the step of $1 = -5(9) + 2(23$) after going thru the euclidean algorithm. 
 A: Ah, great, but this already means that $-5$ is the multiplicative inverse of $9$ modulo $23$, as $(-5)\cdot 9\equiv 1 \pmod{23}$. So you have
$$x\equiv (-5)\cdot 9x\equiv (-5)\cdot 3=-15\equiv 8 \pmod{23}$$
Among these, $8$ is the smallest positive number.
A: As you computed, $9(-5)\equiv 1\pmod {23}\implies 9(-5)3\equiv 3\pmod {23}\implies 9(-15)\equiv 3\pmod{23}$ $\implies 9(8)\equiv3\pmod{23}$
A: Hint $\rm\,\ mod\ 23\!:\,\ 9x\equiv 3\iff x\equiv \dfrac{3}{9}\equiv \dfrac{1}3\equiv \dfrac{8}{24}\equiv \dfrac{8}1$
Remark $\ $ We used Gauss's algorithm for computing inverses $\rm\:mod\ p\:$ prime.
Beware $\ $ One can employ fractions $\rm\ x\equiv b/a\ $ in modular arithmetic (as above) only when the fractions have denominator $ $ coprime $ $ to the modulus $ $ (else the fraction may not uniquely exist, $ $  i.e. the equation $\rm\: ax\equiv b\,\ (mod\ m)\:$ might have no solutions, or more than one solution). The reason why such fraction arithmetic works here (and in analogous contexts) will become clearer when one learns about the universal properties of fraction rings (localizations). 
A: $ _{_{_{x}}}$
(This is certainly a smaller $x$ than any other solution has)
(From reading "Littlewood's Miscellany" - highly recommended)
A: We employ an algorithm that was discussed here.
$\alpha-$Solve:
$\;9x \equiv 3 \pmod{23}, \text{ and } \; 23 = 9 \cdot 2 + 5,\quad -3 + 1 \cdot 9 = 6$
$\alpha-$Solve:
$\;5x \equiv 6 \pmod{9}, \text{ and } \; 9 = 5 \cdot 1 + 4,\quad -6 + 2\cdot 5 = 4$
$\alpha-$Solve:
$\;4x \equiv 4 \pmod{5},  \text{ ANS: } \; x = 1 \text{ is the least residue solution}.$
Propagating backward,
Solve $5x = 6 + 1 \cdot 9, \text{ ANS: } \; x = 3$
Solve $9x = 3 + 3 \cdot 23, \text{ ANS: } \; x = 8$
$\text{ANSWER: }  x = 8 \text{ is the least natural number satisfying }$
$\quad 9x \equiv 3 \pmod{23}$
