All Topics  
Root-finding algorithm

 

   Email Print
   Bookmark   Link






 

Root-finding algorithm



 
 
A root-finding algorithm is a numerical method, or algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
, for finding a value x such that f(x) = 0, for a given function
Function (mathematics)

The mathematical concept of a function expresses dependence between two quantities, one of which is known and the other which is produced. A function associates a single output to each input element drawn from a fixed Set , such as the real numbers , although different inputs may have the same output....
 f. Such an x is called a root
Root (mathematics)

In mathematics, a root of a complex-valued Function is a member of the Domain of such that vanishes at , that is,In other words, a "root" of a function is a value for that produces a result of zero ....
 of the function f.

This article is concerned with finding real
Real number

In mathematics, the real numbers may be described informally in several different ways. The real numbers include both rational numbers, such as 42 and −23/129, and irrational numbers, such as pi and the square root of two; or, a real number can be given by an infinite decimal representation, such as 2.4871773339...., where the digits co...
 or complex
Complex number

In mathematics, the complex numbers are an extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies:...
 roots, approximated as floating point numbers. Finding integer roots or exact algebraic roots are separate problems, whose algorithms have little in common with those discussed here.






Discussion
Ask a question about 'Root-finding algorithm'
Start a new discussion about 'Root-finding algorithm'
Answer questions from other users
Full Discussion Forum



Encyclopedia


A root-finding algorithm is a numerical method, or algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
, for finding a value x such that f(x) = 0, for a given function
Function (mathematics)

The mathematical concept of a function expresses dependence between two quantities, one of which is known and the other which is produced. A function associates a single output to each input element drawn from a fixed Set , such as the real numbers , although different inputs may have the same output....
 f. Such an x is called a root
Root (mathematics)

In mathematics, a root of a complex-valued Function is a member of the Domain of such that vanishes at , that is,In other words, a "root" of a function is a value for that produces a result of zero ....
 of the function f.

This article is concerned with finding real
Real number

In mathematics, the real numbers may be described informally in several different ways. The real numbers include both rational numbers, such as 42 and −23/129, and irrational numbers, such as pi and the square root of two; or, a real number can be given by an infinite decimal representation, such as 2.4871773339...., where the digits co...
 or complex
Complex number

In mathematics, the complex numbers are an extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies:...
 roots, approximated as floating point numbers. Finding integer roots or exact algebraic roots are separate problems, whose algorithms have little in common with those discussed here. (See: Diophantine equation
Diophantine equation

In mathematics, a Diophantine equation is an indeterminate equation polynomial equation that allows the variables to be integers only. Diophantine problems have fewer equations than unknown variables and involve finding integers that work correctly for all equations....
 as for integer roots)

Finding a root of f(x)g(x) = 0 is the same as solving the equation
Equation

An equation is a mathematics Proposition, in table of mathematical symbols, that two things are exactly the same . Equations are written with an equal sign, as in...
 f(x) = g(x). Here, x is called the unknown in the equation. Conversely, any equation can take the canonical
Canonical

Canonical is an adjective derived from wikt:canon. Canon comes from the Greek word kanon, "rule" , and is used in various meanings....
 form f(x) = 0, so equation solving
Equation solving

In mathematics, equation solving is the problem of finding what values fulfill a condition stated as an equality . Usually, this condition involves expressions with variables , which are to be substituted by values in order for the equality to hold....
 is the same thing as computing (or finding) a root of a function.

Numerical root-finding methods use iteration
Iteration

Iteration means the act of repeating....
, producing a sequence
Sequence

In mathematics, a sequence is an ordered list of objects . Like a Set , it contains Element , and the number of terms is called the length of the sequence....
 of numbers that hopefully converge towards a limit
Limit (mathematics)

In mathematics, the concept of a "limit" is used to describe the behavior of a Function as its argument or input either "gets close" to some point, or as the argument becomes arbitrarily large; or the behavior of a sequence's elements as their index increases indefinitely....
 (the so called "fixed point
Fixed point (mathematics)

In mathematics, a fixed point of a function is a point that is mapped to itself by the function. That is to say, x is a fixed point of the function f if and only if f = x....
") which is a root. The first values of this series are initial guesses. The method computes subsequent values based on the old ones and the function f.

The behaviour of root-finding algorithms is studied in numerical analysis
Numerical analysis

Numerical analysis is the study of algorithms for the problems of continuous mathematics .One of the earliest mathematical writings is the Babylonian tablet YBC 7289, which gives a sexagesimal numerical approximation of , the length of the diagonal in a unit square....
. Algorithms perform best when they take advantage of known characteristics of the given function. Thus an algorithm to find isolated real roots of a low-degree polynomial in one variable may bear little resemblance to an algorithm for complex roots of a "black-box" function which is not even known to be differentiable. Questions include ability to separate close roots, robustness in achieving reliable answers despite inevitable numerical errors, and rate of convergence.

Specific algorithms

The simplest root-finding algorithm is the bisection method
Bisection method

In mathematics, the bisection method is a root-finding algorithm which repeatedly divides an Interval in half and then selects the subinterval in which a root exists....
. It works when f is a continuous function
Continuous function

In mathematics, a continuous function is a function for which, intuitively, small changes in the input result in small changes in the output. Otherwise, a function is said to be discontinuous....
 and it requires previous knowledge of two initial guesses, a and b, such that f(a) and f(b) have opposite signs. Although it is reliable, it converges slowly, gaining one bit
Bit

A bit is a binary numeral system numerical digit, taking a value of either 0 or 1. Binary digits are a basic unit of information Computer data storage and transmission in digital computing and digital information theory....
 of accuracy with each iteration.

Newton's method
Newton's method

In numerical analysis, Newton's method is perhaps the best known method for finding successively better approximations to the zeroes of a Real number-valued function ....
 assumes the function f to have a continuous derivative
Derivative

In calculus, a branch of mathematics, the derivative is a measure of how a function changes as its input changes. Loosely speaking, a derivative can be thought of as how much a quantity is changing at a given point....
. Newton's method
Newton's method

In numerical analysis, Newton's method is perhaps the best known method for finding successively better approximations to the zeroes of a Real number-valued function ....
 may not converge if started too far away from a root. However, when it does converge, it is faster than the bisection method. Convergence is usually quadratic, so the number of bits of accuracy doubles with each iteration. Newton's method is also important because it readily generalizes to higher-dimensional problems. Newton-like methods with higher order of convergence are the Householder's method
Householder's method

In numerical analysis, the class of Alston Scott Householder's methods are root-finding algorithms used for functions of one real variable with continuous derivatives up to some order d+1, where d will be the order of the Householder's method....
s. The first one after Newton's method is Halley's method
Halley's method

In numerical analysis, Halley's method is a root-finding algorithm used for functions of one real variable with a continuous second derivative, i.e....
 with cubic order of convergence.

Replacing the derivative in Newton's method with a finite difference
Finite difference

A finite difference is a mathematical expression of the form ff. If a finite difference is divided by ba, one gets a difference quotient....
, we get the secant method
Secant method

In numerical analysis, the secant method is a root-finding algorithm that uses a succession of root s of secant lines to better approximate a root of a Function f....
. This method does not require the computation (nor the existence) of a derivative
Derivative

In calculus, a branch of mathematics, the derivative is a measure of how a function changes as its input changes. Loosely speaking, a derivative can be thought of as how much a quantity is changing at a given point....
, but the price is slower convergence (the order is approximately 1.6).

The false position method
False position method

In numerical analysis, the false position method or regula falsi method is a root-finding algorithm that combines features from the bisection method and the secant method....
, also called the regula falsi method, is like the secant method. However, instead of retaining the last two points, it makes sure to keep one point on either side of the root. The false position method is faster than the bisection method and more robust than the secant method.

The secant method also arises if one approximates the unknown function f by linear interpolation
Linear interpolation

Linear interpolation is a method of curve fitting using linear polynomials. It is heavily employed in mathematics , and numerous applications including computer graphics....
. When quadratic interpolation
Polynomial interpolation

In the mathematics subfield of numerical analysis, polynomial interpolation is the interpolation of a given data set by a polynomial. In other words, given some data points , the aim is to find a polynomial which goes exactly through these points....
 is used instead, one arrives at Müller's method
Müller's method

M?ller's method is a root-finding algorithm, a numerical analysis method for solving equations of the form f = 0. It is first presented by D....
. It converges faster than the secant method. A particular feature of this method is that the iterates xn may become complex
Complex number

In mathematics, the complex numbers are an extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies:...
.

This can be avoided by interpolating the inverse
Inverse function

In mathematics, if ƒ is a function from A to B then an inverse function for ƒ is a function in the opposite direction, from B to A, with the property that a round trip from A to B to A returns each element of the initial set to itself....
 of f, resulting in the inverse quadratic interpolation
Inverse quadratic interpolation

In numerical analysis, inverse quadratic interpolation is a root-finding algorithm, meaning that it is an algorithm for solving equations of the form f = 0....
 method. Again, convergence is asymptotically faster than the secant method, but inverse quadratic interpolation often behaves poorly when the iterates are not close to the root.

Finally, Brent's method
Brent's method

In numerical analysis, Brent's method is a complicated but popular root-finding algorithm combining the bisection method, the secant method and inverse quadratic interpolation....
 is a combination of the bisection method, the secant method and inverse quadratic interpolation. At every iteration, Brent's method decides which method out of these three is likely to do best, and proceeds by doing a step according to that method. This gives a robust and fast method, which therefore enjoys considerable popularity.

Finding roots of polynomials

Much attention has been given to the special case that the function f is a polynomial
Polynomial

In mathematics, a polynomial is an expression constructed from variables and constants, using the operations of addition, subtraction, multiplication, and constant non-negative whole number exponents....
; there exist root-finding algorithms exploiting the polynomial nature of f. For a univariate polynomial of degree less than five, we have closed form solutions such as the quadratic formula. However, even this degree-two solution should be used with care to ensure numerical stability, the degree-four solution is unwieldy and troublesome, and higher-degree polynomials have no such general solution.

For real roots, Sturm's theorem
Sturm's theorem

In mathematics, Sturm's theorem is a symbolic procedure to determine the number of distinct real number root s of a polynomial. It was named for Jacques Charles Fran?ois Sturm, though it had actually been discovered by Joseph Fourier; Fourier's paper, delivered on the eve of the French Revolution, was forgotten for many years....
 provides a guide to locating and separating roots. This plus interval arithmetic
Interval arithmetic

Interval arithmetic, interval mathematics, interval analysis, or interval computation, is a method developed by mathematicians since the 1950s and 1960s as an approach to putting bounds on rounding errors in numerical analysis and thus developing numerical methods that yield very reliable results....
 combined with Newton's method
Newton's method

In numerical analysis, Newton's method is perhaps the best known method for finding successively better approximations to the zeroes of a Real number-valued function ....
 yields a robust algorithm
Root-finding algorithm

A root-finding algorithm is a numerical method, or algorithm, for finding a value x such that f = 0, for a given function f. Such an x is called a root of the function f....
, but other choices are more common. One possibility is to form the companion matrix
Companion matrix

In linear algebra, the companion matrix of the monic polynomialis the square matrix defined asWith this convention, and writing the basis as , one has , and generates V as a -module: C cycles basis vectors....
 of the polynomial. Since the eigenvalues of this matrix coincide with the roots of the polynomial, one can use any eigenvalue algorithm
Eigenvalue algorithm

In linear algebra, one of the most important problems is designing efficient and Numerical stability algorithms for finding the eigenvalues of a Matrix ....
 to find the roots of the polynomial. For instance the classical Bernoulli's method to find the root greater in modulus, if it exists, turns out to be the power method applied to the companion matrix
Companion matrix

In linear algebra, the companion matrix of the monic polynomialis the square matrix defined asWith this convention, and writing the basis as , one has , and generates V as a -module: C cycles basis vectors....
.

Laguerre's method
Laguerre's method

In numerical analysis, Laguerre's method is a root-finding algorithm tailored to polynomials. In other words, Laguerre's method can be used to solve numerically the equation...
 is rather complicated, but it converges quickly. It exhibits cubic convergence for simple roots, dominating the quadratic convergence displayed by Newton's method. The Jenkins–Traub method is another complicated method which converges faster than Newton's method.

Bairstow's method
Bairstow's method

In numerical analysis, Bairstow's method is an efficient algorithm for finding the root s of a real polynomial of arbitrary degree. The algorithm first appeared in the appendix of the 1920 book "Applied Aerodynamics" by Leonard Bairstow....
 uses Newton's method
Newton's method

In numerical analysis, Newton's method is perhaps the best known method for finding successively better approximations to the zeroes of a Real number-valued function ....
 to find quadratic factors of a polynomial with real coefficients. It can determine both real and complex roots of a real polynomial using only real arithmetic.

The simple Durand-Kerner
Durand-Kerner method

In numerical analysis, the Durand–Kerner method or method of Karl Weierstrass is a root-finding algorithm for solving polynomial equation s....
 and the slightly more complicated Aberth method
Aberth method

The Aberth-method, sometimes named Aberth-Ehrlich method is a root-finding algorithm for simultaneous approximation of all the roots of a univariate polynomial....
 simultaneously finds all the roots using only simple complex number
Complex number

In mathematics, the complex numbers are an extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies:...
 arithmetic.

The splitting circle method
Splitting circle method

In mathematics, the splitting circle method is a numerical analysis for the numerical factorization of a polynomial and, ultimately, for finding its complex number root ....
 is useful for finding the roots of polynomials of high degree to arbitrary precision; it has almost optimal complexity in this setting. Another method with this style is the Dandelin-Gräffe method (actually due to Lobachevsky
Nikolai Ivanovich Lobachevsky

Nikolai Ivanovich Lobachevsky was a great Russian mathematician, often called the Copernicus of Geometry....
) which factors the polynomial.

Wilkinson's polynomial
Wilkinson's polynomial

In numerical analysis, Wilkinson's polynomial is a specific polynomial which was used by James H. Wilkinson in 1963 to illustrate a difficulty when root-finding algorithm of a polynomial: the location of the roots can be very sensitive to perturbations in the coefficients of the polynomial....
 illustrates that high precision
Precision (arithmetic)

The precision of a value describes the number of numerical digits that are used to express that value. In a scientific setting this would be the total number of digits or, less commonly, the number of fractional digits or decimal places ....
 may be necessary when computing the roots of a polynomial.

Finding multiple roots

If p(x) is a polynomial with a multiple root at r, then finding the value of r can be difficult (inefficient or impossible) for many of the standard root-finding algorithms. Fortunately, there is a technique especially for this case, provided that p is given explicitly as a polynomial in one variable with exact coefficients.

Algorithm

  1. First, we need to determine whether p(x) has a multiple root. If p(x) has a multiple root at r, then its derivative p'(x) will also have a root at r (one fewer than p(x) has there). So we calculate the greatest common divisor of the polynomials p(x) and p'(x); adjust the leading coefficient to be one and call it g(x). (See Sturm's theorem
    Sturm's theorem

    In mathematics, Sturm's theorem is a symbolic procedure to determine the number of distinct real number root s of a polynomial. It was named for Jacques Charles Fran?ois Sturm, though it had actually been discovered by Joseph Fourier; Fourier's paper, delivered on the eve of the French Revolution, was forgotten for many years....
    .) If g(x) = 1, then p(x) has no multiple roots and we can safely use those other root-finding algorithms which work best when there are no multiple roots, and then exit.
  2. Now suppose that there is a multiple root. Notice that g(x) will have a root of the same multiplicity at r that p'(x) has and the degree of the polynomial g(x) will generally be much less than that of p(x). Recursively call this routine, i.e. go back to step #1 above, using g(x) in place of p(x). Now suppose that we have found the roots of g(x), i.e. we have factored it.
  3. Since r has been found, we can factor (x-r) out of p(x) repeatedly until we have removed all of the roots at r. Repeat this for any other multiple roots until there are no more multiple roots. Then the quotient, i.e. the remaining part of p(x), can be factored in the usual way with one of the other root-finding algorithms. Exit.


Example

Suppose p(x) = x3+x2-5x+3 is the function whose roots we want to find. We calculate p'(x) = 3x2+2x-5. Now divide p'(x) into p(x) to get p(x) = p'(x)·((1/3)x+(1/9))+((-32/9)x+(32/9)). Divide the remainder by -32/9 to get x-1 which is monic. Divide x-1 into p'(x) to get p'(x) = (x-1)·(3x+5)+0. Since the remainder is zero, g(x) = x-1. So the multiple root of p(x) is r = 1. Dividing p(x) by (x-1)2, we get p(x) = (x+3)(x-1)2 so the other root is -3, a single root.

Algebraic geometry

The performance of standard polynomial root-finding algorithms degrades in the presence of multiple roots. Using ideas from algebraic geometry, has published a more sophisticated approach, with a MATLAB
MATLAB

MATLAB is a Numerical analysis environment and programming language. Maintained by The MathWorks, MATLAB allows easy matrix manipulation, plotting of function and data, implementation of algorithms, creation of user interfaces, and interfacing with programs in other languages....
 , that identifies and handles multiplicity structures considerably better. A different algebraic approach including symbolic computations has been pursued by and colleagues, available as a (PDF).

Direct algorithm for multiple root elimination


There is a direct method of eliminating multiple (or repeated) roots from polynomials with exact coefficients (integers, rational numbers, Gaussian integers or rational complex numbers).

Suppose a is a root of P(x) with multiplicity m>0. Then a will be a root of the formal derivative P’(x) with multiplicity m-1. (If m=1, then a will be a "root of P’(x) with multiplicity 0". That is, if it is a distinct (non-multiple) root of the polynomial, then it won't be a root of the polynomial's derivative.) However, P’(x) may have additional roots that are not roots of P(x). (For example, if P(x)=(x-1)3(x-3)3, then P’(x)=6(x-1)2(x-2)(x-3)2. So 2 is a root of P’(x) here, but not of P(x).)

Define G(x) to be the greatest common divisor
Greatest common divisor

In mathematics, the greatest common divisor , sometimes known as the greatest common factor or highest common factor , of two non-zero integers, is the largest positive integer that divisor both numbers without remainder....
 of P(x) and P’(x).

Finally, G(x) divides P(x) exactly, so form the quotient Q(x)=P(x)/G(x).

Now, a is a root of P(x) with multiplicity m>0 if and only if a is a root of Q(x) with multiplicity 1. That is, Q(x) has exactly the roots of P(x), but has no multiple roots.

As P(x) is a polynomial with exact coefficients, then if the algorithm is executed using exact arithmetic, Q(x) will also be a polynomial with exact coefficients.

Q(x) may also be simpler than P(x): degree(Q(x)) = degree(P(x)). Whether or not degree(P(x))=4, if degree(Q(x))=4 then the roots may be found algebraically.

It is then possible to determine the multiplicities of those roots in P(x) algebraically.

If degree(Q(x))>4, standard (iterative) root-finding algorithms may be used, and should perform well in the absence of multiple roots.

See also


External links