Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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

share|improve this answer

Frank, you can use Gauss's Algorithm even if modulo is not prime. The only thing you need to take care is that multiplier should be co-prime to modulo.

Just keep multiplying denominator by a number so that denominator is near 100 till denominator become 1. However, the multiplier must be co-prime to 100.

$$\frac{13}{7} \pmod {100} \equiv \frac{13 × 29}{7 × 29} \pmod {100} \equiv \frac{-23}{3} \pmod {100}$$

$$ \equiv \frac {-23-100}{3} \pmod {100} \equiv \frac {-123}{3} \pmod {100} \equiv {-41} \pmod {100}$$

$$ \equiv {59} \pmod {100}$$

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.