In
number theory
Number theory (or arithmetic or higher arithmetic in older usage) is a branch of pure mathematics devoted primarily to the study of the integers and integer-valued functions. German mathematician Carl Friedrich Gauss (1777–1855) said, "Math ...
, Berlekamp's root finding algorithm, also called the Berlekamp–Rabin algorithm, is the
probabilistic
Probability is the branch of mathematics concerning numerical descriptions of how likely an event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and 1, where, roughly speaking, ...
method of
finding roots of
polynomials
In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An example ...
over a
field . The method was discovered by
Elwyn Berlekamp
Elwyn Ralph Berlekamp (September 6, 1940 – April 9, 2019) was a professor of mathematics and computer science at the University of California, Berkeley.Contributors, ''IEEE Transactions on Information Theory'' 42, #3 (May 1996), p. 1048. DO10. ...
in 1970
as an auxiliary to the
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
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.
History
The method was proposed by
Elwyn Berlekamp
Elwyn Ralph Berlekamp (September 6, 1940 – April 9, 2019) was a professor of mathematics and computer science at the University of California, Berkeley.Contributors, ''IEEE Transactions on Information Theory'' 42, #3 (May 1996), p. 1048. DO10. ...
in his 1970 work
on polynomial factorization over finite fields. His original work lacked a formal
correctness proof
and was later refined and modified for arbitrary finite fields by
Michael Rabin
Michael Rabin ( ; May 2, 1936January 19, 1972) was an American violinist. He has been described as "one of the most talented and tragic violin virtuosi of his generation". His complete Paganini "24 Caprices" for solo violin are available as a si ...
.
In 1986 René Peralta proposed a similar algorithm for finding square roots in
. In 2000 Peralta's method was generalized for cubic equations.
Statement of problem
Let
be an odd prime number. Consider the polynomial
over the field
of remainders modulo
. The algorithm should find all
in
such that
in
.
Algorithm
Randomization
Let
. 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
where
is some any element of
. If one can represent this polynomial as the product
then in terms of the initial polynomial it means that
, which provides needed factorization of
.
Classification of elements
Due to
Euler's criterion In number theory, Euler's criterion is a formula for determining whether an integer is a quadratic residue modulo a prime. Precisely,
Let ''p'' be an odd prime and ''a'' be an integer coprime to ''p''. Then
:
a^ \equiv
\begin
\;\;\,1\pmod& \tex ...
, for every
monomial
In mathematics, a monomial is, roughly speaking, a polynomial which has only one term. Two definitions of a monomial may be encountered:
# A monomial, also called power product, is a product of powers of variables with nonnegative integer expon ...
exactly one of following properties holds:
# The monomial is equal to
if
,
# The monomial divides
if
is
quadratic residue
In number theory, an integer ''q'' is called a quadratic residue modulo ''n'' if it is congruent to a perfect square modulo ''n''; i.e., if there exists an integer ''x'' such that:
:x^2\equiv q \pmod.
Otherwise, ''q'' is called a quadratic non ...
modulo
,
# The 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
.
Berlekamp's method
The property above leads to the following algorithm:
# Explicitly calculate coefficients of
,
# Calculate remainders of
modulo
by squaring the current polynomial and taking remainder modulo
,
# Using
exponentiation by squaring
Exponentiation is a mathematical operation, written as , involving two numbers, the '' base'' and the ''exponent'' or ''power'' , and pronounced as " (raised) to the (power of) ". When is a positive integer, exponentiation corresponds to re ...
and polynomials calculated on the previous steps calculate the remainder of
modulo
,
# If
then
mentioned above provide a non-trivial factorization of
,
# 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 a 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 it is sufficient to calculate only
. For this polynomial exactly one of the following properties will hold:
# GCD is equal to
which means that
and
are both quadratic non-residues,
# GCD is equal to
which means that both numbers are quadratic residues,
# 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
.
Example
Assume we need to solve the equation
. For this we need to factorize
. Consider some possible values of
:
# Let
. Then
, thus
. Both numbers
are quadratic non-residues, so we need to take some other
.
# Let
. Then
, thus
. From this follows
, so
and
.
A manual check shows that, indeed,
and
.
Correctness proof
The 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
A theory is a rational type of abstract thinking about a phenomenon, or the results of such thinking. The process of contemplative and rational thinking is often associated with such processes as observational study or research. Theories may be s ...
, the probability of such an 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 distinct values in
.
In this way even for the worst case of
and
, the probability of error may be estimated as
and for modular square root case error probability is at most
.
Complexity
Let a polynomial have degree
. We derive the algorithm's complexity as follows:
# Due to the
binomial theorem
In elementary algebra, the binomial theorem (or binomial expansion) describes the algebraic expansion of powers of a binomial. According to the theorem, it is possible to expand the polynomial into a sum involving terms of the form , where the ...
, we may transition from
to
in
time.
# Polynomial multiplication and taking remainder of one polynomial modulo another one may be done in
, thus calculation of
is done in
.
# Binary exponentiation works in
.
# Taking the
of two polynomials via
Euclidean algorithm
In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an ...
works in
.
Thus the whole procedure may be done in
. Using the
fast Fourier transform
A fast Fourier transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). Fourier analysis converts a signal from its original domain (often time or space) to a representation in t ...
and Half-GCD algorithm,
the algorithm's complexity may be improved to
. For the modular square root case, the degree is
, thus the whole complexity of algorithm in such case is bounded by
per iteration.
References
{{DEFAULTSORT:Berlekamp-Rabin algorithm
Algorithms
Algebra
Number theoretic algorithms
Polynomials