# using Gauss' algorithm (for linear congruences) for A > B

To solve $Bx \equiv A \pmod{m}$, use Gauss' algorithm.

The algorithm works perfectly when $A < B$. For example, to solve $6x \equiv 5 \pmod{11}$: $$x \equiv \frac{5}{6} \equiv \frac{5(2)}{6(2)} \equiv \frac{10}{12} \equiv \frac{10}{1}$$ so $x \equiv 10$

But when $A > B$, I run into problems. For example, trying to solve $7x \equiv 13 \pmod{100}$: $$x \equiv \frac{13}{7} \equiv \frac{13(15)}{7(15)} \equiv \frac{195}{105} \equiv \frac{95}{5} \equiv \frac{95(21)}{5(21)} \equiv \frac{1995}{105} \equiv \frac{95}{5}$$ and it continues to be $\frac{95}{5}$. Am I missing a step?

PS: I was applying the algorithm on random linear congruence problems I could find. The second example comes from http://www.johndcook.com/blog/2008/12/10/solving-linear-congruences/, which says the answer is $x \equiv 59$.

## update

This answer answered my question. It explains that Gauss' algorithm works only on prime modulo.

-