Content deleted Content added
Adamant.pwn (talk | contribs) m Content in this edit is translated from the existing Russian Wikipedia article at ru:метод Берлекэмпа; see its history for attribution. |
m Open access bot: url-access updated in citation with #oabot. |
||
(50 intermediate revisions by 30 users not shown) | |||
Line 1:
{{short description|Method in number theory}}
In [[number theory]], '''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 [[Finite field|field]] <math>\mathbb Z_p</math>. The method was discovered by [[Elwyn Berlekamp|Berlekamp]] in 1970<ref name=":0">{{Статья|author=E. R. Berlekamp|year=1970|doi=10.1090/S0025-5718-1970-0276200-X|issn=00255718|выпуск=111|язык=en|страницы=713–735|издание=Mathematics of Computation|заглавие=Factoring polynomials over large finite fields|ссылка=https://www.ams.org/mcom/1970-24-111/S0025-5718-1970-0276200-X/|том=24}}</ref> as an auxiliary to the [[Berlekamp's algorithm|algorithm]] for polynomial factorization over finite field. The algorithm was later modified by [[Michael O. Rabin|Rabin]] for arbitrary finite field in 1979<ref name=":1">{{Статья|автор=M. Rabin|год=1980|doi=10.1137/0209024|issn=00975397|выпуск=2|страницы=273–280|издание=SIAM Journal on Computing|заглавие=Probabilistic Algorithms in Finite Fields|ссылка=https://epubs.siam.org/doi/10.1137/0209024|том=9}}</ref>. The method was also independently discovered before Berlekamp by some other researchers<ref>{{Книга|автор=Donald E Knuth|год=1998|isbn=9780201896848|заглавие=The art of computer programming. Vol. 2 Vol. 2|ссылка=https://www.worldcat.org/title/art-of-computer-programming-vol-2/oclc/900627019&referer=brief_results}}</ref>.▼
[[File:Elwyn_R_Berlekamp_2005.jpg|thumb|right|Elwyn R. Berlekamp at conference on Combinatorial Game Theory at [[Banff International Research Station]]]]
▲In [[number theory]], '''Berlekamp's root finding algorithm'''
== History ==
The method was proposed by [[Elwyn Berlekamp]] in his 1970 work<ref name=":0" /> on polynomial factorization over finite fields.
== Statement of problem==
Let <math>p</math> be
== Algorithm ==
=== Randomization ===
Let <math display="inline">f(x) = (x-\lambda_1)(x-\lambda_2)\
=== Classification of <math>\mathbb
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}, \
# 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
# 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
=== 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
# 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 39 ⟶ 41:
# GCD is equal to <math>(x-t)</math>which means that exactly one of these numbers is quadratic residue.
In the third case GCD is equal to either <math>(x-z-\beta)</math> or <math>(x-z+\beta)</math>. It allows to write the solution as <math display="inline">\beta = (t - z) \pmod{p}</math>.<ref name=":0" />
=== Example ===
Line 48 ⟶ 50:
# 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 ==
== 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>{{
== References ==
{{reflist}}
{{примечания}}{{Number-theoretic algorithms}}<br />▼
[[Category:Algorithms]]
[[Category:Algebra]]
|