Content deleted Content added
m Substing templates: {{Книга}} and {{Статья}}. See User:AnomieBOT/docs/TemplateSubster for info. |
copyediting |
||
Line 1:
In [[number theory]], the '''Berlekamp's root finding algorithm''' (also ''Berlekamp-Rabin algorithm'') is the [[Randomized algorithm|probabilistic]] method of [[Root-finding algorithm|finding roots]] of [[Polynomial|polynomials]] over a [[Finite field|field]] <math>\mathbb Z_p</math>. The method was discovered by [[Elwyn Berlekamp|Berlekamp]] in 1970<ref name=":0">{{cite journal |author = |editor= |format= |url= https://www.ams.org/mcom/1970-24-111/S0025-5718-1970-0276200-X/ |title= Factoring polynomials over large finite fields |type= |origyear= | agency = |edition= Mathematics of Computation |___location= |date= 1970 |year= 1970 |publisher= |at= |volume= 24 |issue= 111 |number= |pages = 713–735 |page= |series= |isbn = |issn = 00255718 |doi = 10.1090/S0025-5718-1970-0276200-X |bibcode = |arxiv = |pmid = |ref= |archiveurl = |archivedate = |language= en |quote= }}</ref> as an auxiliary to the [[Berlekamp's algorithm|algorithm]] for polynomial factorization over finite
== History ==
The method was proposed by [[Elwyn Berlekamp]] in his work<ref name=":0" /> on polynomial factorization over finite fields.
== Statement ==
Let <math>p</math> be
== Algorithm ==
=== Randomization ===
Let <math display="inline">f(x) = (x-\lambda_1)(x-\lambda_2)\dots(x-\lambda_n)</math>. Finding all roots of
=== Classification of <math>\mathbb Z_p</math> elements ===
Due to [[Euler's criterion]], for every [[monomial]] <math>(x-\lambda)</math> exactly one of following properties holds:<ref name=":0" />
#
#
#
Thus if <math>f_z(x)</math> is not divisible by <math>x</math>, which may be checked separately, then <math>f_z(x)</math> is equal to the product of [[Polynomial greatest common divisor|greatest common divisors]] <math>\gcd(f_z(x);g_0(x))</math> and <math>\gcd(f_z(x);g_1(x))</math><ref name=":2" />.
=== Berlekamp's method ===
# Explicitly calculate coefficients of <math>f_z(x) = f(x-z)</math>,
# Calculate remainders of <math display="inline">x,x^2, x^{2^2},x^{2^3}, x^{2^4}, \dots, x^{2^{\lfloor \log_2 p \rfloor}}</math> modulo <math>f_z(x)</math> by
# Using [[exponentiation by squaring]] and polynomials calculated on the previous steps calculate the remainder of <math display="inline">x^{(p-1)/2}</math> modulo <math display="inline">f_z(x)</math>,
# If <math display="inline">x^{(p-1)/2} \not \equiv \pm 1 \pmod{f_z(x)}</math> then <math>\gcd</math> mentioned above provide a non-trivial factorization of <math>f_z(x)</math>,
# Otherwise all roots of <math>f_z(x)</math> are either residues or non-residues simultaneously and one has to choose another <math>z</math>.
If <math>f(x)</math> is divisible by some non-linear [[Primitive polynomial (field theory)|primitive polynomial]] <math>g(x)</math> over <math>\mathbb Z_p</math> then when calculating <math>\gcd</math> with <math>g_0(x)</math> and <math>g_1(x)</math> one will obtain a non-trivial factorization of <math>f_z(x)/g_z(x)</math>, thus algorithm allows to find all roots of arbitrary polynomials over <math>\mathbb Z_p</math>.
=== Modular square root ===
Consider equation <math display="inline">x^2 \equiv a \pmod{p}</math> having elements <math>\beta</math> and <math>-\beta</math> as its roots. Solution of this equation is equivalent to factorization of polynomial <math display="inline">f(x) = x^2-a=(x-\beta)(x+\beta)</math> over <math>\mathbb Z_p</math>. In this particular case problem
# GCD is equal to <math>1</math> which means that <math>z+\beta</math> and <math>z-\beta</math> are both quadratic non-residues,
Line 48:
# Let <math>z=2</math>. Then <math>f_z(x) = (x-2)^2 - 5 = x^2 - 4x - 1</math>, thus <math display="inline">\gcd( x^2 - 4x - 1 ; x^5 - 1)\equiv x - 9 \pmod{11}</math>. From this follows <math display="inline">x - 9 = x - 2 - \beta</math>, so <math>\beta \equiv 7 \pmod{11}</math> and <math display="inline">-\beta \equiv -7 \equiv 4 \pmod{11}</math>.
== Correctness proof ==
Algorithm finds factorization of <math>f_z(x)</math> in all cases except for ones when all numbers <math>z+\lambda_1, z+\lambda_2, \dots, z+\lambda_n</math> are quadratic residues or non-residues simultaneously. According to [[theory of cyclotomy]],<ref>{{cite book| author = Marshall Hall | chapter = | chapter-url = | format = | url = https://books.google.ru/books?hl=en&lr=&id=__JCiiCfu2EC&oi=fnd&pg=PA1&dq=Combinatorial+Theory+hall&ots=WeNDZ7uCSM&sig=a6JwSPPen2C2EysEnkSTXpUNaxM&redir_esc=y#v=onepage&q=Combinatorial%20Theory%20hall&f=false | title = Combinatorial Theory | orig-year = | agency = | edition = |___location= |date = 1998 |publisher= John Wiley & Sons |at= |volume= |issue = | pages = | page = | series = | isbn = 9780471315186| ref = }}</ref> the probability of such an event for the case when <math>\lambda_1, \dots, \lambda_n</math> are all residues or non-residues simultaneously (that is, when <math>z=0</math> would fail) may be estimated as <math>2^{-k}</math> where <math>k</math> is the number of
== Complexity ==
# Due to the [[binomial theorem]] <math display="inline">(x-z)^k = \sum\limits_{i=0}^k \binom{k}{i} (-z)^{k-i}x^i</math>,
# Polynomial multiplication and taking remainder of one polynomial modulo another one may be done in <math display="inline">O(n^2)</math>, thus calculation of <math display="inline">x^{2^k} \bmod f_z(x)</math> is done in <math display="inline">O(n^2 \log p)</math>
# Binary exponentiation works in <math>O(n^2 \log p)</math>
# Taking the <math>\gcd</math> of two polynomials via [[Euclidean algorithm]] works in <math>O(n^2)</math>.
Thus the whole procedure may be done in <math>O(n^2 \log p)</math>. Using the [[fast Fourier transform]] and Half-GCD algorithm,<ref>{{cite book| author = Aho, Alfred V. | chapter = | chapter-url = | format = | url = http://worldcat.org/oclc/1147299 | title = The design and analysis of computer algorithms | orig-year = | agency = | edition = |___location= |date = 1974 |publisher= Addison-Wesley Pub. Co |at= |volume= |issue = | pages = | page = | series = | isbn = 0201000296| ref = }}</ref> the algorithm's complexity may be improved to <math>O(n \log n \log pn)</math>. For the modular square root case, the degree is <math>n
== References ==
|