I am trying to solve $ax + b = y \; (mod \; m)$ for x, where $a,b,y,m$ are known values. This corresponds to running a linear congruential generator in reverse for one iteration.
I am happy to assume that $gcd(a,m) = 1$, which according to this page, means there is a single solution for $x$. I am looking for a nice algebraric manipulation of the equation that will produce this value for $x$.
I begin like this: first subtract $b$ from both sides
$$ax = y - b = u \; (mod \; m)$$
Next, compute $n$, the multiplicative inverse of $u$, to arrive at
$$axn = un = 1 \; (mod \; m)$$
How do I continue and find $x$?