3
$\begingroup$

I have

$ \begin{cases} x \equiv 2 \pmod 3 \\ x \equiv 4 \pmod 7 \\ x \equiv 5 \pmod8 \end{cases} $

and I don't know how to do this quickly in this step:

$56x_1 \equiv 1 \pmod 3 $ implies $x_1 = 2$

The question is, how to find $x_1, x_2, x_3$ fast? In case $x_1$:

instead of multiplying 56 by $2, 3, 4, 5 \ldots$ and do like this $56*2=112$ so $112 \div 3 \approx 37$ thus $112-37*3=1$

What if $x_n$ where $n \ge 1$ is not $2$ but some big number? I know there is the extended Euclidean algorithm.

  • 0
    $56 \equiv 2 \pmod{3}$ will make the arithmetic much easier. For bigger numbers, yes use the extended Euclidean algorithm ( Bezout's theorem https://en.wikipedia.org/wiki/B%C3%A9zout's_theorem).2017-02-18
  • 0
    (edited) not only find $x_1$ but all so $x_1, x_2, x_3$2017-02-18
  • 1
    ${\rm mod}\ 3\!:\,\ \color{#c00}{56\equiv -1},\ $ so $\ 1\equiv \color{#c00}{56}x\equiv \color{#c00}-x\!\overset{\rm negate}\iff\! x\equiv -1\equiv 2\ \ $2017-02-18

2 Answers 2

3

One thing to speed things up would be that it seems like you aren't taking advantage of the fact that you can reduce the number $56$ modulo $3$ without affecting anything.

$$56x\equiv1\bmod 3 \quad\leadsto\quad 2x\equiv 1\bmod 3$$

  • 0
    but reducing like this? $56-3=53-3$ and so on until it is equal $2$ ?2017-02-18
  • 0
    @Grisza: That works, but it is faster to just divide and take the remainder. $56\div 3=18$ with a remainder of $2$.2017-02-18
  • 0
    I didn't notice property of congruence's 'reducing' thx2017-02-18
0

For the stated problem you have a shortcut giving you

$x\equiv 4\equiv -3 \bmod 7$
$x\equiv 5\equiv -3 \bmod 8$

So $x\equiv -3 \equiv 53 \bmod 56$

Then since $53 \equiv 2 \bmod 3$ we have $x\equiv 53 \bmod 168$


Your remark about the extended Euclidean algorithm gives the way forward for more complicated cases. You can find the modular inverse of the appropriate modulus $m_1$ in the next modulus $m_2$ and use that to find the appropriate range of $km_1$ values to synchronize the two modular values.

Suppose we are trying to combine

$x\equiv 4 \bmod 21$
$x\equiv 6 \bmod 11$

Then $21^{-1}\equiv 10^{-1}\equiv 10 \bmod 11$, so to get $4+21k \equiv 6 \bmod 11$ we can set $k=10\cdot (6-4) = 20 \equiv 9 \bmod 11$ so
$x\equiv 4+21\cdot9 \equiv 193 \bmod (21\cdot11=231)$

  • 0
    That's not the question.2017-02-18
  • 0
    I will update, but actually it pretty much was the title question.2017-02-18
  • 0
    Ah, the title was changed to reflect the question. The title is not the question, in any event, and the body makes quite clear that the OP is asking for the general technique for finding the inverse.2017-02-18