Congruence Equations

Definition

Congruence equation

For a positive integer mm and a univariate polynomial with integer coefficients f(x)=∑i=0naixif(x)=\sum_{i=0}^n a_ix^i, where the unknown x∈Zmx\in\mathbf{Z}_m, an equation of the form

f(x)≡0(modm)(1)f(x)\equiv 0\pmod m\tag{1}

is called a univariate congruence equation modulo mm in the unknown xx (Congruence Equation).

If an≢0(modm)a_n\not\equiv 0\pmod m, the above is called an nn-th degree congruence equation.

Systems of congruence equations can be defined similarly.

For related material on linear congruence equations and systems, see Linear Congruence Equations and the Chinese Remainder Theorem.

This article first studies the solvability and solution-set structure of congruence equations, and then briefly introduces methods for solving higher-degree congruence equations.

By the Chinese Remainder Theorem, solving a congruence equation modulo a composite number mm can be reduced to solving the cases modulo prime powers. Therefore, below we only introduce the relevant theory for congruence equations modulo prime powers and modulo primes.

Congruence equations modulo prime powers

Assume below that the modulus is m=pe (p∈P, e∈Z>1)m=p^e~(p\in\mathbf{P},~e\in\mathbf{Z}_{>1}).

Notice that if x0x_0 is a solution of

f(x)≡0(modpe)f(x)\equiv 0\pmod{p^e}

then x0x_0 is also a solution of

f(x)≡0(modpe−1)f(x)\equiv 0\pmod{p^{e-1}}

This suggests constructing solutions for higher powers of the modulus from solutions for lower powers. We have the following theorem:

Theorem 1 (Hensel's lemma)

For a prime pp and an integer e>1e>1, let the integer-coefficient polynomial be f(x)=∑i=0naixi (pe∤an)f(x)=\sum_{i=0}^na_ix^i~(p^e\nmid a_n), and let f′(x)=∑i=1niaixi−1f'(x)=\sum_{i=1}^nia_ix^{i-1} be its derivative. Let x0x_0 be a solution of

f(x)≡0(modpe−1)(2)f(x)\equiv 0\pmod{p^{e-1}}\tag{2}

Then:

  1. If f′(x0)≢0(modp)f'(x_0)\not\equiv 0\pmod p, there exists an integer tt such that

    x=x0+pe−1t(3)x=x_0+p^{e-1}t \tag{3}

    is a solution of

    f(x)≡0(modpe)(4)f(x)\equiv 0\pmod{p^e} \tag{4}
  2. If f′(x0)≡0(modp)f'(x_0)\equiv 0\pmod p and f(x0)≡0(modpe)f(x_0)\equiv 0\pmod{p^e}, then for t=0,1,…,p−1t=0,1,\dots,p-1, every xx determined by equation (3)(3) is a solution of equation (4)(4).

  3. If f′(x0)≡0(modp)f'(x_0)\equiv 0\pmod p and f(x0)≢0(modpe)f(x_0)\not\equiv 0\pmod{p^e}, then no solution of equation (4)(4) can be constructed from equation (3)(3).

Proof

Assume that equation (3)(3) is a solution of equation (4)(4), that is,

f(x0+pe−1t)≡0(modpe)f(x_0+p^{e-1}t)\equiv 0\pmod{p^e}

Rearranging gives

f(x0)+pe−1tf′(x0)≡0(modpe)f(x_0)+p^{e-1}tf'(x_0)\equiv 0\pmod{p^e}

Therefore

tf′(x0)≡−f(x0)pe−1(modp)(5)tf'(x_0)\equiv -\frac{f(x_0)}{p^{e-1}}\pmod p\tag{5}
  1. If f′(x0)≢0(modp)f'(x_0)\not\equiv 0\pmod p, equation (5)(5) in tt has a unique solution t0t_0, and substituting into equation (3)(3) verifies that it is a solution of equation (4)(4).
  2. If f′(x0)≡0(modp)f'(x_0)\equiv 0\pmod p and f(x0)≡0(modpe)f(x_0)\equiv 0\pmod{p^e}, every tt makes equation (5)(5) hold, and substituting into equation (3)(3) verifies that each is a solution of equation (4)(4).
  3. If f′(x0)≡0(modp)f'(x_0)\equiv 0\pmod p and f(x0)≢0(modpe)f(x_0)\not\equiv 0\pmod{p^e}, equation (5)(5) has no solution, so no solution of equation (4)(4) can be constructed from equation (3)(3).

We consequently have the following corollary:

Corollary 1

For the pp, ee, f(x)f(x), and x0x_0 of Theorem 1:

  1. If ss is a solution of f(x)≡0(modp)f(x)\equiv 0\pmod p and f′(s)≢0(modp)f'(s)\not\equiv 0\pmod p, there exists xs∈Zpex_s\in\mathbf{Z}_{p^e} with xs≡s(modp)x_s\equiv s\pmod p such that xsx_s is a solution of equation (4)(4).
  2. If f(x)≡0(modp)f(x)\equiv 0\pmod p and f′(x)≡0(modp)f'(x)\equiv 0\pmod p have no common solution, then equation (4)(4) and f(x)≡0(modp)f(x)\equiv 0\pmod p have the same number of solutions.

Thus, a congruence equation modulo a prime power can be reduced to the case of a congruence equation modulo a prime.

Congruence equations modulo primes

Let p∈Pp\in\mathbf{P}, let f(x)=∑i=0naixif(x)=\sum_{i=0}^na_ix^i be an integer-coefficient polynomial, where p∤anp\nmid a_n, and let x∈Zpx\in\mathbf{Z}_p.

Theorem 2

If

f(x)≡0(modp)(6)f(x)\equiv 0\pmod p\tag{6}

has kk distinct solutions x1,x2,…,xk (k≤n)x_1,x_2,\dots,x_k~(k\leq n), then

f(x)≡g(x)∏i=1k(x−xi)(modp),f(x)\equiv g(x)\prod_{i=1}^k(x-x_i)\pmod p,

where deg⁡g=n−k\deg g=n-k and [xn−k]g(x)=an[x^{n-k}]g(x)=a_n.

Proof

Apply mathematical induction on kk.

  • When k=1k=1, perform polynomial division with remainder: f(x)=(x−x1)g(x)+rf(x)=(x-x_1)g(x)+r, where r∈Zr\in\mathbf{Z}.

    Since f(x1)≡0(modp)f(x_1)\equiv 0\pmod p, we have r≡0(modp)r\equiv 0\pmod p, and therefore f(x)≡(x−x1)g(x)(modp)f(x)\equiv(x-x_1)g(x)\pmod p.

  • Assume the claim holds for k−1k-1 (k>1k>1). Now suppose f(x)f(x) has kk distinct solutions x1,x2,…,xkx_1,x_2,\dots,x_k. Then f(x)≡(x−x1)h(x)(modp)f(x)\equiv(x-x_1)h(x)\pmod p, and therefore

    (∀i=2,3,…,k),  0≡f(xi)≡(xi−x1)h(xi)(modp)(\forall i=2,3,\dots,k),~~0\equiv f(x_i)\equiv (x_i-x_1)h(x_i)\pmod p

    Thus h(x)h(x) has k−1k-1 distinct solutions x2,x3,…,xkx_2,x_3,\dots,x_k. By the induction hypothesis,

    h(x)≡g(x)∏i=2k(x−xi)(modp)h(x)\equiv g(x)\prod_{i=2}^k(x-x_i)\pmod p

    where deg⁡g=n−k\deg g=n-k and [xn−k]g(x)=an[x^{n-k}]g(x)=a_n.

    The claim follows.

Corollary 2

For a prime pp,

  • (∀x∈Z),  xp−1−1≡∏i=1p−1(x−i)(modp)(\forall x\in\mathbf{Z}),~~x^{p-1}-1 \equiv \prod_{i=1}^{p-1}(x-i)\pmod p.
  • (Wilson's theorem) (p−1)!≡−1(modp)(p-1)! \equiv -1 \pmod p.
Theorem 3 (Lagrange's theorem)

Equation (6)(6) has at most nn distinct solutions.

Proof

Suppose f(x)f(x) has n+1n+1 distinct solutions x1,x2,…,xn+1x_1,x_2,\dots,x_{n+1}. By Theorem 2, for x1,x2,…,xnx_1,x_2,\dots,x_n,

f(x)≡an∏i=1n(x−xi)(modp)f(x)\equiv a_n\prod_{i=1}^n(x-x_i)\pmod p

Let x=xn+1x=x_{n+1}. Then

0≡f(xn+1)≡an∏i=1n(xn+1−xi)(modp)0\equiv f(x_{n+1})\equiv a_n\prod_{i=1}^n(x_{n+1}-x_i)\pmod p

However, the right-hand side is clearly not a multiple of pp, a contradiction.

Corollary 3

If the number of solutions of the congruence equation ∑i=0nbixi≡0(modp)\sum_{i=0}^nb_ix^i\equiv 0\pmod p is greater than nn, then

(∀i=0,1,…,n),  p∣bi.(\forall i=0,1,\dots,n),~~p\mid b_i.
Theorem 4

If the number of solutions of equation (6)(6) is not pp, then there must exist a polynomial satisfying $\deg r [!note]+ Proof

Without loss of generality, let n≥pn\geq p. Divide f(x)f(x) by x^p-x with remainder

f(x)=g(x)(xp−x)+r(x)f(x)=g(x)\left(x^p-x\right)+r(x)

where deg⁡rBy[Fermat′slittletheorem](/knowledge−pages/math−number−theory−fermat),foreveryinteger\deg r By [Fermat's little theorem](/knowledge-pages/math-number-theory-fermat), for every integer x,, x^p\equiv x\pmod p$, so:

  • If r(x)≡0(modp)r(x)\equiv 0\pmod p, then by Corollary 2, f(x)f(x) has pp distinct solutions.
  • If r(x)≢0(modp)r(x)\not\equiv 0\pmod p, then f(x)≡r(x)(modp)f(x)\equiv r(x)\pmod p shows that f(x)f(x) and r(x)r(x) have the same solution set.

We can use this theorem to reduce the degree of a congruence equation.

Theorem 5

Let n≤pn\leq p. Then equation

xn+∑i=0n−1aixi≡0(modp)(7)x^n+\sum_{i=0}^{n-1}a_ix^i\equiv 0\pmod p\tag{7}

has nn solutions if and only if there exist integer-coefficient polynomials q(x)q(x) and r(x) (deg⁡r<n)r(x)~(\deg r < n) such that

xp−x=f(x)q(x)+pr(x).(8)x^p-x=f(x)q(x)+pr(x). \tag{8}
Proof
  • Necessity: polynomial division gives integer-coefficient polynomials q(x)q(x) and r1(x) (deg⁡r1<n)r_1(x)~(\deg r_1 < n) such that

    xp−x=f(x)q(x)+r1(x).x^p-x=f(x)q(x)+r_1(x).

    If equation (7)(7) has nn solutions, then r1≡0(modp)r_1\equiv 0\pmod p also has the same nn solutions. By Corollary 3, there is an integer-coefficient polynomial r(x)r(x) satisfying r1(x)=pr(x)r_1(x)=pr(x), proving the claim.

  • Sufficiency: If equation (8)(8) holds, then by Fermat's little theorem, for every integer xx,

    0≡xp−x≡f(x)q(x)(modp).0\equiv x^p-x\equiv f(x)q(x)\pmod p.

    Thus the equation f(x)q(x)≡0(modp)f(x)q(x)\equiv 0\pmod p has pp solutions.

    Let the number of solutions of equation (7)(7) be ss. By Lagrange's theorem, s≤ns\leq n.

    Since deg⁡q=p−n\deg q=p-n, Lagrange's theorem shows that the number of solutions of q(x)≡0(modp)q(x)\equiv 0\pmod p is at most p−np-n. The solution set of f(x)q(x)≡0(modp)f(x)q(x)\equiv 0\pmod p is the union of the solution sets of f(x)≡0(modp)f(x)\equiv 0\pmod p and q(x)≡0(modp)q(x)\equiv 0\pmod p, so s+(p−n)≥ps+(p-n)\geq p, and s≥ns\geq n.

    Therefore s=ns=n.

For a non-monic polynomial, since Zp\mathbf{Z}_p is a field, it can be converted into a monic polynomial, so the theorem applies.

Theorem 6

Let n∣p−1n\mid p-1 and p∤ap\nmid a. Then equation

xn≡a(modp)(9)x^n\equiv a\pmod p\tag{9}

has a solution if and only if

ap−1n≡1(modp).a^{\frac{p-1}{n}}\equiv 1\pmod p.

Moreover, if (9)(9) has a solution, the number of solutions is nn.

Note

For the concrete structure of the solution set of equation (9)(9), see k-th power residues.

Proof
  • Necessity: If equation (9)(9) has a solution x0x_0, then

    ap−1n≡(x0n)p−1n≡1(modp)a^{\frac{p-1}{n}}\equiv {\left(x_0^n\right)}^{\frac{p-1}{n}}\equiv 1\pmod p
  • Sufficiency: If ap−1n≡1(modp)a^{\frac{p-1}{n}}\equiv 1\pmod p, then

    xp−x=x(xp−1−1)=x((xn)p−1n−ap−1n+ap−1n−1)=(xn−a)P(x)+x(ap−1n−1)\begin{aligned} x^p-x&=x\left(x^{p-1}-1\right)\\ &=x\left(\left(x^n\right)^{\frac{p-1}{n}}-a^{\frac{p-1}{n}}+a^{\frac{p-1}{n}}-1\right)\\ &=\left(x^n-a\right)P(x)+x\left(a^{\frac{p-1}{n}}-1\right)\\ \end{aligned}

    where P(x)P(x) is an integer-coefficient polynomial. Therefore, by Theorem 5, equation (9)(9) has nn solutions.

Methods for solving higher-degree congruence equations (and systems)

First, use the Chinese Remainder Theorem to convert solving a system of congruence equations into solving a congruence equation, and convert solving a congruence equation modulo a composite number mm into solving one modulo a prime power. Then use Theorem 1 to convert solving a congruence equation modulo a prime power into solving one modulo a prime.

Combining several theorems for congruence equations modulo primes, we only need to consider solving

xn+∑i=0n−1aixi≡0(modp)x^n+\sum_{i=0}^{n-1}a_ix^i\equiv 0\pmod p

where pp is prime and n<pn<p.

We can eliminate the xn−1x^{n-1} term by substituting xx with x−an−1nx-\dfrac{a_{n-1}}{n}, so we only need to consider solving

xn+∑i=0n−2aixi≡0(modp)(10)x^n+\sum_{i=0}^{n-2}a_ix^i\equiv 0\pmod p\tag{10}

where pp is prime and n<pn<p.

References

  1. Congruence Equation -- from Wolfram MathWorld
  2. Lagrange's theorem (number theory) - Wikipedia
  3. Pan Chengdong, Pan Chengbiao. Elementary Number Theory.
  4. Feng Keqin. Elementary Number Theory and Its Applications.
  5. Min Sihe, Yan Shijian. Elementary Number Theory.

This content comes from OI Wiki: Congruence Equations. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.