-2

I did this

enter image description here

Apparently this is wrong because the right answer is $17+43t$ for $0 \le t \le 18$. What went wrong? I know this is supposed to have 19 solutions but what I got was $-198 \pmod {817} + 43t$ and -198 mod 817 isn't 17.

2 Answers2

3

Nothing really went wrong.

You got $589(-198+43t)\equiv209\bmod817$.

By the mod distribution law, this is equivalent $(\div19)$ to $31(-198+43t)\equiv11\bmod43$.

So $x\equiv-198 \equiv17\bmod43$.

So $x\equiv17+43t\bmod 817$.


You could have noted from the beginning that $589, 209, $ and $817$ are all multiples of $19$, so

$589x \equiv 209 \pmod {817}\iff31x\equiv11\pmod{43}.$

This can be solved using the Bezout identity $13\times43-18\times31=1$:

$x\equiv-18\times11=-198\equiv17\pmod{43}$,

so $x\equiv 17, 60, 103, 146, 189, 232, 275, 318, 361, 404, 447, 490, 533, 576, 619, 662, 705, 748, $

or $791\bmod 817$.

J. W. Tanner
  • 60,406
  • Why do I have to use this though and why can't I leave the answer as it is? It's still correct. – Segmentation fault Jan 01 '20 at 20:16
  • 1
    You could leave it – J. W. Tanner Jan 01 '20 at 20:25
  • I think I get it, I was supposed to divide $589 \equiv 209 \pmod{817}$ by 19, which is gcd(817,589) to simplify things so I would have to work with big numbers. Then I was supposed to solve normally for $31x \equiv 11 \pmod{43}$, which gives me $1 = 43(13+31t)+31(-198-43t)$, multiply everything by 11, which gives me $11 = 43(143+31t)+31(-198-43t)$. Then do -198 mod 43, which is 17, and my answer is 17-43t for $0 \le t \le 18$. I suppose I was just missing the simplification. – Segmentation fault Jan 01 '20 at 21:02
  • 2
    How do you propose to "note" that $,19\mid 209,589,$ without computing their gcd? – Bill Dubuque Jan 02 '20 at 01:34
  • 2
    @Silence No, you're not supposed to divide by $19$ from the beginning because in general you cannot know that common factor without computing the gcd, which is what you did by using the euclidean algorithm. After you know the gcd then you can cancel it. Generally $\ ax\equiv b\pmod{n}$ is solvable $\iff d:=\gcd(a,n)\mid b,,$ and if so then the general solution is $, x\equiv (b/d)/(a/d)\pmod{n/d},,$ i.e. cancel $d$ everywhere, e.g. see here. – Bill Dubuque Jan 02 '20 at 01:46
  • 1
    The fractional extended euclidean algorithm described in the prior link is much simpler, e.g. see here and here for many more examples. – Bill Dubuque Jan 02 '20 at 01:46
  • @BillDubuque: my first step was to factor $817$ – J. W. Tanner Jan 02 '20 at 02:59
  • @J.W.T How did you do that? At OP: Generally factoring it is much more difficult than computing gcds (though in some special cases we may recognize "obvious" factors). So - unless you can very quickly see a common factor - usually it's best to go straight to an (extended) gcd calculation. – Bill Dubuque Jan 02 '20 at 03:03
  • @BillDubuque: I did that by trial division – J. W. Tanner Jan 02 '20 at 03:18
  • @SilenceOnTheWire I added an answer showing the calculation using modular fractions. – Bill Dubuque Jan 02 '20 at 07:17
0

Your solution is correct since $\bmod 43\!:\ x \equiv -198 \equiv 5(43)-198\equiv \,\bbox[5px,border:1px solid #c00]{\!\!17}$

An easier way (fractional extended Euclidean algorithm), first calculating $\,\gcd(817,589)\!=\!\color{#c00}{19}\,$ in parallel, and second assuming the gcd known & cancelling it out, working $\bmod 43 = {817}/\color{#c00}{19}$.

${\rm mod}\,\ 817\!:\,\ \dfrac{0}{817}\overset{\large\frown}\equiv \dfrac{209}{589}\overset{\large\frown}\equiv \color{90f}{\dfrac{-209}{228}}\overset{\large\frown}\equiv \color{#90f}{\dfrac{19}{-95}}\overset{\large\frown}\equiv \color{#0a0}{\dfrac{-171}{38}}\overset{\large\frown}\equiv \color{#c00}{\dfrac{-323}{-19}}\overset{\large\frown}\equiv \dfrac{0}0$

${\rm mod}\ \ \,43\!:\ \ \ \ \dfrac{0}{43}\,\overset{\large\frown}\equiv\ \dfrac{11}{31}\ \overset{\large\frown}\equiv\ \color{90f}{\dfrac{-11}{12}}\ \overset{\large\frown}\equiv\ \color{#90f}{\dfrac{1}{-5}}\ \overset{\large\frown}\equiv\ \ \color{#0a0}{\dfrac{-9}{2}}\ \,\overset{\large\frown}\equiv\ \color{#c00}{\dfrac{-17}{-1}}\, \overset{\large\frown}\equiv\ \dfrac{0}0$

$\begin{array}{rl} \qquad\ {\rm i.e.}\ \ \ \ \bmod 43\!:\qquad\ [\![1]\!] &\ 43\, x\,\equiv\ \ \ 0\ \\ [\![2]\!] &\ \color{c00}{31\,x\, \equiv\ \ \ 11}\!\!\!\\ [\![1]\!]\:\!-\:\!1\,[\![2]\!] \rightarrow [\![3]\!] &\ \color{90f}{12\,x\, \equiv {-}11}\ \\ [\![2]\!]\:\!-\:\!\color{1orange}3\,[\![3]\!] \rightarrow [\![4]\!] & \color{#90f}{{-}5\,x\, \equiv\ \ \ 1}\ \\ [\![3]\!]\:\!+\:\!\color{}2\,[\![4]\!] \rightarrow [\![5]\!] &\:\! \ \ \, \color{#0a0}{2\,x\, \equiv {-}9}\ \\ [\![4]\!]\:\!+\:\!\color{1orange}2\,[\![5]\!] \rightarrow [\![6]\!] & \color{#c00}{{-}1\,x\, \equiv {-}17}\ \\ [\![5]\!]\:\!+\:\!\color{1orange}2\,[\![6]\!] \rightarrow [\![7]\!] & \ \ \: \color{90f}{0\,x\, \equiv\ \ \ 0}\ \end{array}$

$\begin{align}{\rm Therefore}\ \ \ x\equiv {\color{#c00}{\dfrac{-323}{-19}}\!\!\!\pmod{817}}&\equiv \,\color{#c00}{17}\!\!\!\pmod{\!43},\ \ {\rm by\ cancelling}\ \ 19\\ &\equiv\, 17+43\,k\!\!\pmod{\!817},\ \ 0\le k < 19\\[0.5em] &\equiv \{17,\, 60,\, 103,\ldots, 705,748,791\}\!\!\pmod{\!817}\end{align} $

Remark $ $ Normally the equations under the fractions are omitted after one masters the algorithm, but I include them since they are instructive when learning it. Notice the fractions in the $\bmod 817\,$ Euclidean sequence are the scalings by $19$ of those in the $\!\bmod 43$ sequence: $\,a/b\to (19a)/(19b)$.

Bill Dubuque
  • 272,048