1.4.1. Quadratic congruences and Euler’s Criterion

This section is based on [BUR11, Sec. 9.1].

Recall that the equation

a⁢x2+b⁢x+c=0,a,b,c∈ℝ,a≠0,ax^{2}+bx+c=0,\qquad a,b,c\in\mathbb{R},\ a\neq 0,

has the (complex) solutions

x0=−b+b2−4⁢a⁢c2⁢aandx1=−b−b2−4⁢a⁢c2⁢a.x_{0}=\frac{-b+\sqrt{b^{2}-4ac}}{2a}\qquad\text{and}\qquad x_{1}=\frac{-b-% \sqrt{b^{2}-4ac}}{2a}.

In particular, the equation has no real solutions if b2−4⁢a⁢c<0{b^{2}-4ac<0}, and it has only one solution, of multiplicity 22, if b2−4⁢a⁢c=0{b^{2}-4ac=0}. Our first aim is to establish a similar criterion for quadratic congruences (Theorem 1.4.1.4).

Proposition 1.4.1.1.

Let pp be an odd prime and a,b,c∈ℤ{a,b,c\in\mathbb{Z}} with a≢0(modp){a\not\equiv 0{\pmod{p}}}. The quadratic congruences

a⁢x2+b⁢x+c≡0(modp)ax^{2}+bx+c\equiv 0{\pmod{p}} (1.4.1.2)

and

(2⁢a⁢x+b)2≡b2−4⁢a⁢c(modp)(2ax+b)^{2}\equiv b^{2}-4ac{\pmod{p}} (1.4.1.3)

are equivalent.

Proof.

Recall the standard method for deriving the quadratic formula:

a⁢x2+b⁢x+c=0\displaystyle ax^{2}+bx+c=0 ⟺4⁢a⁢(a⁢x2+b⁢x+c)=0\displaystyle\Longleftrightarrow 4a(ax^{2}+bx+c)=0
⟺4⁢a2⁢x2+4⁢a⁢b⁢x+4⁢a⁢c=0\displaystyle\Longleftrightarrow 4a^{2}x^{2}+4abx+4ac=0
⟺4⁢a2⁢x2+4⁢a⁢b⁢x=−4⁢a⁢c\displaystyle\Longleftrightarrow 4a^{2}x^{2}+4abx=-4ac
⟺4⁢a2⁢x2+4⁢a⁢b⁢x+b2=b2−4⁢a⁢c\displaystyle\Longleftrightarrow 4a^{2}x^{2}+4abx+b^{2}=b^{2}-4ac
⟺(2⁢a⁢x+b)2=b2−4⁢a⁢c.\displaystyle\Longleftrightarrow(2ax+b)^{2}=b^{2}-4ac.

Since pp is odd and a≢0(modp){a\not\equiv 0{\pmod{p}}}, Euclid’s Lemma (Theorem 1.1.4.2) yields 4⁢a≢0(modp){4a\not\equiv 0{\pmod{p}}}. Hence, by Corollary 1.2.1.11, the first equivalence remains valid when considered modulo pp (the others clearly do). Thus, the quadratic congruences (1.4.1.2) and (1.4.1.3) are equivalent. ∎

Theorem 1.4.1.4.

Let pp be an odd prime and a,b,c∈ℤ{a,b,c\in\mathbb{Z}} with a≢0(modp){a\not\equiv 0{\pmod{p}}}. Consider the quadratic congruence

a⁢x2+b⁢x+c≡0(modp).ax^{2}+bx+c\equiv 0{\pmod{p}}. (1.4.1.5)

Set Δ≔b2−4⁢a⁢c{\Delta\coloneqq b^{2}-4ac}. The following statements hold:

  1. (1)
    ​

    The quadratic congruence (1.4.1.5) has a solution if and only if the quadratic congruence

    y2≡Δ(modp)y^{2}\equiv\Delta{\pmod{p}}

    has a solution. More precisely, these two quadratic congruences have the same number of distinct solutions modulo pp.

  2. (2)
    ​

    If Δ≡0(modp){\Delta\equiv 0{\pmod{p}}}, then the quadratic congruence (1.4.1.5) admits a unique solution modulo pp. This solution is given by the unique solution to the linear congruence

    2⁢a⁢x≡−b(modp).2ax\equiv-b{\pmod{p}}.
  3. (3)
    ​

    Suppose that Δ≢0(modp){\Delta\not\equiv 0{\pmod{p}}} and the quadratic congruence

    y2≡Δ(modp)y^{2}\equiv\Delta{\pmod{p}}

    admits a solution y0y_{0}. Then, the quadratic congruence (1.4.1.5) admits exactly two non-congruent solutions modulo pp, and these are given by the unique solutions to the linear congruences

    2⁢a⁢x≡y0−b(modp)and2⁢a⁢x≡y1−b(modp),2ax\equiv y_{0}-b{\pmod{p}}\qquad\text{and}\qquad 2ax\equiv y_{1}-b{\pmod{p}},

    where y1≔p−y0{y_{1}\coloneqq p-y_{0}}.

Proof.

Recall that, by Lagrange’s Theorem (Theorem 1.3.3.2), the quadratic congruence (1.4.1.5) admits at most 22 distinct solutions modulo pp.

(1) By Proposition 1.4.1.1, the quadratic congruence (1.4.1.5) is equivalent to the quadratic congruence

(2⁢a⁢x+b)2≡Δ(modp).(2ax+b)^{2}\equiv\Delta{\pmod{p}}.

The claim follows from the following observations:

  • •
    ​

    For x0,x1∈ℤ{x_{0},x_{1}\in\mathbb{Z}}, since gcd⁡(2⁢a,p)=1{\gcd(2a,p)=1}, we have

    x0≡x1(modp)⟺2⁢a⁢x0+b≡2⁢a⁢x1+b(modp).x_{0}\equiv x_{1}{\pmod{p}}\quad\Longleftrightarrow\quad 2ax_{0}+b\equiv 2ax_{% 1}+b{\pmod{p}}.
  • •
    ​

    By Corollary 1.2.2.6, given y0∈ℤ{y_{0}\in\mathbb{Z}}, the linear congruence

    2⁢a⁢x+b≡y0(modp),2ax+b\equiv y_{0}{\pmod{p}},

    which is equivalent to

    2⁢a⁢x≡y0−b(modp),2ax\equiv y_{0}-b{\pmod{p}},

    admits a unique solution modulo pp.

Therefore, the map x0↦2⁢a⁢x0+b{x_{0}\mapsto 2ax_{0}+b} induces a bijection between the solutions modulo pp of the quadratic congruence (1.4.1.5) and those of the quadratic congruence y2≡Δ(modp){y^{2}\equiv\Delta{\pmod{p}}}.

End of Lecture 13

(2) If Δ≡0(modp){\Delta\equiv 0{\pmod{p}}}, then 0 is clearly the only solution modulo pp to the congruence

y2≡Δ(modp).y^{2}\equiv\Delta{\pmod{p}}.

Indeed, by Euclid’s Lemma (Theorem 1.1.4.2), if yy is an integer such that p∣y2{p\mid y^{2}}, then p∣y{p\mid y}. By the previous argument, the unique solution to the linear congruence

2⁢a⁢x≡−b(modp)2ax\equiv-b{\pmod{p}}

is the unique solution modulo pp to the quadratic congruence (1.4.1.5).

(3) Suppose now that Δ≢0(modp){\Delta\not\equiv 0{\pmod{p}}} and that the quadratic congruence y2≡Δ(modp){y^{2}\equiv\Delta{\pmod{p}}} admits a solution y0y_{0}. Set y1≔p−y0{y_{1}\coloneqq p-y_{0}}. Since

y12−y02=(p−y0)2−y02=p2−2⁢p⁢y0=(p−2⁢y0)⁢p,y_{1}^{2}-y_{0}^{2}=(p-y_{0})^{2}-y_{0}^{2}=p^{2}-2py_{0}=(p-2y_{0})p,

we have y02≡y12(modp){y_{0}^{2}\equiv y_{1}^{2}{\pmod{p}}}. Consequently, y1y_{1} is also a solution to the quadratic congruence

y2≡Δ(modp).y^{2}\equiv\Delta{\pmod{p}}.

Moreover, y0≢y1(modp){y_{0}\not\equiv y_{1}{\pmod{p}}}. Otherwise,

y0−y1=y0−(p−y0)=2⁢y0−py_{0}-y_{1}=y_{0}-(p-y_{0})=2y_{0}-p

would be divisible by pp, and hence y0y_{0} itself would be divisible by pp since the prime pp is odd, by Euclid’s Lemma (Theorem 1.1.4.2). This is impossible since y02≡Δ(modp){y_{0}^{2}\equiv\Delta{\pmod{p}}} and Δ≢0(modp){\Delta\not\equiv 0{\pmod{p}}} by assumption. In view of (1) and its proof, this finishes the proof of statement (3). ∎

We illustrate Theorem 1.4.1.4 in an example.

Example 1.4.1.6.

Not covered in the lecture Let p=13{p=13} and consider the quadratic congruence

3⁢x2+5⁢x+4≡0(mod13).3x^{2}+5x+4\equiv 0{\pmod{13}}.

We have a=3{a=3}, b=5{b=5} and c=4{c=4}. Then,

Δ=b2−4⁢a⁢c=52−4⋅3⋅4=25−48=−23\Delta=b^{2}-4ac=5^{2}-4\cdot 3\cdot 4=25-48=-23

clearly satisfies Δ≡3(mod13){\Delta\equiv 3{\pmod{13}}}. We therefore need to solve the quadratic congruence

y2≡3(mod13),y^{2}\equiv 3{\pmod{13}},

which has the solution y0=4{y_{0}=4}. Set y1≔13−4=9{y_{1}\coloneqq 13-4=9}. The solutions to the original quadratic congruence are, by Theorem 1.4.1.4(3), the solutions to the linear congruences

6⁢x≡−1(mod13)and6⁢x≡4(mod13).6x\equiv-1{\pmod{13}}\qquad\text{and}\qquad 6x\equiv 4{\pmod{13}}.

We calculated in Example 1.2.2.9 that 6⋅(−2)≡1(mod13){6\cdot(-2)\equiv 1{\pmod{13}}}. Hence, the solutions to these linear congruences are, respectively,

x0=2andx1=−8.x_{0}=2\qquad\text{and}\qquad x_{1}=-8.

Since −8≡5(mod13){-8\equiv 5{\pmod{13}}}, we may replace x1=−8{x_{1}=-8} by x1′=5{x_{1}^{\prime}=5}. In contrast, since Δ<0{\Delta<0}, the quadratic equation 3⁢x2+5⁢x+4=0{3x^{2}+5x+4=0} has no solutions in the real numbers.

Motivated by Theorem 1.4.1.4, we aim to determine a criterion for a quadratic congruence of the form x2≡a(modp){x^{2}\equiv a{\pmod{p}}}, where pp is an odd prime, to admit a solution.

Definition 1.4.1.7.

Let pp be an odd prime and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,p)=1{\gcd(a,p)=1}. We say that aa is a quadratic residue modulo pp if the congruence x2≡a(modp){x^{2}\equiv a{\pmod{p}}} has a solution. Otherwise, aa is a quadratic non-residue modulo pp.

Remark 1.4.1.8.

Let pp be an odd prime and a,b∈ℤ{a,b\in\mathbb{Z}} with gcd⁡(a,p)=1{\gcd(a,p)=1} and gcd⁡(b,p)=1{\gcd(b,p)=1}. If a≡b(modp){a\equiv b{\pmod{p}}}, then aa is a quadratic residue modulo pp if and only if bb is a quadratic residue modulo pp. For example, for p=3p=3, we have 2≡−1(mod3){2\equiv-1{\pmod{3}}}. Since 12=−12=1{1^{2}=-1^{2}=1}, we see that neither 22 nor −1-1 are quadratic residues modulo 33.

Theorem 1.4.1.9 (Euler’s Criterion).

Let pp be an odd prime, so that (p−1)/2{(p-1)/2} is an integer, and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,p)=1{\gcd(a,p)=1}. Then aa is a quadratic residue modulo pp if and only if

a(p−1)/2≡1(modp).a^{(p-1)/2}\equiv 1{\pmod{p}}.

Exercise. The proof will be added later.

Corollary 1.4.1.10.

Let pp be an odd prime and a∈ℤ{a\in\mathbb{Z}} with gcd⁡(a,p)=1{\gcd(a,p)=1}. Then

a(p−1)/2≡{1(modp)a is a quadratic residue modulo p−1(modp)a is a quadratic non-residue modulo p.a^{(p-1)/2}\equiv\begin{cases}1{\pmod{p}}&\text{$a$ is a quadratic residue % modulo $p$}\\ -1{\pmod{p}}&\text{$a$ is a quadratic non-residue modulo $p$}.\end{cases}
Proof.

Notice that

ap−1−1=(a(p−1)/2−1)⁢(a(p−1)/2+1).a^{p-1}-1=(a^{(p-1)/2}-1)(a^{(p-1)/2}+1).

Moreover, since gcd⁡(a,p)=1{\gcd(a,p)=1}, Fermat’s Little Theorem (Corollary 1.2.3.2) shows that pp divides ap−1−1{a^{p-1}-1}. By Euclid’s Lemma (Theorem 1.1.4.2), the prime pp divides one of the integers a(p−1)/2−1{a^{(p-1)/2}-1} and a(p−1)/2+1{a^{(p-1)/2}+1}. It cannot divide both, since it would then divide their difference

(a(p−1)/2+1)−(a(p−1)/2−1)=2,(a^{(p-1)/2}+1)-(a^{(p-1)/2}-1)=2,

but pp is odd. Therefore, exactly one of the congruences

a(p−1)/2≡1(modp)anda(p−1)/2≡−1(modp)a^{(p-1)/2}\equiv 1{\pmod{p}}\qquad\text{and}\qquad a^{(p-1)/2}\equiv-1{\pmod{% p}}

holds. The claim then follows from Euler’s Criterion (Theorem 1.4.1.9). ∎

We illustrate Euler’s Criterion (Corollary 1.4.1.10) in some examples.

Example 1.4.1.11.

Not covered in the lecture Let p=11{p=11}.

  • •
    ​

    Let a=3{a=3}. The quadratic congruence y2≡3(mod11){y^{2}\equiv 3{\pmod{11}}} has the solution y=5{y=5}, and hence 33 is a quadratic residue modulo 1111. Euler’s Criterion (Corollary 1.4.1.10) yields the congruence

    35≡1(mod11).3^{5}\equiv 1{\pmod{11}}.

    Indeed, since 33≡5(mod11){3^{3}\equiv 5{\pmod{11}}} and 35=32⋅33{3^{5}=3^{2}\cdot 3^{3}}, we have

    35≡32⋅5(mod11).3^{5}\equiv 3^{2}\cdot 5{\pmod{11}}.

    Finally, 45=32⋅5=4⋅11+1{45=3^{2}\cdot 5=4\cdot 11+1}, so that 45≡1(mod11){45\equiv 1{\pmod{11}}}.

  • •
    ​

    In contrast, for a=2{a=2} we have 25=32=3⋅11−1{2^{5}=32=3\cdot 11-1}, and hence

    25≡−1(mod11).2^{5}\equiv-1{\pmod{11}}.

    Therefore, 22 is a quadratic non-residue modulo 1111.

Example 1.4.1.12.

Not covered in the lecture Let p=13{p=13}.

  • •
    ​

    Let a=3{a=3}. The quadratic congruence y2≡3(mod13){y^{2}\equiv 3{\pmod{13}}} has the solution y=4{y=4}, and hence 33 is a quadratic residue modulo 1313. Euler’s Criterion (Corollary 1.4.1.10) yields the congruence

    36≡1(mod13).3^{6}\equiv 1{\pmod{13}}.
  • •
    ​

    In contrast, for a=2{a=2} we have 26=64=5⋅13−1{2^{6}=64=5\cdot 13-1}, and hence

    26≡−1(mod13).2^{6}\equiv-1{\pmod{13}}.

    Therefore, 22 is a quadratic non-residue modulo 1313.