Factorization of polynomials over finite fields: Difference between revisions

Content deleted Content added
Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
(15 intermediate revisions by 12 users not shown)
Line 6:
As the reduction of the factorization of [[multivariate polynomial]]s to that of univariate polynomials does not have any specificity in the case of coefficients in a finite field, only polynomials with one variable are considered in this article.
 
== Background ==
 
=== Finite field ===
{{main article|Finite field}}
The theory of finite fields, whose origins can be traced back to the works of [[Gauss]] and [[Galois]], has played a part in various branches of mathematics. Due to the applicability of the concept in other topics of mathematics and sciences like computer science there has been a resurgence of interest in finite fields and this is partly due to important applications in [[coding theory]] and [[cryptography]]. Applications of finite fields introduce some of these developments in [[cryptography]], [[computer algebra]] and [[coding theory]].
 
A finite field or [[Galois field]] is a field with a [[Wikt:finite|finite]] order (number of elements). The order of a finite field is always a [[Prime number|prime]] or a power of prime. For each [[prime power]] {{nowrap|1=''q'' = ''p''<sup>''r''</sup>''}}, there exists exactly one finite field with ''q'' elements, [[up to]] isomorphism. This field is denoted ''GF''(''q'') or '''F'''<sub>''q''</sub>. If ''p'' is prime, ''GF''(''p'') is the [[prime field]] of order ''p''; it is the field of [[residue class#Ring of congruence classes|residue class]]es modulo ''p'', and its ''p'' elements are denoted 0, 1, ..., ''p''−1. Thus {{nowrap|1=''a''&nbsp; =&nbsp; ''b''}} in ''GF''(''p'') means the same as {{nowrap|''a'' ≡ ''b'' (mod ''p'')}}.
 
=== Irreducible polynomials ===
Let ''F'' be a finite field. As for general fields, a non-constant polynomial ''f'' in ''F''[''x''] is said to be [[irreducible polynomial|irreducible]] over ''F'' if it is not the product of two polynomials of positive degree. A polynomial of positive degree that is not irreducible over ''F'' is called ''reducible over'' ''F''.
 
Irreducible polynomials allow us to construct the finite fields of non-prime order. In fact, for a prime power ''q'', let '''F'''<sub>''q''</sub> be the finite field with ''q'' elements, unique up to isomorphism. A polynomial ''f'' of degree ''n'' greater than one, which is irreducible over '''F'''<sub>''q''</sub>, defines a field extension of degree ''n'' which is isomorphic to the field with ''q''<sup>''n''</sup> elements: the elements of this extension are the polynomials of degree lower than ''n''; addition, subtraction and multiplication by an element of '''F'''<sub>''q''</sub> are those of the polynomials; the product of two elements is the remainder of the division by ''f'' of their product as polynomials; the inverse of an element may be computed by the extended GCD algorithm (see [[Polynomial greatest common divisor|Arithmetic of algebraic extensions]]).
 
It follows that, to compute in a finite field of non prime order, one needs to generate an irreducible polynomial. For this, the common method is to take a polynomial at random and test it for irreducibility. For sake of efficiency of the multiplication in the field, it is usual to search for polynomials of the shape ''x''<sup>''n''</sup> + ''ax'' + ''b''.{{Citation needed|date=February 2014}}<ref>{{Cite web |title=Reducibility over $\mathbb{Z}_2$? |url=https://math.stackexchange.com/questions/28281/reducibility-over-mathbbz-2 |access-date=2023-09-10 |website=Mathematics Stack Exchange |language=en}}</ref>
 
Irreducible polynomials over finite fields are also useful for [[Pseudorandompseudorandom]] number generators using feedback shift registers and [[discrete logarithm]] over '''F'''<sub>2<sup>''n''</sup></sub>.
 
The number of irreducible [[monic polynomial]]s of degree n over '''F'''<sub>''q''</sub> is the number of [[Necklace (combinatorics)#Aperiodic necklaces|aperiodic necklaces]], given by [[Necklace polynomial|Moreau's necklace-counting function]] ''M''<sub>''q''</sub>(''n''). The closely related necklace function ''N''<sub>''q''</sub>(''n'') counts monic polynomials of degree ''n'' which are primary (a power of an irreducible); or alternatively irreducible polynomials of all degrees d which divide n.<ref>Christophe Reutenauer, ''Mots circulaires et polynomes irreductibles'', Ann. Sci. math Quebec, vol 12, no 2, pp. 275-285</ref>
 
=== Example ===
The polynomial {{nowrap|1=''P'' = ''x''<sup>4</sup> + 1}} is irreducible over '''Q''' but not over any finite field.
 
* On any field extension of '''F'''<sub>2</sub>, {{nowrap|1=''P'' = (''x'' + 1)<sup>4</sup>}}.
* On every other finite field, at least one of −1, 2 and −2 is a square, because the product of two non-squares is a square and so we have
# If <math>-1=a^2,</math> then <math>P=(x^2+a)(x^2-a).</math>
# If <math>2=b^2,</math> then <math>P=(x^2+bx+1)(x^2-bx+1).</math>
# If <math>-2=c^2,</math> then <math>P=(x^2+cx-1)(x^2-cx-1).</math>
 
=== Complexity ===
Polynomial factoring algorithms use basic polynomial operations such as products, divisions, gcd, powers of one polynomial modulo another, etc. A [[Multiplication algorithm#Polynomial multiplication|multiplication]] of two polynomials of degree at most ''n'' can be done in [[Big O notation|''O''(''n''<sup>2</sup>)]] operations in '''F'''<sub>''q''</sub> using "classical" arithmetic, or in ''O''(''n''log(''n'') log(log(''n'')) ) operations in '''F'''<sub>''q''</sub> using [[Multiplication algorithm#Fast multiplication algorithms for large inputs|"fast" arithmetic]]. A [[Euclidean division]] (division with remainder) can be performed within the same time bounds. The cost of a [[polynomial greatest common divisor]] between two polynomials of degree at most ''n'' can be taken as ''O''(''n''<sup>2</sup>) operations in '''F'''<sub>''q''</sub> using classical methods, or as ''O''(''n''log<sup>2</sup>(''n'') log(log(''n'')) ) operations in '''F'''<sub>''q''</sub> using fast methods. For polynomials ''h'', ''g'' of degree at most ''n'', the exponentiation ''h<sup>q</sup>'' mod ''g'' can be done with ''O''(log(''q'')) polynomial products, using [[exponentiation by squaring]] method, that is ''O''(''n''<sup>2</sup>log(''q'')) operations in '''F'''<sub>''q''</sub> using classical methods, or ''O''(''n''log(''q'')log(''n'') log(log(''n''))) operations in '''F'''<sub>''q''</sub> using fast methods.
 
In the algorithms that follow, the complexities are expressed in terms of number of arithmetic operations in '''F'''<sub>''q''</sub>, using classical algorithms for the arithmetic of polynomials.
 
== Factoring algorithms ==
Many algorithms for factoring polynomials over finite fields include the following three stages:
# [[#Square-free factorization|Square-free factorization]]
Line 46:
An important exception is [[Berlekamp's algorithm]], which combines stages 2 and 3.
 
=== Berlekamp's algorithm ===
{{main article|Berlekamp's algorithm}}
 
The Berlekamp's algorithm is historically important as being the first factorization algorithm, which works well in practice. However, it contains a loop on the elements of the ground field, which implies that it is practicable only over small finite fields. For a fixed ground field, its [[time complexity]] is polynomial, but, for general ground fields, the complexity is exponential in the size of the ground field.
 
=== Square-free factorization ===
{{main|Square-free factorization}}
The algorithm determines a [[square-free polynomial|square-free]] factorization for polynomials whose coefficients come from the finite field '''F'''<sub>''q''</sub> of order {{nowrap|1=''q'' = ''p''<sup>''m''</sup>''}} with ''p'' a prime. This algorithm firstly determines the [[derivative]] and then computes the gcd of the polynomial and its derivative. If it is not one then the gcd is again divided into the original polynomial, provided that the derivative is not zero (a case that exists for non-constant polynomials defined over finite fields).
 
This algorithm uses the fact that, if the derivative of a polynomial is zero, then it is a polynomial in ''x''<sup>''p''</sup>, which is, if the coefficients belong to '''F'''<sub>''p''</sub>, the ''p''th power of the polynomial obtained by substituting ''x'' by ''x''<sup>1/''p''</sup>. If the coefficients do not belong to '''F'''<sub>''p''</sub>, the ''p''-th root of a polynomial with zero derivative is obtained by the same substitution on ''x'', completed by applying the inverse of the [[Frobenius endomorphism|Frobenius automorphism]] to the coefficients. {{Citation needed|date=December 2020}}
 
This algorithm works also over a field of [[characteristic (algebra)|characteristic]] zero, with the only difference that it never enters in the blocks of instructions where ''p''th roots are computed. However, in this case, [[Square-free polynomial#Yun's algorithm|Yun's algorithm]] is much more efficient because it computes the greatest common divisors of polynomials of lower degrees. A consequence is that, when factoring a polynomial over the integers, the algorithm which follows is not used: one first computes the square-free factorization over the integers, and to factor the resulting polynomials, one chooses a ''p'' such that they remain square-free modulo ''p''.
'''Algorithm''': '''SFF''' (Square-Free Factorization)
'''Input''': A [[monic polynomial]] ''f'' in '''F'''<sub>''q''</sub>[''x''] where ''q'' = ''p''<sup>''m''</sup>''
'''Output''': Square-free factorization of ''f''
''R'' ← 1
Line 68 ⟶ 69:
# Step 1: Identify all factors in ''w''
''i''←1 ← 1
'''while''' ''w'' ≠ 1 '''do'''
''y'' ← '''gcd'''(''w'', ''c'')
''fac'' ← ''w'' / ''y''
''R'' ← ''R'' · ''fac''<sup>''i''</sup>
''w'' ← ''y''; ''c'' ← ''c'' / ''y''; ''i'' ← ''i+1'' + 1
'''end while'''
# ''c'' is now the product (with multiplicity) of the remaining factors of ''f''
Line 86 ⟶ 87:
'''Output'''(''R'')
The idea is to identify the product of all irreducible factors of ''f'' with the same multiplicity. This is done in two steps. The first step uses the formal derivative of ''f'' to find all the factors with multiplicity not divisible by ''p''. The second step identifies the remaining factors. As all of the remaining factors have multiplicity divisible by ''p'', meaning they are powers of ''p'', one can simply take the ''p''-th square root and apply recursion.
 
==== Example of a square-free factorization ====
Let
: <math> f = x^{11} + 2 x^9 + 2x^8 + x^6 + x^5 + 2x^3 + 2x^2 +1 \in \mathbf{F}_3[x],</math>
 
:<math> f = x^{11} + 2 x^9 + 2x^8 + x^6 + x^5 + 2x^3 + 2x^2 +1 \in \mathbf{F}_3[x],</math>
to be factored over the field with three elements.
 
The algorithm computes first
: <math> c = \gcd(f, f') = x^9 + 2x^6 + x^3 + 2.</math>
 
Since the derivative is non-zero we have {{math|1=''w'' = ''f''/''c'' = ''x''<sup>2</sup> + 2}} and we enter the while loop. After one loop we have {{math|1=''y'' = ''x'' + 2}}, {{math|1=''z'' = ''x'' + 1}} and {{math|1=''R'' = ''x'' + 1}} with updates {{math|1=''i'' = 2}}, {{math|1=''w'' = ''x'' + 2}} and {{math|1=''c'' = ''x''<sup>8</sup> + ''x''<sup>7</sup> + ''x''<sup>6</sup> + ''x''<sup>2</sup>+''x''+1}}. The second time through the loop gives {{math|1=''y'' = ''x'' + 2}}, {{math|1=''z'' = 1}}, {{math|1=''R'' = ''x'' + 1}}, with updates {{math|1=''i'' = 3}}, {{math|1=''w'' = ''x'' + 2}} and {{math|1=''c'' = ''x''<sup>7</sup> + 2''x''<sup>6</sup> + ''x'' + 2}}. The third time through the loop also does not change {{math|1=''R''}}. For the fourth time through the loop we get {{math|1= ''y'' = 1}}, {{math|1=''z'' = ''x'' + 2}}, {{math|1=''R'' = (''x'' + 1)(''x'' + 2)<sup>4</sup>}}, with updates {{math|1=''i'' = 5}}, {{math|1=''w'' = 1}} and {{math|1=''c'' = ''x''<sup>6</sup> + 1}}. Since ''w'' = 1, we exit the while loop. Since {{math|''c'' ≠ 1}}, it must be a perfect cube. The cube root of {{math|''c''}}, obtained by replacing {{math|''x''<sup>3</sup>}} by {{math|''x''}} is {{math|''x''<sup>2</sup>&nbsp; +&nbsp; 1}}, and calling the square-free procedure recursively determines that it is square-free. Therefore, cubing it and combining it with the value of {{math|''R''}} to that point gives the square-free decomposition
:<math> c = \gcd(f, f') = x^9 + 2x^6 + x^3 + 2.</math>
: <math> f= (x+1)(x^2+1)^3(x+2)^4.</math>
 
Since the derivative is non-zero we have {{math|1=''w'' = ''f''/''c'' = ''x''<sup>2</sup> + 2}} and we enter the while loop. After one loop we have {{math|1=''y'' = ''x'' + 2}}, {{math|1=''z'' = ''x'' + 1}} and {{math|1=''R'' = ''x'' + 1}} with updates {{math|1=''i'' = 2}}, {{math|1=''w'' = ''x'' + 2}} and {{math|1=''c'' = ''x''<sup>8</sup> + ''x''<sup>7</sup> + ''x''<sup>6</sup> + ''x''<sup>2</sup>+''x''+1}}. The second time through the loop gives {{math|1=''y'' = ''x'' + 2}}, {{math|1=''z'' = 1}}, {{math|1=''R'' = ''x'' + 1}}, with updates {{math|1=''i'' = 3}}, {{math|1=''w'' = ''x'' + 2}} and {{math|1=''c'' = ''x''<sup>7</sup> + 2''x''<sup>6</sup> + ''x'' + 2}}. The third time through the loop also does not change {{math|1=''R''}}. For the fourth time through the loop we get {{math|1= ''y'' = 1}}, {{math|1=''z'' = ''x'' + 2}}, {{math|1=''R'' = (''x'' + 1)(''x'' + 2)<sup>4</sup>}}, with updates {{math|1=''i'' = 5}}, {{math|1=''w'' = 1}} and {{math|1=''c'' = ''x''<sup>6</sup> + 1}}. Since ''w'' = 1, we exit the while loop. Since ''c'' ≠ 1, it must be a perfect cube. The cube root of ''c'', obtained by replacing ''x''<sup>3</sup> by ''x'' is ''x''<sup>2</sup>&nbsp;+&nbsp;1, and calling the square-free procedure recursively determines that it is square-free. Therefore, cubing it and combining it with the value of ''R'' to that point gives the square-free decomposition
 
:<math> f= (x+1)(x^2+1)^3(x+2)^4.</math>
 
=== Distinct-degree factorization ===
This algorithm splits a square-free polynomial into a product of polynomials whose irreducible factors all have the same degree. Let {{math|''f'' ∈ '''F'''<sub>''q''</sub>[''x'']}} of degree {{math|''n''}} be the polynomial to be factored.
 
'''Algorithm''' Distinct-degree factorization(DDF)
Line 126 ⟶ 124:
The correctness of the algorithm is based on the following:
 
<blockquote>{{Anchor|lemma}}'''Lemma.''' For ''i'' ≥ 1 the polynomial
: <math>x^{q^i}-x \in \mathbf{F}_q[x]</math>
 
:<math>x^{q^i}-x \in \mathbf{F}_q[x]</math>
 
is the product of all monic irreducible polynomials in '''F'''<sub>''q''</sub>[''x''] whose degree divides ''i''.</blockquote>
 
At first glance, this is not efficient since it involves computing the GCD of polynomials of a degree which is exponential in the degree of the input polynomial. However,
: <math>g=\gcd \left (f^*, x^{q^i}-x \right )</math>
 
:<math>g=\gcd \left (f^*, x^{q^i}-x \right )</math>
 
may be replaced by
: <math>g=\gcd \left (f^*, \left (x^{q^i}-x \mod f^* \right ) \right ).</math>
 
:<math>g=\gcd \left (f^*, \left (x^{q^i}-x \mod f^* \right ) \right ).</math>
 
Therefore, we have to compute:
: <math>x^{q^i}-x \mod f^*,</math>
 
:<math>x^{q^i}-x \mod f^*,</math>
 
there are two methods:
 
<blockquote>'''Method I.''' Start from the value of
: <math>x^{q^{i-1}}\mod f^* </math>
 
computed at the preceding step and to compute its ''q''-th power modulo the new ''f*'', using [[exponentiation by squaring]] method. This needs
:<math>x^{q^{i-1}}\mod f^* </math>
 
computed at the preceding step and to compute its ''q''-th power modulo the new ''f*'', using [[exponentiation by squaring]] method. This needs
 
:<math>O \left (\log(q) \deg(f)^2 \right )</math>
Line 160 ⟶ 148:
arithmetic operations for the whole algorithm.</blockquote>
 
<blockquote>'''Method II.''' Using the fact that the ''q''-th power is a linear map over '''F'''<sub>''q''</sub> we may compute its matrix with
: <math>O \left (\deg(f)^2(\log(q)+\deg(f)) \right )</math>
 
:<math>O \left (\deg(f)^2(\log(q)+\deg(f)) \right )</math>
 
operations. Then at each iteration of the loop, compute the product of a matrix by a vector (with ''O''(deg(''f'')<sup>2</sup>) operations). This induces a total number of operations in '''F'''<sub>''q''</sub> which is
: <math>O \left (\deg(f)^2 (\log(q)+\deg(f)) \right ).</math>
 
:<math>O \left (\deg(f)^2 (\log(q)+\deg(f)) \right ).</math>
 
Thus this second method is more efficient and is usually preferred. Moreover, the matrix that is computed in this method is used, by most algorithms, for equal-degree factorization (see below); thus using it for the distinct-degree factorization saves further computing time.</blockquote>
 
=== Equal-degree factorization ===
 
==== Cantor–Zassenhaus algorithm ====
{{main article|Cantor–Zassenhaus algorithm}}
In this section, we consider the factorization of a monic squarefree univariate polynomial ''f'', of degree ''n'', over a finite field '''F'''<sub>''q''</sub>, which has {{math|''r'' ≥ 2}} pairwise distinct irreducible factors <math> f_1,\ldots,f_r</math> each of degree ''d''.
 
We first describe an algorithm by Cantor and Zassenhaus (1981) and then a variant that has a slightly better complexity. Both are probabilistic algorithms whose running time depends on random choices ([[Las Vegas algorithm]]s), and have a good average running time. In next section we describe an algorithm by Shoup (1990), which is also an equal-degree factorization algorithm, but is deterministic. All these algorithms require an odd order ''q'' for the field of coefficients. For more factorization algorithms see e.g. Knuth's book [[The Art of Computer Programming]] volume 2.
Line 183 ⟶ 168:
which has ''r'' ≥ 2 irreducible factors each of degree ''d''
'''Output:''' The set of monic irreducible factors of ''f''.
 
Factors := {''f''};
'''while''' Size(Factors) < ''r'' '''do''',
Choose ''h'' in '''F'''<sub>''q''</sub>[''x''] with deg(''h'') < ''n'' at random;
<math>g:=h^{\frac{q^d-1}{2}}- 1 \pmod f</math>
'''for each''' ''u'' '''in''' Factors with deg(''u'') > ''d'' '''do'''
'''if''' gcd(''g'', ''u'') ≠ 1 and gcd(''g'', ''u'') ≠ ''u'', '''then'''
Factors:= Factors<math>\,\setminus\, \{u\}\cup\{(\gcd(g,u),u/\gcd(g,u))\}</math>;
'''endif;'''
'''endwhile'''
'''return''' Factors.
 
The correctness of this algorithm relies on the fact that the ring '''F'''<sub>''q''</sub>[''x'']/''f'' is a direct product of the fields '''F'''<sub>''q''</sub>[''x'']/''f<sub>i</sub>'' where ''f<sub>i</sub>'' runs on the irreducible factors of ''f''. As all these fields have ''q<sup>d</sup>'' elements, the component of ''g'' in any of these fields is zero with probability
: <math>\frac{q^d-1}{2q^d} \sim \tfrac{1}{2}.</math>
 
:<math>\frac{q^d-1}{2q^d} \sim \tfrac{1}{2}.</math>
 
This implies that the polynomial gcd(''g'', ''u'') is the product of the factors of ''g'' for which the component of ''g'' is zero.
Line 205 ⟶ 189:
 
In the typical case where ''d''log(''q'') > ''n'', this complexity may be reduced to
: <math>O(n^2(\log(r)\log(q)+n))</math>
 
:<math>O(n^2(\log(r)\log(q)+n))</math>
 
by choosing ''h'' in the kernel of the linear map
: <math> v \to v^q-v \pmod f</math>
 
:<math> v \to v^q-v \pmod f</math>
 
and replacing the instruction
: <math>g:=h^{\frac{q^d-1}{2}}- 1 \pmod f</math>
 
:<math>g:=h^{\frac{q^d-1}{2}}- 1 \pmod f</math>
 
by
: <math>g:=h^{\frac{q-1}{2}}- 1 \pmod f.</math>
 
:<math>g:=h^{\frac{q-1}{2}}- 1 \pmod f.</math>
 
The proof of validity is the same as above, replacing the direct product of the fields '''F'''<sub>''q''</sub>[''x'']/''f<sub>i</sub>'' by the direct product of their subfields with ''q'' elements. The complexity is decomposed in <math>O(n^2\log(r)\log(q))</math> for the algorithm itself, <math>O(n^2(\log(q)+n))</math> for the computation of the matrix of the linear map (which may be already computed in the square-free factorization) and ''O''(''n''<sup>3</sup>) for computing its kernel. It may be noted that this algorithm works also if the factors have not the same degree (in this case the number ''r'' of factors, needed for stopping the while loop, is found as the dimension of the kernel). Nevertheless, the complexity is slightly better if square-free factorization is done before using this algorithm (as ''n'' may decrease with square-free factorization, this reduces the complexity of the critical steps).
 
==== Victor Shoup's algorithm ====
Like the algorithms of the preceding section, [[Victor Shoup]]'s algorithm is an equal-degree factorization algorithm.<ref>Victor Shoup, [http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.38.9136&rep=rep1&type=pdf On the deterministic complexity of factoring polynomials over finite fields], Information Processing Letters 33:261-267, 1990</ref> Unlike them, it is a deterministic algorithm. However, it is less efficient, in practice, than the algorithms of preceding section. For Shoup's algorithm, the input is restricted to polynomials over prime fields '''F'''<sub>''p''</sub>.
 
The worst case [[time complexity]] of Shoup's algorithm has a factor <math>\sqrt{p}.</math> Although exponential, this complexity is much better thatthan previous deterministic algorithms (Berlekamp's algorithm) which have {{math|''p''}} as a factor. However, there are very few polynomials for which the computing time is exponential, and the average time complexity of the algorithm is polynomial in <math>d\log(p),</math> where {{mvar|''d''}} is the degree of the polynomial, and {{math|''p''}} is the number of elements of the ground field.
 
Let ''g'' = ''g''<sub>1</sub> ... ''g<sub>k</sub>'' be the desired factorization, where the ''g<sub>i</sub>'' are distinct monic irreducible polynomials of degree ''d''. Let ''n'' = deg(''g'') = ''kd''. We consider the [[ring (mathematics)|ring]] ''R'' = '''F'''<sub>''q''</sub>[''x'']/''g'' and denote also by ''x'' the image of ''x'' in ''R''. The ring ''R'' is the direct product of the fields ''R<sub>i</sub>'' = '''F'''<sub>''q''</sub>[''x'']/''g<sub>i</sub>'', and we denote by ''p<sub>i</sub>'' the natural [[homomorphism]] from the ''R'' onto ''R<sub>i</sub>''. The [[Galois group]] of ''R<sub>i</sub>'' over '''F'''<sub>''q''</sub> is cyclic of order ''d'', generated by the [[field automorphism]] ''u'' → ''u<sup>p</sup>''. It follows that the roots of ''g<sub>i</sub>'' in ''R<sub>i</sub>'' are
: <math> p_i(x), p_i(x^q), p_i \left (x^{q^2} \right ), \ldots, p_i \left (x^{q^{d-1}} \right ).</math>
 
:<math> p_i(x), p_i(x^q), p_i \left (x^{q^2} \right ), \ldots, p_i \left (x^{q^{d-1}} \right ).</math>
 
Like in the preceding algorithm, this algorithm uses the same [[subalgebra]] ''B'' of ''R'' as the [[Berlekamp's algorithm]], sometimes called the "Berlekamp subagebra" and defined as
: <math>\begin{align}
 
:<math>\begin{align}
B &= \left \{\alpha \in R \ : \ p_1(\alpha), \cdots, p_k(\alpha) \in \mathbf{F}_q \right \} \\
&= \{u\in R \ : \ u^q=u\}
Line 249 ⟶ 224:
Having a separating set, Shoup's algorithm proceeds as the last algorithm of the preceding section, simply by replacing the instruction "choose at random ''h'' in the kernel of the linear map <math> v \to v^q-v \pmod f</math>" by "choose ''h'' + ''i'' with ''h'' in ''S'' and ''i'' in {1, ..., ''k''−1}".
 
== Time complexity ==
As described in previous sections, for the factorization over finite fields, there are [[randomized algorithm]]s of polynomial [[time complexity]] (for example Cantor-ZassenhausCantor–Zassenhaus algorithm). There are also deterministic algorithms with a polynomial average complexity (for example Shoup's algorithm).
 
The existence of a deterministic algorithm with a polynomial worst-case complexity is still an open problem.
 
== Rabin's test of irreducibility ==
Like distinct-degree factorization algorithm, Rabin's algorithm<ref>{{cite journal |last1=Rabin |first1=Michael |year=1980 |title=Probabilistic algorithms in finite fields |journal=SIAM Journal on Computing |volume=9 |issue=2 |pages=273–280 |doi=10.1137/0209024 |citeseerx=10.1.1.17.5653 }}</ref> is based on the Lemma[[#lemma|lemma]] stated above. Distinct-degree factorization algorithm tests every ''d'' not greater than half the degree of the input polynomial. Rabin's algorithm takes advantage that the factors are not needed for considering fewer ''d''. Otherwise, it is similar to distinct-degree factorization algorithm. It is based on the following fact.
 
Let ''p''<sub>1</sub>, ..., ''p<sub>k</sub>'', be all the prime divisors of ''n'', and denote <math>n/p_i=n_i</math>, for 1 ≤ ''i'' ≤ ''k'' polynomial ''f'' in '''F'''<sub>''q''</sub>[''x''] of degree ''n'' is irreducible in '''F'''<sub>''q''</sub>[''x''] if and only if <math> \gcd \left (f,x^{q^{n_i}}-x \right )=1</math>, for 1&nbsp;≤&nbsp;''i''&nbsp;≤&nbsp;''k'', and ''f'' divides <math>x^{q^n}-x</math>. In fact, if ''f'' has a factor of degree not dividing ''n'', then ''f'' does not divide <math>x^{q^n}-x</math>; if ''f'' has a factor of degree dividing ''n'', then this factor divides at least one of the <math>x^{q^{n_i}}-x.</math>
Line 276 ⟶ 251:
 
The basic idea of this algorithm is to compute <math> x^{q^{n_i}} \bmod f</math> starting from the smallest <math> n_1,\ldots,n_k</math> by repeated squaring or using the [[Finite field#Frobenius automorphisms|Frobenius automorphism]], and then to take the correspondent gcd. Using the elementary polynomial arithmetic, the computation of the matrix of the Frobenius automorphism needs <math>O(n^2 (n+\log q))</math> operations in '''F'''<sub>''q''</sub>, the computation of
: <math>x^{q^{n_i}}-x \pmod f</math>
 
:<math>x^{q^{n_i}}-x \pmod f</math>
 
needs ''O''(''n''<sup>3</sup>) further operations, and the algorithm itself needs ''O''(''kn''<sup>2</sup>) operations, giving a total of <math>O(n^2 (n+\log q))</math> operations in '''F'''<sub>''q''</sub>. Using fast arithmetic (complexity <math>O(n\log n)</math> for multiplication and division, and <math>O(n(\log n)^2)</math> for GCD computation), the computation of the <math>x^{q^{n_i}}-x \bmod f</math> by repeated squaring is <math>O(n^2\log n\log q)</math>, and the algorithm itself is <math>O(kn(\log n)^2)</math>, giving a total of <math>O(n^2\log n\log q)</math> operations in '''F'''<sub>''q''</sub>.
 
== See also ==
* [[Berlekamp's algorithm]]
* [[Cantor–Zassenhaus algorithm]]
Line 288 ⟶ 261:
==References==
{{Refbegin}}
*KEMPFERT, H (1969) [https://www.sciencedirect.com/science/article/pii/0022314X69900304/pdf?md5=c31af090ceec6b08d71eedf57d709ab0&isDTMRedir=Y&pid=1-s2.0-0022314X69900304-main.pdf&_valck=1 On the ''Factorization of Polynomials''] Department of Mathematics, The Ohio State University, Columbus, Ohio 43210
*Shoup, Victor (1996) ''[https://www.shoup.net/papers/smooth.ps Smoothness and Factoring Polynomials over Finite Fields]'' Computer Science Department University of Toronto
* [[Joachim von zur Gathen|Von Zur Gathen, J.]]; Panario, D. (2001). [https://dx.doi.org/10.1006/jsco.1999.1002 Factoring Polynomials Over Finite Fields: A Survey]. [[Journal of Symbolic Computation]], Volume 31, Issues 1–2, January 2001, 3--17.
*Gao Shuhong, Panario Daniel,''Test and Construction of Irreducible Polynomials over Finite Fields'' Department of mathematical Sciences, Clemson University, South Carolina, 29634–1907, USA. and Department of computer science University of Toronto, Canada M5S-1A4
Line 302 ⟶ 275:
* Some irreducible polynomials http://www.math.umn.edu/~garrett/m/algebra/notes/07.pdf
* Field and Galois Theory :http://www.jmilne.org/math/CourseNotes/FT.pdf
* Galois Field:http://designtheory.org/library/encyc/topics/gf.pdf {{Webarchive|url=https://web.archive.org/web/20101215224628/http://designtheory.org/library/encyc/topics/gf.pdf |date=2010-12-15 }}
* Factoring polynomials over finite fields: http://www.science.unitn.it/~degraaf/compalg/polfact.pdf {{Webarchive|url=https://web.archive.org/web/20110721233946/http://www.science.unitn.it/~degraaf/compalg/polfact.pdf |date=2011-07-21 }}
 
[[Category:Polynomials]]
Line 311 ⟶ 284:
[[Category:Cryptography]]
[[Category:Computational number theory]]
[[Category:Polynomial factorization algorithms]]