I am stuck with one problem from my discrete math class and don't know how to solve it. I will be grateful for any help!
Find all $x \in \mathbb{Z}_{501}$ for which $51x \equiv 36$, where the multiplication is in $\mathbb{Z}_{501}$.
I started solving it like this:
\begin{align}
51x & \equiv 36 \pmod{501}\\
51x & \equiv 36 + k501\\
51x + 501y & = 36
\end{align}
After this, I found $\gcd(51,501)$, which is $3$:
\begin{align}
501 & = 9 \cdot 51 + 42\\
51 & = 1 \cdot 42 + 9\\
42 & = 4 \cdot 9 + 6\\
9 & = 1 \cdot 6 + 3\\
6 & = 2 \cdot 3 + 0
\end{align}
After this, using back-substitution:
\begin{align}
3 & = -6 \cdot 501 + 59 \cdot 51\\
36 & = 708 \cdot 51 - 72 \cdot 501
\end{align}
Then I divided equation by the $\gcd$ and solved $17x+167y = 0$.
So my final answers are $x = 708 + 167k$ and $y= -72-17k$ (In our case we don't need $y$, though.)
Answers from my book are $x_1 = 40$, $x_2 = 207$ and $x_3 = 374$, and I don't know how can I get them.