You're using an outdated browser. Please upgrade to a modern browser for the best experience.
Berlekamp's Root Finding Algorithm
Edit

In number theory, Berlekamp's root finding algorithm, also called the Berlekamp–Rabin algorithm, is the probabilistic method of finding roots of polynomials over a field Zp. The method was discovered by Elwyn Berlekamp in 1970 as an auxiliary to the algorithm for polynomial factorization over finite fields. The algorithm was later modified by Rabin for arbitrary finite fields in 1979. The method was also independently discovered before Berlekamp by other researchers.

berlekamp–rabin finite fields root finding

1. History

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

2. Statement of Problem

Let p be an odd prime number. Consider the polynomial f(x)=a0+a1x++anxn over the field Zp of remainders modulo p. The algorithm should find all λ in Zp such that f(λ)=0 in Zp.[2][6]

3. Algorithm

3.1. Randomization

Let f(x)=(xλ1)(xλ2)(xλn). Finding all roots of this polynomial is equivalent to finding its factorization into linear factors. To find such factorization it is sufficient to split the polynomial into any two non-trivial divisors and factorize them recursively. To do this, consider the polynomial fz(x)=f(xz)=(xλ1z)(xλ2z)(xλnz) where z is some any element of Zp. If one can represent this polynomial as the product fz(x)=p0(x)p1(x) then in terms of the initial polynomial it means that f(x)=p0(x+z)p1(x+z), which provides needed factorization of f(x).[1][6]

3.2. Classification of Zp Elements

Due to Euler's criterion, for every monomial (xλ) exactly one of following properties holds:[1]

  1. The monomial is equal to x if λ=0,
  2. The monomial divides g0(x)=(x(p1)/21) if λ is quadratic residue modulo p,
  3. The monomial divides g1(x)=(x(p1)/2+1) if λ is quadratic non-residual modulo p.

Thus if fz(x) is not divisible by x, which may be checked separately, then fz(x) is equal to the product of greatest common divisors gcd(fz(x);g0(x)) and gcd(fz(x);g1(x)).[6]

3.3. Berlekamp's Method

The property above leads to the following algorithm:[1]

  1. Explicitly calculate coefficients of fz(x)=f(xz),
  2. Calculate remainders of x,x2,x22,x23,x24,,x2log2p modulo fz(x) by squaring the current polynomial and taking remainder modulo fz(x),
  3. Using exponentiation by squaring and polynomials calculated on the previous steps calculate the remainder of x(p1)/2 modulo fz(x),
  4. If x(p1)/2±1(modfz(x)) then gcd mentioned above provide a non-trivial factorization of fz(x),
  5. Otherwise all roots of fz(x) are either residues or non-residues simultaneously and one has to choose another z.

If f(x) is divisible by some non-linear primitive polynomial g(x) over Zp then when calculating gcd with g0(x) and g1(x) one will obtain a non-trivial factorization of fz(x)/gz(x), thus algorithm allows to find all roots of arbitrary polynomials over Zp.

3.4. Modular Square Root

Consider equation x2a(modp) having elements β and β as its roots. Solution of this equation is equivalent to factorization of polynomial f(x)=x2a=(xβ)(x+β) over Zp. In this particular case problem it is sufficient to calculate only gcd(fz(x);g0(x)). For this polynomial exactly one of the following properties will hold:

  1. GCD is equal to 1 which means that z+β and zβ are both quadratic non-residues,
  2. GCD is equal to fz(x)which means that both numbers are quadratic residues,
  3. GCD is equal to (xt)which means that exactly one of these numbers is quadratic residue.

In the third case GCD is equal to either (xzβ) or (xz+β). It allows to write the solution as β=(tz)(modp).[1]

3.5. Example

Assume we need to solve the equation x25(mod11). For this we need to factorize f(x)=x25=(xβ)(x+β). Consider some possible values of z:

  1. Let z=3. Then fz(x)=(x3)25=x26x+4, thus gcd(x26x+4;x51)=1. Both numbers 3±β are quadratic non-residues, so we need to take some other z.
  1. Let z=2. Then fz(x)=(x2)25=x24x1, thus gcd(x24x1;x51)x9(mod11). From this follows x9=x2β, so β7(mod11) and β74(mod11).

A manual check shows that, indeed, 72495(mod11) and 42165(mod11).

4. Correctness Proof

The algorithm finds factorization of fz(x) in all cases except for ones when all numbers z+λ1,z+λ2,,z+λn are quadratic residues or non-residues simultaneously. According to theory of cyclotomy,[7] the probability of such an event for the case when λ1,,λn are all residues or non-residues simultaneously (that is, when z=0 would fail) may be estimated as 2k where k is the number of distinct values in λ1,,λn.[1] In this way even for the worst case of k=1 and f(x)=(xλ)n, the probability of error may be estimated as 1/2 and for modular square root case error probability is at most 1/4.

5. Complexity

Let a polynomial have degree n. We derive the algorithm's complexity as follows:

  1. Due to the binomial theorem Undefined control sequence \binom, we may transition from f(x) to f(xz) in O(n2) time.
  2. Polynomial multiplication and taking remainder of one polynomial modulo another one may be done in O(n2), thus calculation of x2kmodfz(x) is done in O(n2logp).
  3. Binary exponentiation works in O(n2logp).
  4. Taking the gcd of two polynomials via Euclidean algorithm works in O(n2).

Thus the whole procedure may be done in O(n2logp). Using the fast Fourier transform and Half-GCD algorithm,[8] the algorithm's complexity may be improved to O(nlognlogpn). For the modular square root case, the degree is n=2, thus the whole complexity of algorithm in such case is bounded by O(logp) per iteration.[6]

References

  1. Berlekamp, E. R. (1970). "Factoring polynomials over large finite fields" (in en). Mathematics of Computation 24 (111): 713–735. doi:10.1090/S0025-5718-1970-0276200-X. ISSN 00255718. https://www.ams.org/mcom/1970-24-111/S0025-5718-1970-0276200-X/. ;
  2. M. Rabin (1980). "Probabilistic Algorithms in Finite Fields". SIAM Journal on Computing 9 (2): 273–280. doi:10.1137/0209024. ISSN 00975397.  https://dx.doi.org/10.1137%2F0209024
  3. Tsz-Wo Sze (2011). "On taking square roots without quadratic nonresidues over finite fields". Mathematics of Computation 80 (275): 1797–1811. doi:10.1090/s0025-5718-2011-02419-1. ISSN 00255718.  https://dx.doi.org/10.1090%2Fs0025-5718-2011-02419-1
  4. R. Peralta (November 1986). "A simple and fast probabilistic algorithm for computing square roots modulo a prime number (Corresp.)". IEEE Transactions on Information Theory 32 (6): 846–847. doi:10.1109/TIT.1986.1057236. ISSN 00189448.  https://dx.doi.org/10.1109%2FTIT.1986.1057236
  5. C Padró, G Sáez (August 2002). "Taking cube roots in Zm". Applied Mathematics Letters 15 (6): 703–708. doi:10.1016/s0893-9659(02)00031-9. ISSN 08939659.  https://dx.doi.org/10.1016%2Fs0893-9659%2802%2900031-9
  6. 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. https://www.springer.com/gp/book/9780792392828. ;
  7. Marshall Hall (1998). Combinatorial Theory. John Wiley & Sons. ISBN 9780471315186. https://books.google.com/?id=__JCiiCfu2EC&;pg=PA1&dq=Combinatorial+Theory+hall#v=onepage&q=Combinatorial%20Theory%20hall&f=false. 
  8. Aho, Alfred V. (1974). The design and analysis of computer algorithms. Addison-Wesley Pub. Co. ISBN 0201000296. https://archive.org/details/designanalysisof00ahoarich. ;
More
Information
Subjects: Others
Contributor MDPI registered users' name will be linked to their SciProfiles pages. To register with us, please refer to https://encyclopedia.pub/register :
View Times: 1.4K
Entry Collection: HandWiki
Revision: 1 time (View History)
Update Date: 02 Nov 2022
Academic Video Service