Bairstow’s method is an efficient algorithm for finding the roots of a real polynomial of arbitrary degree. The algorithm first appeared in the appendix of the 1920 book Applied Aerodynamics by Leonard Bairstow. The algorithm finds the roots in complex conjugate pairs using only real arithmetic.
Example On Using The Code:
f = 6*x^5 + 11*x^4 - 33*x^3 - 33*x^2 + 11*x + 6; % polynomial you want to solve p = double(coeffs(f)); % Polynomial Coefficients in increasing order err = 1.0e-4; % Error Tolerance Max = 1000; % Maximum Number of Iterations
Number of Iterations = 6 ROOTS = -0.333335428747810 0.500001061746864 -0.999998759677231 1.999999878936118 -3.000000085591275 err = 1.0e-05 * 0.008559127318009 -0.124032276838104 0.209541447632189 -0.106174686426153 0.012106388336264
- Description of the method
- External links
Description of the Method
Bairstow’s approach is to use Newton’s method to adjust the coefficients u and v in the quadratic x^2 + ux + v until its roots are also roots of the polynomial being solved. The roots of the quadratic may then be determined, and the polynomial may be divided by the quadratic to eliminate those roots. This process is then iterated until the polynomial becomes quadratic or linear, and all the roots have been determined.
Long division of the polynomial to be solved
by x^2 + ux + v yields a quotient:
and a remainder cx + d such that
A second division of Q(x) by x^2 + ux + v is performed to yield a quotient:
and remainder gx + h with
The variables c,d,g,h, and the bi, fi are functions of u and v. They can be found recursively as follows.
The quadratic evenly divides the polynomial when
Values of u and v for which this occurs can be discovered by picking starting values and iterating Newton’s method in two dimensions
until convergence occurs. This method to find the zeroes of polynomials can thus be easily implemented with a programming language or even a spreadsheet.
The task is to determine a pair of roots of the polynomial
As first quadratic polynomial one may choose the normalized polynomial formed from the leading three coefficients of f(x),
The iteration then produces the table
After eight iterations the method produced a quadratic factor that contains the roots −1/3 and −3 within the represented precision. The step length from the fourth iteration on demonstrates the superlinear speed of convergence.
Bairstow’s algorithm inherits the local quadratic convergence of Newton’s method, except in the case of quadratic factors of multiplicity higher than 1, when convergence to that factor is linear. A particular kind of instability is observed when the polynomial has odd degree and only one real root. Quadratic factors that have a small value at this real root tend to diverge to infinity.
The images represent pairs (s,t) in [-3,3]^2. Points in the upper half plane t > 0 correspond to a linear factor with roots s +- i.t , that is x^2 + ux + v = (x – s)^2 + t^2. Points in the lower half plane t < 0 correspond to quadratic factors with roots s +- i.t, that is, x^2 + ux + v = (x – s)^2 – t^2, so in general (u,v) = (-2.s, s^2 + t.|t|). Points are colored according to the final point of the Bairstow iteration, black points indicate divergent behavior.
The first image is a demonstration of the single real root case. The second indicates that one can remedy the divergent behavior by introducing an additional real root, at the cost of slowing down the speed of convergence. One can also in the case of odd degree polynomials first find a real root using Newton’s method and/or an interval shrinking method, so that after deflation a better-behaved even-degree polynomial remains. The third image corresponds to the example above.
- Bairstow’s Algorithm on Mathworld
- Numerical Recipes in Fortran 77 Online
- Example polynomial root solver (deg(P) ≤ 10) using Bairstow’s Method
- LinBairstowSolve, an open-source C++ implementation of the Lin-Bairstow method available as a method of the VTK library
- Online root finding of a polynomial – Bairstow’s method by Farhad Mazlumi