4

Solve $x^2+5x+6 \equiv 187 \mod 187$

Solution

$$x^2+5x+6 \equiv 187 \mod 187$$ $$ (x+\frac{5}{2})^2 \equiv \frac{1}{4}$$ $$ 4(x+\frac{5}{2})^2 \equiv 1$$ $$ y:= x+\frac{5}{2} $$

$$ 4y^2 \equiv 1 \mod 11 \wedge 4y^2 \equiv 1 \mod 17 $$ $$ ( 2y \equiv 1 \mod 11 \vee 2y \equiv 10 \mod 11 ) \wedge ( 2y \equiv 1 \mod 17 \vee 2y \equiv 13 \mod 17) $$ $$ ( y \equiv 6 \mod 11 \vee y \equiv 5 \mod 11 ) \wedge ( y \equiv 9 \mod 17 \vee y \equiv 15 \mod 17) $$ Combining that from CRT I got: $$ y \in \left\{49, 60,83,94 \right\} $$ and for example: $$ x+\frac{5}{2} \equiv 94 \mod 187$$ $$ 2x \equiv 183 \mod 187$$ some calculus and get... $$x \equiv 185 $$ And the same thing for each other case.

Question

Is there any faster (or smarter) way to solve equations like that?

4 Answers4

5

Hint: applying CRT as in the Remark below yields

$$(x\!+\!2)(x\!+\!3)\equiv 0\!\!\!\pmod{\!11\cdot 17}\iff \begin{align} x\equiv -2,-3\!\!\!\pmod{\!11}\\ x\equiv -2,-3\!\!\!\pmod{\!17}\end{align}\qquad\qquad $$

which combine to $4$ solutions $\,x\equiv (\color{#90f}{{ -2,-2}}),\,(\color{#f80}{-3,-3}),\,\color{#c00}{(-2,-3)},\,\color{#0af}{(-3,-2)}$ mod $(11,17)$. By CCRT, $\bmod 187,\ $ first $\,2\,$ yield $\,x\equiv \color{#90f}{ -2},\,$ and $\,\color{#f80}{-3};\ $ 3rd $\ \color{#c00}{(-2,-3)}\,$ yields, by CRT

$\!\overbrace{\bmod\ \color{#0a0}{11}\!:\ \ \color{#c00}{{-}2} \equiv\, x \equiv \color{#c00}{-3}+17\,\color{#0a0}k}^{x\,\equiv\,\color{#c00}{(-2,-3)}\iff \begin{align}&x\ \equiv \color{#c00}{-2}\pmod{\!11}\\ &x\ \equiv \color{#c00}{-3}\pmod{\!17}\end{align}\!\!\!\!\!\!\!}\, \equiv-3+6k$ $ \iff 6k\equiv1\equiv12 \iff \color{#0a0}{k \equiv 2}$

therefore we infer $\ x = -3+17(\color{#0a0}{2+11}n) = \color{#c00}{31}+187n,\ $ so $\ \color{#c00}{(-2,-3)\,\mapsto\, 31}$

For 4th: $\ \color{#0af}{(-3,-2)} + \color{#c00}{\underbrace{(-2,-3)}_{\large31}}\equiv \underbrace{(-5,-5)}_{\large -5}$ $\,\Rightarrow\,\color{#0af}{(-3,-2)}\,\mapsto\, -5-\color{#c00}{31}\equiv -36\ $

Remark $ $ Note that $\,x\!+\!3\,,x\!+\!2\,$ are coprime (having difference $=1),\,$ so a prime power $\,p^n$ divides their product iff it divides exactly one of them, so the above method still works if we replace $11$ and $17$ by powers of distinct primes.

Generally, if $\,m,n\,$ are coprime then, by CRT, solving a polynomial $\,f(x)\equiv 0\pmod{\!mn}\,$ is equivalent to solving $\,f(x)\equiv 0\,$ mod $\,m\,$ and mod $\,n.\,$ By CRT, each combination of a root $\,r_i\bmod m\,$ and a root $\,s_j\bmod n\,$ corresponds to a unique root $\,t_{ij}\bmod mn,\,$ i.e.

$$\begin{eqnarray} f(x)\equiv 0\!\!\!\pmod{\!mn}&\overset{\,\,\rm CRT}\iff& \begin{array}{}f(x)\equiv 0\pmod{\! m}\\f(x)\equiv 0\pmod{\! n}\end{array} \\ &\,\,\iff& \begin{array}{}x\equiv r_1,\ldots,r_k\pmod{\! m}\phantom{I^{I^{I^I}}}\\x\equiv s_1,\ldots,s_\ell\pmod{\! n}\end{array}\\ &\,\,\iff& \left\{ \begin{array}{}x\equiv r_i\pmod{\! m}\\x\equiv s_j\pmod {\! n}\end{array} \right\}_{\begin{array}{}1\le i\le k\\ 1\le j\le\ell\end{array}}^{\phantom{I^{I^{I^I}}}}\\ &\overset{\,\,\rm CRT}\iff& \left\{ x\equiv t_{i j}\!\!\pmod{\!mn} \right\}_{\begin{array}{}1\le i\le k\\ 1\le j\le\ell\end{array}}\\ \end{eqnarray}\qquad\qquad$$

For more complex examples it is usually easier to solve the CRT system first for generic (symbolic) roots, then plug in the specific root values for all combinations, e.g. here and here.

Bill Dubuque
  • 272,048
4

Since $x^2+5x+6=(x+2)(x+3)$,\begin{align}x^2+5x+6\equiv187\pmod{187}&\iff(x+2)(x+3)\equiv0\pmod{187}\\&\iff(11\mid x+2\vee11\mid x+3)\wedge(17\mid x+2\vee17\mid x+3).\end{align}

  • 2
    I would just add that the two "parallel" solutions $x\equiv -2$ and $x\equiv -3$ immediately work $\bmod 187$. The two mixed solutions eg $x+2\equiv 0 \bmod 11, x+3\equiv 0 \bmod 17$ require a little more work to pin down. – Mark Bennet Jun 04 '19 at 15:44
  • 2
    @Mark Actually we only need to solve one of the mixed cases since their sum is $\equiv -5\pmod{187},,$ which yields the other case - see my answer. – Bill Dubuque Jun 04 '19 at 16:32
  • @BillDubuque noted - thanks. – Mark Bennet Jun 04 '19 at 16:35
2

$$x^2+5x+6\equiv187\equiv0 \pmod {187=11\times17}$$

$$(x+2)(x+3)\equiv 0 \pmod {11 , 17}$$

$$x\equiv-2 \text { or } -3 \pmod {11, 17}$$

Now use the Chinese Remainder Theorem.

J. W. Tanner
  • 60,406
0

Solve $x^2+5x+6 \equiv (x+2)(x+3) \pmod {187}$.

Besides the two 'in your face' solutions, $x \equiv -2 \pmod{187}$ and $x \equiv -3 \pmod{187}$, we can buttress the argument given by José Carlos Santos to find all four solutions.

We want to find integers $x, k, j$ satifying

$\;\text{L1:}\quad x + 2 = 11k$
$\;\text{L2:}\quad x + 3 = 17j$

Subtracting $\text{L1}$ from $\text{L2}$ we write

$\tag 1 1 = 17j - 11k$

Bézout's identity gives us

$\quad 1 = 17(2) - 11(3)$

So $k = 3$ and, plugging into $\text{L1}$, $x \equiv 31 \pmod{187}$ is a solution.

For the last solution,

$\;\text{L1:}\quad x + 2 = 17j$
$\;\text{L2:}\quad x + 3 = 11k$

Subtracting $\text{L1}$ from $\text{L2}$ we write

$\tag 2 1 = -17j + 11k$

Bézout's identity gives us

$\quad 1 = 17(2) - 11(3)$

So $k = -3$ and, plugging into $\text{L2}$, $x = -36 \equiv 151 \pmod{187}$ is a solution.

It can also be argued that there are exactly four solutions.

CopyPasteIt
  • 11,366