# Solving a Linear Congruence

I've been trying to solve the following linear congruence with not much success: 19 congruent to $19\equiv 21x\pmod{26}$

If anyone could point me to the solution I'd be grateful, thanks in advance

Hint: $26 = 2 \cdot 13$ and the Chinese remainder theorem. Modulo $2$ we have to solve $1 \cong x \pmod 2$, that is $x = 2k + 1$ for some $k$, now solve $19 \cong 42k + 21 \pmod{13}$.

• thanks for the answer , i've understood the 1≅x(mod2) part , but i can't figure out why solving 19≅42k+21(mod13) – itamar May 31 '13 at 7:45
• @itamar We have that $19 \cong 21x \pmod{26}$ holds exactly iff both $19 \cong 21x \pmod 2$ and $19 \cong 21x \pmod{13}$ hold. After solving the first, we now that $x = 2k + 1$ for some $k$, pluging this into the second gives us $19 \cong 21x = 42k + 21 \pmod{13}$. – martini May 31 '13 at 7:48
• great. thanks ! – itamar May 31 '13 at 7:57
• May I know why the downvote? – martini May 31 '13 at 22:17

HINT: $21\equiv-5\pmod{26}$, so $21\cdot5\equiv-25\equiv1\pmod{26}$, and $21\cdot5\cdot19\equiv1\cdot19\pmod{26}$.

If $19 \equiv 21 x \mod 26$ then we must have $19=21x+26y$ for some integer $y$. You could use the Euclidean Algorithm to solve this problem, finding integers $s,t$ such that $\gcd(21,26) = 21s+26t$

$21^{-1}\equiv5\mod26\implies x\equiv95\equiv17\mod26$

• I've made it to this point, the problem is finding the x values . Is there any efficient way to do it instead of trying x from 1 to 25? – itamar May 31 '13 at 7:32
• @itamar: Please indicate such information in your question in the future. I was writing up a detailed explanation of how to get to this point, assuming that you didn't know how because you didn't say anything in your question. When you are looking for help, please make sure you assist the people answering your questions by being very specific about what you do or do not understand. – Zev Chonoles May 31 '13 at 7:37

$$\frac{26}{21}=1+\frac5{21}=1+\frac1{\frac{21}5}=1+\frac1{4+\frac15}$$

The previous convergent of $\frac{26}{21}$ is $1+\frac14=\frac54$

Using Convergent property (Theorem #$3$ here) of continued fraction, $21\cdot5-26\cdot4=1\implies 21^{-1}\equiv 5\pmod {26}$

Hint: $\,{\rm mod}\ 26\!:\ \dfrac{19}{21} \equiv \dfrac{-7\cdot 1\ \ \,}{7\cdot 3}\equiv -\dfrac{27}{3}\equiv -9.\ \ \$ Alternatively

note: $\,{\rm mod}\ 26\!:\ \dfrac{19}{21} \equiv \dfrac{-7}{-5} \equiv -7\left(\dfrac{-1}5\right) \equiv -7\left(\dfrac{25}5\right) \equiv -35 \equiv -9$

While such ad-hoc techniques often work quickly for small numbers, for larger numbers one should resort to algorithms such as the extended Euclidean algorithm. Also, keep in mind that modular fractions uniquely exist only when the denominator is coprime to the modulus.