I'm having trouble solving congruences. I can't seem to find a method (a series of steps) to follow in order to find the solutions of a linear congruence. In particular, I have $33x≡9$ (mod 29). My thoughts: gcd (33,29) $=1$, so there is one solution. I don't know what to do next (I tried using Euclid's algorithm...). Thanks
-
If you have $33x+29y=1$ for some $x,y$ by the Euclidean algorithm, then why not multiply by $9$? Then $33\cdot 9x\equiv 9\mod 29$. – Bulberage Mar 24 '14 at 01:41
-
1What happened when you tried using Euclid's algorithm? – hmakholm left over Monica Mar 24 '14 at 01:42
4 Answers
Hint $\ {\rm\ mod}\ 29\!:\ x\equiv \dfrac{9}{33}\equiv \dfrac{-20}{4}\equiv -5\equiv 24$
Such reduction and ad-hoc sign twiddling works quite well for small numbers. For larger numbers one can use the Extended Euclidean Algorithm to invert the denominator. Or one can use Gauss's algorithm, since here the modulus is prime.
Beware $\ $ The use of fractions in modular arithmetic is valid only when the denominator is invertible, i.e. coprime to the modulus. Otherwise the quotient need not be unique, for example mod $\rm\:10,\:$ $\rm\:4\,x\equiv 2\:$ has solutions $\rm\:x\equiv 3,8,\:$ so the "fraction" $\rm\:x \equiv 2/4\pmod{10}\,$ cannot designate a unique solution of $\,4x\equiv 2.\,$ Indeed, the solution is $\rm\:x\equiv 1/2\equiv 3\pmod 5,\,$ which requires canceling $\,2\,$ from the modulus too, since $\rm\:10\:|\:4x-2\iff5\:|\:2x-1.\:$
Generally the grade-school rules of fraction arithmetic apply universally (i.e. in all rings) where the denominators are invertible. This fundamental property will be clarified conceptually when one learns in university algebra about the universal properties of fractions rings and localizations.

- 272,048
-
I avoid the beware part by ensuring that the linear congruence belongs to case 1 of my notes here :) – Anant Jun 22 '14 at 05:53
The Euclidean algorithm is indeed the method par excellence for computing modular inverses. Or more to the point, the extended Euclidean algorithm, which finds a solution to the equation
$$ 33 u + 29 v = 1$$
for you. (or it would solve $4u + 29v = 1$ for you, if you've already figured out that $33 \equiv 4$ and simplified the problem) (I put $1$ on the right hand side, since you already know the $\gcd$ is $1$)
How does this help you? Well, what happens if you simplify this equality modulo $29$?
$$\begin{align} 33x=29y+9 & =>4x=29(y-x)+9 \\ & => y-x=2k+1\\ & =>2x=29k+19\\ & => k=2n+1\\ & => x=29n+24.\end{align} $$

- 48,334
- 2
- 83
- 154
-
2
-
It does, actually. :-) But the bright and brilliant minds that invented LaTeX did not see it fit to make up a short code for the (actual) $=>$ sign. – Lucian Mar 24 '14 at 02:43
-
I suppose you're objecting to
\Rightarrow
. There is always\implies
, though. Or just\to
if you're happy with writing implication with a single line. – Mar 24 '14 at 02:44 -
The $\to$ doesn't "jump out", unfortunately. Anyway, I'll stick with the $=>$. – Lucian Mar 24 '14 at 02:47
We have $$33=4\mod29$$ and $$4^{-1}=22\mod29$$ because $4(22)=88=29*3+1$. Therefore the answer is $$9*22=198=24\mod29$$

- 645
-
4I've downvoted because it hands out the answer to the homework problem in a way that is unlikely to convey insight to most people who don't already know how to solve such problems. – Mar 24 '14 at 02:10
-
I've ignored your downvote because it hands out an explanation in a way that is unlikely to convey insight to any but the most bored people. – user137500 Mar 24 '14 at 02:17