2

The actual question is if there is a number x, and x mod 19 = 1, x mod 12 = 1 and x mod 17 = 14, what is the number? I can solve this by using kinda brute force way. 19 * 12 * n + 1 = x, n is an integer, I tried from n = 1 until when n = 14, x mod 17 = 14. So the number is 3193. But I am just wondering if it is possible to do it in a more concise way, or there could be multiple answers to the question.

J. W. Tanner
  • 60,406
geliba187
  • 131
  • 1
    You should look up the Chinese remainder theorem (and its generalisations). – Clive Newstead May 30 '19 at 01:49
  • 2
    As for multiple answers: take any answer and add $19\cdot 12 \cdot 17$ to it; the three residues will remain unchanged, and you'll have a new and different answer. In short: there are infinitely many answers to this question. – John Hughes May 30 '19 at 03:07

4 Answers4

0

From $x \equiv 1 \pmod {19}$ and $x\equiv 1 \pmod {12},$ it follows that $x\equiv1 \pmod {19\times12=228}$,

so $x=228k+1.$

We also have $x\equiv14\pmod{17}$, so $228k+1\equiv14\pmod{17}$; i.e., $7k\equiv13\pmod{17}$.

Multiply both sides by $5 (5\times7\equiv1\pmod{17})$ to get $k\equiv65\equiv14\pmod{17}$.

$228\times(14+17n)+1=\color{red}{3193}+3876n$.

J. W. Tanner
  • 60,406
  • You can find the inverse of $7$ mod $17$ from the extended Euclidean algorithm: $17-2\times7=3, 7-2\times3=1, $ so $7-(2\times(17-2\times7))=1$ i.e., $7\times\color{red}5-2\times17=1$ – J. W. Tanner May 30 '19 at 02:10
0

$\!\!\bmod \color{#c00}{17}\!:\ {-}3 \equiv x \equiv 1\!+\!\overbrace{12\cdot 19}^{\large-5\ \,\cdot\,\ 2\, \ \ }\color{#c00}k \equiv 1\!+\!7k\!\iff\! \color{#c00}k \equiv \dfrac{-4}7 \equiv \dfrac{ -21}7 \equiv-3\equiv \color{#c00}{14}$
Hence we have $\ \ x = 1\!+\!12\cdot 19(\color{#c00}{14\!+\!17}n)) = \underbrace{1\!+\!12(19)14}_{\large 3193} + 12(19)17n^{\phantom{1^1}}\!$

Bill Dubuque
  • 272,048
0

You can use Bezout coefficients, as one way of applying the Chinese remainder theorem.

Let's take $x\cong1\pmod{19}$ and $x\cong1\pmod{12}$.

Note that $7\cdot19-12\cdot 11=1$. Thus $7$ and $-11$ are Bezout coefficients for $19$ and $12$. They can be found using the extended Euclidean algorithm, for instance.

As it turns out, $1\cdot 7\cdot 19+1\cdot {-12}\cdot 11=1$ will be the solution to the system mod $12\cdot 19=228$.

Next, Bezout coefficients for $17$ and $228$ are needed. They are: $-67$ and $5$.

Thus, we get $1\cdot-67\cdot 17+14\cdot 5\cdot 228=14821$.

And finally, $14821\cong3193\pmod{12\cdot 17\cdot 19}$.

(Above I have simply applied repeatedly the fact that, when we have the system $\begin {cases} x\cong m_1\pmod{n_1}\\x\cong m_2\pmod{n_2}\end{cases}$, and $an_1+bn_2=1$,then $x=m_2an_1+m_1bn_2$ is a solution.

This comes from the existence part of the proof of CRT.)

0

We can simplify this because $x\equiv1\pmod{19}$ and $x\equiv1\pmod{12}$ by saying $x\equiv1\pmod{228}$. However, that hides some of the generality that can be exposed.

For this generality, we will solve $3$ sets of equations.


Set $\boldsymbol{1}$: $$ \begin{align} x_{19}&\equiv1\pmod{19}\\ x_{19}&\equiv0\pmod{12\cdot17} \end{align}\tag1 $$ Using the algorithm from this answer: $$ \begin{array}{r} &&10&1&2&1&4\\\hline 1&0&1&-1&3&-4&19\\ 0&1&-10&11&-32&43&-204\\ 204&19&14&5&4&1&0\\ \end{array} $$ This says that $43\cdot19\color{#C00}{-4\cdot204}=1$. Thus, $x_{19}\equiv\color{#C00}{-816}\pmod{3876}$ satisfies $(1)$.


Set $\boldsymbol{2}$: $$ \begin{align} x_{12}&\equiv1\pmod{12}\\ x_{12}&\equiv0\pmod{17\cdot19} \end{align}\tag2 $$ and solving $$ \begin{array}{r} &&26&1&11\\\hline 1&0&1&-1&12\\ 0&1&-26&27&-323\\ 323&12&11&1&0\\ \end{array} $$ This says that $27\cdot12\color{#C00}{-1\cdot323}=1$. Thus, $x_{12}\equiv\color{#C00}{-323}\pmod{3876}$ satisfies $(2)$.


Set $\boldsymbol{3}$: $$ \begin{align} x_{17}&\equiv1\pmod{17}\\ x_{17}&\equiv0\pmod{12\cdot19} \end{align}\tag3 $$ and solving $$ \begin{array}{r} &&13&2&2&3\\\hline 1&0&1&-2&5&-17\\ 0&1&-13&27&-67&228\\ 228&17&7&3&1&0\\ \end{array} $$ This says that $\color{#C00}{5\cdot228}-67\cdot17=1$. Thus, $x_{17}\equiv\color{#C00}{1140}\pmod{3876}$ satisfies $(3)$.


We want $$ \begin{align} x&\equiv\color{#C00}{1}\pmod{19}\\ x&\equiv\color{#090}{1}\pmod{12}\\ x&\equiv\color{#00F}{14}\pmod{17}\\ \end{align}\tag4 $$ therefore, $$ \begin{align} x&\equiv\color{#C00}{1}\cdot\overbrace{\ (-816)\ }^{x_{19}}+\color{#090}{1}\cdot\overbrace{\ (-323)\ }^{x_{12}}+\color{#00F}{14}\cdot\overbrace{\ (1140)\,\,}^{x_{17}}\\[6pt] &\equiv-683\pmod{3876}\tag5 \end{align} $$

robjohn
  • 345,667