Berlekamp–Rabin algorithm

This is an old revision of this page, as edited by Adamant.pwn (talk | contribs) at 22:31, 27 July 2019 (New article). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

In number theory, Berlekamp's root finding algorithm (also Berlekamp-Rabin algorithm) is the probabilistic method of finding roots of polynomials over field . The method was discovered by Berlekamp in 1970[1] as an auxiliary to the algorithm for polynomial factorization over finite field. The algorithm was later modified by Rabin for arbitrary finite field in 1979[2]. The method was also independently discovered before Berlekamp by some other researchers[3].

History

The method was proposed by Elwyn Berlekamp in his work[1] on polynomial factorization over finite fields. Original work lacked formal correctness proof[2] and was later refined and modified for arbitrary finite fields by Michael Rabin[2]. In 1986 René Peralta proposed similar algorithm[4] for finding square roots in  [5]. In 2000 Peralta's method was generalized for cubic equations[6].

Statement

Let   be the odd prime number. Consider polynomial   over field   of remainders modulo  . One have to find all   such that   for every possible  [2][7].

Algorithm

Randomization

Let  . Finding all roots of such polynomial is equivalent to finding its factorization into linear factors. To find such factorization it's sufficient to split polynomial into any two non-trivial divisors and factorize them recursively. To do this consider the polynomial   where   is some random element of  . If one can represent this polynomial as the product  then in terms of initial polynomial it means that   which provides needed factorization of  [1][7].

Classification of   elements

Due to Euler's criterion for every monomial   exactly one of following properties holds[1]:

  1. Monomial is equal to   if  ,
  2. Monomial divides   if   is quadratic residue modulo  ,
  3. Monomial divides   if   is quadratic non-residual modulo  .

Thus if   is not divisible by  , which may be checked separately, then   is equal to the product of greatest common divisors   and  [7].

Berlekamp's method

Property written above leads to the following algorithm[1]:

  1. Explicitly calculate coefficients of  ,
  2. Calculate remainders of   modulo   by consequently squaring current polynomial and taking remainder modulo  ,
  3. Using exponentiation by squaring and polynomials calculated on the previous steps calculate the remainder of   modulo  ,
  4. If   then   mentioned above provide non-trivial factorization of  ,
  5. Otherwise all roots of   are either residues or non-residues simultaneously and one has to choose another  .

If   is divisible by some non-linear primitive polynomial   over   then when calculating   with   and   one will obtain non-trivial factorization of  , thus algorithm allows to find all roots of arbitrary polynomials over  .

Modular square root

Consider equation   having elements   and   as its roots. Solution of this equation is equivalent to factorization of polynomial   over  . In this particular case problem is a bit simpler because it is sufficient to calculate only  . For this polynomial exactly one of the following properties will hold:

  1. GCD is equal to   which means that   and   are both quadratic non-residues,
  2. GCD is equal to  which means that both numbers are quadratic residues,
  3. GCD is equal to  which means that exactly one of these numbers is quadratic residue.

In the third case GCD is equal to either   or  . It allows to write the solution as  [1].

Example

Assume we need to solve the equation  . For this we need to factorize  . Consider some possible values of  :

  1. Let  . Then  , thus  . Both numbers   are quadratic non-residues, so we need to take some other  .
  1. Let  . Then  , thus  . From this follows  , so   and  .

Manual check shows that, indeed,   and  .

Correctness proof

Algorithm finds factorization of   in all cases except for ones when all numbers   are quadratic residues or non-residues simultaneously. According to theory of cyclotomy[8] probability of such event for the case when   are all residues or non-residues simultaneously (that is, when   would fail) may be estimated as   where   is the number of different values among  [1]. In this way even for the worst case of   and   probability of error may be estimated as   and for modular square root case error probability is at most  .

Complexity

Assume that polynomial's degree is  . Here's estimation of algorithm's steps complexity:

  1. Due to binomial theorem  , thus transition from   to   may be done in  ,
  2. Polynomial multiplication and taking remainder of one polynomial modulo another one may be done in  , thus calculation of   is done in  ,
  3. Binary exponentiation works in   as well,
  4. Taking   of two polynomials via Euclidean algorithm works in  .

Thus the whole procedure may be done in  . Using fast Fourier transform and Half-GCD algorithm[9] complexity may be improved to  . For modular square root case the degree   is equal to  , thus the whole complexity of algorithm in such case may be estimated as   per iteration[7].

References

  1. ^ a b c d e f g "Factoring polynomials over large finite fields". 24 (111) (Mathematics of Computation ed.). 1970: 713–735. doi:10.1090/S0025-5718-1970-0276200-X. ISSN 0025-5718. {{cite journal}}: Cite journal requires |journal= (help)CS1 maint: date and year (link)
  2. ^ a b c d M. Rabin (1980). "Probabilistic Algorithms in Finite Fields". 9 (2) (SIAM Journal on Computing ed.): 273–280. doi:10.1137/0209024. ISSN 0097-5397. {{cite journal}}: Cite journal requires |journal= (help)CS1 maint: date and year (link)
  3. ^ Donald E Knuth (1998). The art of computer programming. Vol. 2 Vol. 2. ISBN 9780201896848.
  4. ^ Tsz-Wo Sze (2011). "On taking square roots without quadratic nonresidues over finite fields". 80 (275) (Mathematics of Computation ed.): 1797–1811. doi:10.1090/s0025-5718-2011-02419-1. ISSN 0025-5718. {{cite journal}}: Cite journal requires |journal= (help)CS1 maint: date and year (link)
  5. ^ R. Peralta (1986). "A simple and fast probabilistic algorithm for computing square roots modulo a prime number (Corresp.)". 32 (6) (IEEE Transactions on Information Theory ed.): 846–847. doi:10.1109/TIT.1986.1057236. ISSN 0018-9448. {{cite journal}}: Cite journal requires |journal= (help)CS1 maint: date and year (link)
  6. ^ C Padró, G Sáez (2002). "Taking cube roots in Zm". 15 (6) (Applied Mathematics Letters ed.): 703–708. doi:10.1016/s0893-9659(02)00031-9. ISSN 0893-9659. {{cite journal}}: Cite journal requires |journal= (help)CS1 maint: date and year (link)
  7. ^ a b c d Alfred J. Menezes, Ian F. Blake, XuHong Gao, Ronald C. Mullin, Scott A. Vanstone (1993). Applications of Finite Fields. The Springer International Series in Engineering and Computer Science. Springer US. ISBN 9780792392828.{{cite book}}: CS1 maint: multiple names: authors list (link)
  8. ^ Marshall Hall (1998). Combinatorial Theory. John Wiley & Sons. p. 464. ISBN 9780471315186.
  9. ^ Aho, Alfred V. (1974). The design and analysis of computer algorithms. Addison-Wesley Pub. Co. ISBN 0201000296.