Algorithm Search⌘K

Proofs: Distinct-degree factorization

These are the human proofs of Distinct-degree factorization, at full length.

DISTINCT-DEGREE returns the products of the irreducible factors of each degree full

This proof shows: correctness.

Let pp be a prime, Fp=Z/pZ\mathbb{F}_p = \mathbb{Z}/p\mathbb{Z}, and f∈Fp[x]f \in \mathbb{F}_p[x] monic and square-free of degree nn. Write f=q1⋯qsf = q_1 \cdots q_s with distinct monic irreducible qjq_j.

Lemma 1 (Frobenius). Let q∈Fp[x]q \in \mathbb{F}_p[x] be monic irreducible of degree dd and i≥1i \ge 1. Then xpi≡x(modq)x^{p^i} \equiv x \pmod q if and only if d∣id \mid i.

Proof. K=Fp[x]/(q)K = \mathbb{F}_p[x]/(q) is a field with pdp^d elements, and α=x mod q\alpha = x \bmod q generates it over Fp\mathbb{F}_p. The map φ(y)=yp\varphi(y) = y^p is a ring homomorphism of KK, since (y+z)p=yp+zp(y + z)^p = y^p + z^p in characteristic pp, and it fixes Fp\mathbb{F}_p by Fermat's little theorem. The nonzero elements form a group of order pd−1p^d - 1, so ypd=yy^{p^d} = y for all y∈Ky \in K, that is, φd=id\varphi^d = \mathrm{id}. For 1≤k<d1 \le k < d, the polynomial ypk−yy^{p^k} - y has at most pk<pdp^k < p^d roots in KK, so φk≠id\varphi^k \ne \mathrm{id}. Hence φ\varphi has order exactly dd as an element of the group of automorphisms of KK. A ring homomorphism that fixes Fp\mathbb{F}_p and α\alpha fixes every polynomial expression in α\alpha, which is all of KK. So αpi=α\alpha^{p^i} = \alpha if and only if φi=id\varphi^i = \mathrm{id}, if and only if d∣id \mid i. □\square

Lemma 2. For i≥1i \ge 1 and a monic square-free rr whose irreducible factors all have degree at least ii, gcd⁡(xpi−x,r)\gcd(x^{p^i} - x, r) is the product of the irreducible factors of rr of degree exactly ii.

Proof. The polynomial xpi−xx^{p^i} - x has derivative pixpi−1−1=−1p^i x^{p^i - 1} - 1 = -1, so it is square-free. Each irreducible factor qq of rr divides xpi−xx^{p^i} - x exactly when deg⁡q∣i\deg q \mid i, by Lemma 1. As rr is square-free, the gcd is the product of the factors of rr with deg⁡q∣i\deg q \mid i. Since deg⁡q≥i\deg q \ge i, deg⁡q∣i\deg q \mid i means deg⁡q=i\deg q = i. □\square

Invariant. Before the test at line L2, with the current ii (the number of completed iterations):

  1. rr is the product of the qjq_j with deg⁡qj≥i+1\deg q_j \ge i + 1;
  2. h≡xpi(modr)h \equiv x^{p^i} \pmod r and deg⁡h<deg⁡r\deg h < \deg r (or h=0h = 0 when r=1r = 1);
  3. the output so far is the list of pairs (gk,k)(g_k, k), k≤ik \le i, with gk≠1g_k \ne 1, where gkg_k is the product of the qjq_j of degree kk.

Initialization. With i=0i = 0, r=fr = f contains all factors, which have degree at least 11, h=x mod f=xp0 mod rh = x \bmod f = x^{p^0} \bmod r, and the output is empty.

Maintenance. Line L3 sets i←i+1i \leftarrow i + 1; now rr is the product of the factors of degree at least ii and h≡xpi−1h \equiv x^{p^{i-1}}. Line L4 gives h≡(xpi−1)p=xpi(modr)h \equiv (x^{p^{i-1}})^p = x^{p^i} \pmod r. Since h−x≡xpi−x(modr)h - x \equiv x^{p^i} - x \pmod r, line L5 computes g=gcd⁡(xpi−x,r)g = \gcd(x^{p^i} - x, r), which by Lemma 2 is the product gig_i of the factors of degree ii. If g≠1g \ne 1, line L6 outputs (gi,i)(g_i, i) and removes these factors from rr, so rr becomes the product of the factors of degree at least i+1i + 1; since the new rr divides the old one, h mod rh \bmod r is still ≡xpi\equiv x^{p^i}. If g=1g = 1, there are no factors of degree ii and rr is already the product of those of degree at least i+1i + 1. So the invariant holds again.

Termination. Every iteration increases ii, and the loop stops when 2(i+1)>deg⁡r2(i + 1) > \deg r, which happens for i≥n/2i \ge n/2 at the latest. So there are at most ⌊n/2⌋\lfloor n/2 \rfloor iterations.

The rest. When the loop stops, every factor of rr has degree at least i+1i + 1 by part 1, and deg⁡r<2(i+1)\deg r < 2(i + 1). If rr had two or more factors, deg⁡r\deg r would be at least 2(i+1)2(i + 1). So r=1r = 1 or rr is irreducible of degree deg⁡r≥i+1\deg r \ge i + 1. In the second case rr is the only factor of ff of its degree, so gdeg⁡r=rg_{\deg r} = r, and line L7 outputs (r,deg⁡r)(r, \deg r). Together with part 3, the output lists every gk≠1g_k \ne 1 exactly once, in increasing order of kk. ■\blacksquare

Back to Distinct-degree factorization