You are on page 1of 6

Lesson 14 Synthetic Division and Horners Method

Denition 14.1 (Polynomial). Let a0 , . . . , an be arbitrary constants. Then any function P (x) of the form
n

P (x) =
k=0

ak xk = a0 + a1 x + a2 x2 + + an xn

(14.1)

with an = 0 is called a polynomial of order n in x. To implement a polynomial most eciently, we observe that once we know x2 , it is faster to calculate x3 = x x2 rather than as x x x; once we know x3 it is faster to calculate x4 as x x3 rather than x x x x; and so forth. In general, we want to calculate xn as x xn1 . This produces the concept of nested multiplication: P (x) = a0 + a1 x + a2 x + + an xn = a0 + x(a1 + a2 x + a3 x2 + + an xn1 ) . . . = a0 + x(a1 + x(a2 + x(a3 + + x(an1 + an x))) ) (14.2) (14.3)

(14.4)

Theorem 14.1 (Fundamental Theorem of Algebra). Every polynomial of degree n has precisely n roots. Some (or all) of the roots may be complex. Since complex roots come in conjugate pairs, the total number of complex roots must be even. Thus a polynomial of odd degree always has at least one real root. If the unique roots are given as r1 , r2 , ..., rk each with multiplicity m1 , m2 , ..., mk then we can always write a polynomial as P (x) = C(x r1 )m1 (x r2 )m2 (x rk )mk 91 (14.5)

92

LESSON 14. SYNTHETIC DIVISION AND HORNERS METHOD

Descarte proposed in 1637 that one could imagine that there were n roots to a polynomial. Albert Girard (1629) proposed that an nth order polynomial has n roots but that they may exist in a eld larger than the complex numbers. The rst published proof of the fundamental theorem of algebra was by DAlembert in 1746, but his proof was based on an earlier theorem that itself used the theorem, and hence is unsatisfactory. At about the same time Euler proved it for polynomials with real coecients up to 6th. Between 1799 (in his doctoral dissertation) and 1816 Gauss published three dierent proofs for polynomials with with real coecients, and in 1849 he proved the general case for polynomials with complex coecients. Theorem 14.2. If two polynomials of degree n agree at n + 1 unique points, then they must be identical. More precisely: If P (x) and Q(x) are two polynomials of the same degree n that agree at at least n + 1 distinct points, i.e, if there exist unique numbers x1 , ..., xn+1 such that P (xk ) = Q(xk ) then P (x) = Q(x) for all x. For example, if two lines are equal at two points, they are identical; if two parabolas match at three points, they are identical; and so on. Theorem 14.3 (Horners Method for Synthetic Division). Let P (x) be any polynomial of degree n, given by P (x) = a0 + a1 x + a2 x + + an xn (14.6)

Then for any number x0 there exists another polynomial Q(x) of degree n 1, given by Q(x) = b1 + b2 x + b3 x2 + + bn xn1 (14.7) such that P (x) = (x x0 )Q(x) + b0 where bn = an , bk = ak + bk+1 x0 (14.9) for k = n 1, n 2, ..., 0, for k = n 1, n 2, . . . , 0 Furthermore, b0 = P (x0 ) and P (x0 ) = Q(x0 ) Proof. Suppose that Q(x) = bn xn1 + bn1 xn2 + + b3 x2 + b2 x + b1 (14.11) (14.10) (14.8)

for some undetermined numbers b1 , . . . , bn . Then we ask what conditions will ensure that P (x) = (x x0 )Q(x) + b0 (14.12)
Math 481A California State University Northridge 2008, B.E.Shapiro Last revised: November 16, 2011

LESSON 14. SYNTHETIC DIVISION AND HORNERS METHOD Multiplying things out, (x x0 )Q(x) + b0 = b0 + (x x0 )(bn xn1 + bn1 xn2 + + b3 x2 + b2 x + b1 ) = b0 + x(bn xn1 + bn1 xn2 + + b3 x2 + b2 x + b1 ) x0 (bn xn1 + bn1 xn2 + + b3 x2 + b2 x + b1 ) = bn xn + bn1 xn1 + bn2 xn2 + + b2 x2 + b1 x bn x0 xn1 x0 bn1 xn2 x0 b3 x2 x 0 b2 x x 0 b1 + b0 = bn xn + (bn1 bn x0 )xn1 + (bn2 x0 bn1 )xn2 + + (b2 x0 b3 )x2 + (b1 x0 b2 )x + (b0 x0 b1 ) We want this to be equal to P (x) = a0 + a1 x + a2 x + + an xn Equating coecients of like powers of x gives us an = b n an1 = bn1 bn x0 an2 = bn2 bn1 x0 . . . a0 = b 0 x 0 b 1 Rearranging, b n = an bn1 = an1 + bn x0 bn2 = an2 + bn1 x0 . . . b 0 = a0 + b 1 x 0 This proves equation 14.9. Next, to see that b0 = P (x0 ) we observe that P (0) = (x0 x0 )Q(x0 ) + b0 = b0 Furthermore, dierentiating P (x) = (x x0 )Q(x) + b0 gives P (x) = (x x0 )Q (x) + Q(x)
2008, B.E.Shapiro Last revised: November 16, 2011

93

(14.13) (14.14)

(14.15) (14.16) (14.17)

(14.18)

(14.19) (14.20) (14.21)

(14.22)

(14.23) (14.24) (14.25)

(14.26)

(14.27)

(14.28)

Math 481A California State University Northridge

94 hence

LESSON 14. SYNTHETIC DIVISION AND HORNERS METHOD

P (x0 ) = Q(x0 ) which gives us equation 14.10.

(14.29)

The following gives a recapitulation of the algorithm for Horners method to calculate the numbers P (x0 ) and P (x0 ) for a polynomial. Algorithm Horner Input a0 , . . . , an , x0 ; Set y = an ; (y will give the bn for P ) Set z = an ; (z gives the bn1 for Q) For j = n 1, n 2, . . . , 1, y = x0 y + aj ; (this gives bj for P (x0 )) z = x0 z + y; (this gives bj1 for the calculation of Q(x0 ) ) End For; y = x0 y + a0 ; (this gives b0 ) Return y (which is P (x0 )) and z (which is P (x0 ) = Q(x0 )) We can make two interesting observations about Horners method. First, it has the same number of multiplications as nested multiplication, making it at least as ecient as that algorithm. Secondly, it gives us a number for both P (x0 ) and P (x0 ) for no extra cost. This becomes useful in operations where both numbers are needed, such as in the calculation of Newtons method (for the roots of a polynomial). Algorithm Newtons Method with Horner Input a0 , . . . , an , x0 , tolerance ; (p0 , p0 ) = Horner(a0 , . . . , an , x0 ) p = x0 = p0 /p0 While || > , p=p (p0 , p0 ) = Horner(a0 , . . . , an , p) = p0 /p0 End While Return p Let x0 be a root of P . Then we know that there exists a second polynomial Q(x) such that P (x) = (x x0 )Q(x) + P (x0 ) = (x x0 )Q(x). So if P has any other roots that are dierent from x0 then they are also roots of Q. Hence if we repeat the process on Q iteratively we will nd all the subsequent roots of P . Unfortunately this leads to round-o error that can be avoided by using a dierent algorithm that we will discuss subsequently.
Math 481A California State University Northridge 2008, B.E.Shapiro Last revised: November 16, 2011

LESSON 14. SYNTHETIC DIVISION AND HORNERS METHOD

95

Example 14.1. Find P (1) and P (1) for P (x) = x3 2x2 5 using Horners method. Solution. We have a0 = 5, a1 = 0, a2 = 2, and a3 = 1, and also x0 = 1. Then If we set z = a3 = 1, b3 b2 b1 b0 = a3 = 1 = a2 + b3 x0 = 2 + (1)(1) = 1 = a1 + b2 x0 = 0 + (1)(1) = 1 = a0 + b1 x0 = 5 + (1)(1) = 6 (14.30) (14.31) (14.32) (14.33)

Hence P (1) = 6. Using the same algorithm for Q we have c 2 = b3 = 1 c1 = b2 + c2 x0 = (1) + (1)(1) = 0 c0 = b1 + c1 x0 = (1) + (0)(1) = 1 Hence Q(1) = P (1) = c0 = 1. Horners method is also fairly easy to implement in Mathematica. We can take advantage of the fact that a list may have an arbitrary number of elements, so we dont even need to know the order of the polynomial: Horner[A_?ListQ, x0_] := Module[{z, y, a}, a = A; y = z = Last[a]; a = Most[a]; While[Length[a] > 1, y = x0*y + Last[a]; z = x0*z + y; a = Most[a]; ]; y = x0*y + Last[a]; Print["P(x)=" A.("x"^Range[0, Length[A] - 1])]; Print["P(", x0, ")=", y, "\n", "P(", x0, ")=", z]; Return[{y, z}] ] (14.34) (14.35) (14.36)

2008, B.E.Shapiro Last revised: November 16, 2011

Math 481A California State University Northridge

96

LESSON 14. SYNTHETIC DIVISION AND HORNERS METHOD

Math 481A California State University Northridge

2008, B.E.Shapiro Last revised: November 16, 2011

You might also like