7

Now that I have plain old congruences, $19x\equiv 4 \pmod {141}$ for example, I am trying to wrap my brain around quadratic ones. My textbook shows how to tackle the aforementioned congruences, but not quadratic.

$$15x^2 + 19x\equiv 5 \pmod {11}$$

The book hints to show that would be equivalent to

$$15x^2 + 19x + 6\equiv 0 \pmod{11}$$

I have no idea how they got that. I've looked at previous answers, but I need a dumbed down version.

user26486
  • 11,331
  • 2
    Subtract $5$ from both sides and note that $,-5\equiv 6\pmod{11}.,$ If you continue by reducing the coefficients mod $11$ then you can get an easily recognizable factorization - see my answer. There, in a few places, I replace odd $,n,$ by the congruent even $,n\pm 11,$ to make arithmetic simpler. – Bill Dubuque Apr 23 '15 at 01:25

3 Answers3

14

$$15x^2+19x\equiv 5 \mod 11$$ is equivalent to $$15x^2+19x +6 \equiv 0 \mod 11$$ by the fact that we can subtract $5$ from both sides of the congruence (and $-5\equiv 6 \mod 11$).

From here, we factor $15x^2+19x+6$ to give $(3x+2)(5x+3)$. This means that our original quadratic congruence is equivalent to $$(3x+2)(5x+3)\equiv 0 \mod 11.$$ This will only hold true if $$3x+2 \equiv 0 \mod 11 \quad \text{or} \quad 5x+3 \equiv 0 \mod 11,$$ or equivalently $$3x\equiv 9 \mod 11 \quad \text{or} \quad 5x\equiv 8 \mod 11.$$

Since you're familiar with solving linear congruences, you should be able to solve these.

Hayden
  • 16,737
  • Can you point me to some resources on how to handle something like $x^2 + 1 = 0 \mod 11$? – r12 Apr 23 '15 at 05:06
  • For that one, there are a couple different things you can do. For that particular case (because $11$ is kind of small), you can just plug in all possible values to see if the congruence is satisfied. In general the technique is to use quadratic reciprocity, which can be used more general quadratic congruences. – Hayden Apr 23 '15 at 09:24
  • @Hayden Quadratic reciprocity can only be used to prove non-existence of solutions -- it can't be used for finding solutions. For finding what the solutions are, there are complicated methods explained here (and here it is said you can generalize it to finding the solutions to $x^d\equiv k\pmod {n}$ for any $d\ge 2$). – user26486 Apr 23 '15 at 17:19
  • @user31415 Yes, you're right that it can't be used to find solutions, but it does prove (non)-existence, which is useful to know before even trying to find a solution. I shouldn't have said that it is the technique without further qualification. For small values such as $11$, trial-and-error is probably easiest. – Hayden Apr 23 '15 at 17:49
  • This method will not be applicable if the congruence has no solutions. For the general method, see my answer. $x^2+a\equiv 0\pmod {p}$, $p$ odd prime can't be solved using a clear-cut simple algorithm and as I said in my comment above you'll have to use a complicated one or resort to using trial-and-error, which too is an algorithm, but can be lengthy if the prime is huge (note that only the first $\frac{p-1}{2}$ residues are required to check, since $a\bmod p$ is a solution iff $-a\bmod p$ is). – user26486 Apr 23 '15 at 19:23
  • The reason why my general method with quadratic formula won't solve $x^2+a\equiv 0\pmod {p}$, $p$ odd prime easily is because you need to find the fitting $z$, which is done exactly the same way as finding a fitting x in the first place. – user26486 Apr 23 '15 at 19:23
  • @user31415 Yes, Cipolla's algorithm can be used, but in order to use it one must still perform some trial-and-error. My guess, from what appears to be the OP's background, is that he won't be dealing with cases that aren't simple to just factor and reduce to linear congruences, or where the quadratic formula can be used easily (possible only for odd primes, of course). – Hayden Apr 23 '15 at 21:08
2

$0\equiv 4x^2\!+\!8x\!-\!5\equiv \overbrace{(2x)^2\!+\!4(2x)\!-\!5}^{\large X^2\ +\,\ 4\,X\,\ -\,\ 5\!\!\! }\equiv\overbrace{(2x\!+\!5)(2x\!-\!1)}^{\large (X\ +\ 5)\ (X\ -\ 1)}\,$ so $\,\begin{align} &2x\equiv\color{#c00}{-5}\equiv6\\ &2x\equiv\,\color{#c00} 1\,\equiv 12\end{align}\ $ so $\ x\equiv \ldots$


Or, complete the square $\,0\equiv 4x^2\!+\!8x\!-\!5\equiv (2x\!+\!2)^2\!-\!3^2$ so $\,2x\!+\!2\equiv \pm3\,$ so $\,2x\equiv\color{#c00}{ -5,1}\dots$


Or, apply the quadratic formula. First we make the lead coef $=1$ by scaling by $1/4\equiv 12/4\equiv3\,$ to get $\ 3(4x^2 + 8x - 5)\equiv x^2 + \color{#0a0}2\,x-4\equiv 0.\,$ It has discriminant $\, 2^2\!-4(-4)\equiv 20\equiv 9\equiv \color{#a0f}3^2,\,$ therefore the roots are $\,x\equiv(-\color{#0a0}2\pm\color{#a0f} 3)/2\equiv \{\color{#c00}{-5,1}\}/2\equiv \{6,12\}/2\equiv \{3,6\}$

Bill Dubuque
  • 272,048
2

Here is how to solve it generally. Every $\equiv$ here refers to equivalence $\!\bmod {p}$.

If $a\not\equiv 0$ with $p$ odd prime, then $$ax^2+bx+c\equiv 0\Leftrightarrow 4a^2x^2+4abx+4ac\equiv 0\Leftrightarrow (2ax+b)^2\equiv b^2-4ac$$

So for the congruence to have solutions, necessarily $b^2-4ac\equiv z^2$ for some $z\in\mathbb Z_p$.

$$\Leftrightarrow 2ax+b\equiv \pm z\Leftrightarrow x\equiv \frac{-b\pm z}{2a}$$

If $a\not\equiv 0$ with $p$ odd prime and $b^2-4ac\equiv z^2$ for some $z\in\mathbb Z_p$, then $$ax^2+bx+c\equiv 0\Leftrightarrow x\equiv \frac{-b\pm z}{2a}$$

If $a\equiv 0$ or $p=2$, the congruence is trivial, and if $\left(\frac{b^2-4ac}{p}\right)=-1$ (Legendre symbol, meaning $b^2-4ac$ is not a square $\!\bmod p$), $a\not\equiv 0,$ $p$ odd prime, it has no solutions.

In your case, $a\not\equiv 0$ with $p$ odd prime ($p=11, a\equiv 15, b\equiv 19, c\equiv 6$) and $b^2-4ac\equiv 1^2$, so we can use the theorem above:

$$15x^2+19x+6\equiv 0\Leftrightarrow x\equiv \frac{-19\pm 1}{2\cdot 15}\equiv\frac{3\pm 1}{-3}\equiv \{-4\cdot 3^{-1}, -2\cdot 3^{-1}\}\equiv \{6,3\}$$

Here I used $3(3^{-1})\equiv 1\equiv 12\Leftrightarrow 3^{-1}\equiv 4$.

user26486
  • 11,331