Lesson 14 Synthetic Division and Horner's Method - Bruce E. Shapiro
Lesson 14 Synthetic Division and Horner's Method - Bruce E. Shapiro
Lesson 14 Synthetic Division and Horner's Method - Bruce E. Shapiro
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Lesson</strong> <strong>14</strong><br />
<strong>Synthetic</strong> <strong>Division</strong> <strong>and</strong> Horner’s<br />
<strong>Method</strong><br />
Definition <strong>14</strong>.1 (Polynomial). Let a 0 , . . . , a n be arbitrary constants. Then any<br />
function P (x) of the form<br />
P (x) =<br />
n∑<br />
a k x k = a 0 + a 1 x + a 2 x 2 + · · · + a n x n (<strong>14</strong>.1)<br />
k=0<br />
with a n ≠ 0 is called a polynomial of order n in x.<br />
To implement a polynomial most efficiently, we observe that once we know x 2 , it is<br />
faster to calculate x 3 = x × x 2 rather than as x × x × x; once we know x 3 it is faster<br />
to calculate x 4 as x × x 3 rather than x × x × x × x; <strong>and</strong> so forth. In general, we want<br />
to calculate x n as x × x n−1 . This produces the concept of nested multiplication:<br />
P (x) = a 0 + a 1 x + a 2 x + · · · + a n x n (<strong>14</strong>.2)<br />
.<br />
= a 0 + x(a 1 + a 2 x + a 3 x 2 + · · · + a n x n−1 ) (<strong>14</strong>.3)<br />
= a0 + x(a 1 + x(a 2 + x(a 3 + · · · + x(a n−1 + a n x))) · · · ) (<strong>14</strong>.4)<br />
Theorem <strong>14</strong>.1 (Fundamental Theorem of Algebra). Every polynomial of degree<br />
n has precisely n roots.<br />
Some (or all) of the roots may be complex. Since complex roots come in conjugate<br />
pairs, the total number of complex roots must be even. Thus a polynomial of odd<br />
degree always has at least one real root. If the unique roots are given as r 1 , r 2 , ..., r k<br />
each with multiplicity m 1 , m 2 , ..., m k then we can always write a polynomial as<br />
P (x) = C(x − r 1 ) m 1<br />
(x − r 2 ) m2 · · · (x − r k ) m k<br />
(<strong>14</strong>.5)<br />
91
92 LESSON <strong>14</strong>. SYNTHETIC DIVISION AND HORNER’S METHOD<br />
Descarte proposed in 1637 that one could imagine that there were n roots to a polynomial.<br />
Albert Girard (1629) proposed that an n th order polynomial has n roots but<br />
that they may exist in a field larger than the complex numbers. The first published<br />
proof of the fundamental theorem of algebra was by DAlembert in 1746, but his proof<br />
was based on an earlier theorem that itself used the theorem, <strong>and</strong> hence is unsatisfactory.<br />
At about the same time Euler proved it for polynomials with real coefficients up<br />
to 6th. Between 1799 (in his doctoral dissertation) <strong>and</strong> 1816 Gauss published three<br />
different proofs for polynomials with with real coefficients, <strong>and</strong> in 1849 he proved the<br />
general case for polynomials with complex coefficients.<br />
Theorem <strong>14</strong>.2. If two polynomials of degree n agree at n + 1 unique points, then<br />
they must be identical. More precisely: If P (x) <strong>and</strong> Q(x) are two polynomials of the<br />
same degree n that agree at at least n + 1 distinct points, i.e, if there exist unique<br />
numbers x 1 , ..., x n+1 such that P (x k ) = Q(x k ) then P (x) = Q(x) for all x.<br />
For example, if two lines are equal at two points, they are identical; if two parabolas<br />
match at three points, they are identical; <strong>and</strong> so on.<br />
Theorem <strong>14</strong>.3 (Horner’s <strong>Method</strong> for <strong>Synthetic</strong> <strong>Division</strong>). Let P (x) be any<br />
polynomial of degree n, given by<br />
P (x) = a 0 + a 1 x + a 2 x + · · · + a n x n (<strong>14</strong>.6)<br />
Then for any number x 0 there exists another polynomial Q(x) of degree n − 1, given<br />
by<br />
Q(x) = b 1 + b 2 x + b 3 x 2 + · · · + b n x n−1 (<strong>14</strong>.7)<br />
such that<br />
where b n = a n ,<br />
P (x) = (x − x 0 )Q(x) + b 0 (<strong>14</strong>.8)<br />
b k = a k + b k+1 x 0 (<strong>14</strong>.9)<br />
for k = n − 1, n − 2, ..., 0, for k = n − 1, n − 2, . . . , 0 Furthermore, b 0 = P (x 0 ) <strong>and</strong><br />
Proof. Suppose that<br />
P ′ (x 0 ) = Q(x 0 ) (<strong>14</strong>.10)<br />
Q(x) = b n x n−1 + b n−1 x n−2 + · · · + b 3 x 2 + b 2 x + b 1 (<strong>14</strong>.11)<br />
for some undetermined numbers b 1 , . . . , b n . Then we ask what conditions will ensure<br />
that<br />
P (x) = (x − x 0 )Q(x) + b 0 (<strong>14</strong>.12)<br />
Math 481A<br />
California State University Northridge<br />
2008, B.E.<strong>Shapiro</strong><br />
Last revised: November 16, 2011
LESSON <strong>14</strong>. SYNTHETIC DIVISION AND HORNER’S METHOD 93<br />
Multiplying things out,<br />
(x − x 0 )Q(x) + b 0 = b 0 +<br />
(x − x 0 )(b n x n−1 + b n−1 x n−2 + · · · + b 3 x 2 + b 2 x + b 1 ) (<strong>14</strong>.13)<br />
= b 0 + x(b n x n−1 + b n−1 x n−2 + · · · + b 3 x 2 + b 2 x + b 1 )<br />
− x 0 (b n x n−1 + b n−1 x n−2 + · · · + b 3 x 2 + b 2 x + b 1 ) (<strong>14</strong>.<strong>14</strong>)<br />
= b n x n + b n−1 x n−1 + b n−2 x n−2 + · · · + b 2 x 2 + b 1 x<br />
− b n x 0 x n−1 − x 0 b n−1 x n−2 − · · · − x 0 b 3 x 2<br />
− x 0 b 2 x − x 0 b 1 + b 0 (<strong>14</strong>.15)<br />
= b n x n + (b n−1 − b n x 0 )x n−1 +<br />
(b n−2 − x 0 b n−1 )x n−2 + · · · + (<strong>14</strong>.16)<br />
(b 2 − x 0 b 3 )x 2 + (b 1 − x 0 b 2 )x + (b 0 − x 0 b 1 ) (<strong>14</strong>.17)<br />
We want this to be equal to<br />
P (x) = a 0 + a 1 x + a 2 x + · · · + a n x n (<strong>14</strong>.18)<br />
Equating coefficients of like powers of x gives us<br />
a n = b n (<strong>14</strong>.19)<br />
a n−1 = b n−1 − b n x 0 (<strong>14</strong>.20)<br />
a n−2 = b n−2 − b n−1 x 0 (<strong>14</strong>.21)<br />
.<br />
a 0 = b 0 − x 0 b 1 (<strong>14</strong>.22)<br />
Rearranging,<br />
b n = a n (<strong>14</strong>.23)<br />
b n−1 = a n−1 + b n x 0 (<strong>14</strong>.24)<br />
b n−2 = a n−2 + b n−1 x 0 (<strong>14</strong>.25)<br />
.<br />
b 0 = a 0 + b 1 x 0 (<strong>14</strong>.26)<br />
This proves equation <strong>14</strong>.9.<br />
Next, to see that b 0 = P (x 0 ) we observe that<br />
P (0) = (x 0 − x 0 )Q(x 0 ) + b 0 = b 0 (<strong>14</strong>.27)<br />
Furthermore, differentiating P (x) = (x − x 0 )Q(x) + b 0 gives<br />
P ′ (x) = (x − x 0 )Q ′ (x) + Q(x) (<strong>14</strong>.28)<br />
2008, B.E.<strong>Shapiro</strong><br />
Last revised: November 16, 2011<br />
Math 481A<br />
California State University Northridge
94 LESSON <strong>14</strong>. SYNTHETIC DIVISION AND HORNER’S METHOD<br />
hence<br />
which gives us equation <strong>14</strong>.10.<br />
P ′ (x 0 ) = Q(x 0 ) (<strong>14</strong>.29)<br />
The following gives a recapitulation of the algorithm for Horner’s method to calculate<br />
the numbers P (x 0 ) <strong>and</strong> P ′ (x 0 ) for a polynomial.<br />
Algorithm Horner<br />
Input a 0 , . . . , a n , x 0 ;<br />
Set y = a n ; (y will give the b n for P )<br />
Set z = a n ; (z gives the b n−1 for Q)<br />
For j = n − 1, n − 2, . . . , 1,<br />
y = x 0 y + a j ; (this gives b j for P (x 0 ))<br />
z = x 0 z + y; (this gives b j−1 for the calculation of Q(x 0 ) )<br />
End For;<br />
y = x 0 y + a 0 ; (this gives b 0 )<br />
Return y (which is P (x 0 )) <strong>and</strong> z (which is P ′ (x 0 ) = Q(x 0 ))<br />
We can make two interesting observations about Horner’s method. First, it has the<br />
same number of multiplications as nested multiplication, making it at least as efficient<br />
as that algorithm. Secondly, it gives us a number for both P (x 0 ) <strong>and</strong> P ′ (x 0 ) for no<br />
extra cost. This becomes useful in operations where both numbers are needed, such<br />
as in the calculation of Newton’s method (for the roots of a polynomial).<br />
Algorithm Newton’s <strong>Method</strong> with Horner<br />
Input a 0 , . . . , a n , x 0 , tolerance ɛ;<br />
(p 0 , p ′ 0) = Horner(a 0 , . . . , a n , x 0 )<br />
p = x 0<br />
δ = p 0 /p ′ 0<br />
While |δ| > ɛ,<br />
p = p − δ<br />
(p 0 , p ′ 0) = Horner(a 0 , . . . , a n , p)<br />
δ = p 0 /p ′ 0<br />
End While<br />
Return p<br />
Let x 0 be a root of P . Then we know that there exists a second polynomial Q(x) such<br />
that P (x) = (x − x 0 )Q(x) + P (x 0 ) = (x − x 0 )Q(x). So if P has any other roots that<br />
are different from x 0 then they are also roots of Q. Hence if we repeat the process on<br />
Q iteratively we will find all the subsequent roots of P . Unfortunately this leads to<br />
round-off error that can be avoided by using a different algorithm that we will discuss<br />
subsequently.<br />
Math 481A<br />
California State University Northridge<br />
2008, B.E.<strong>Shapiro</strong><br />
Last revised: November 16, 2011
LESSON <strong>14</strong>. SYNTHETIC DIVISION AND HORNER’S METHOD 95<br />
Example <strong>14</strong>.1. Find P (1) <strong>and</strong> P ′ (1) for P (x) = x 3 −2x 2 −5 using Horner’s method.<br />
Solution. We have a 0 = −5, a 1 = 0, a 2 = −2, <strong>and</strong> a 3 = 1, <strong>and</strong> also x 0 = 1. Then If<br />
we set z = a 3 = 1,<br />
b 3 = a 3 = 1 (<strong>14</strong>.30)<br />
b 2 = a 2 + b 3 x 0 = −2 + (1)(1) = −1 (<strong>14</strong>.31)<br />
b 1 = a 1 + b 2 x 0 = 0 + (−1)(1) = −1 (<strong>14</strong>.32)<br />
b 0 = a 0 + b 1 x 0 = −5 + (−1)(1) = −6 (<strong>14</strong>.33)<br />
Hence P (1) = −6. Using the same algorithm for Q we have<br />
Hence Q(1) = P ′ (1) = c 0 = −1.<br />
c 2 = b 3 = 1 (<strong>14</strong>.34)<br />
c 1 = b 2 + c 2 x 0 = (−1) + (1)(1) = 0 (<strong>14</strong>.35)<br />
c 0 = b 1 + c 1 x 0 = (−1) + (0)(1) = −1 (<strong>14</strong>.36)<br />
Horner’s method is also fairly easy to implement in Mathematica. We can take<br />
advantage of the fact that a list may have an arbitrary number of elements, so we<br />
don’t even need to know the order of the polynomial:<br />
Horner[A_?ListQ, x0_] := Module[{z, y, a},<br />
a = A;<br />
y = z = Last[a];<br />
a = Most[a];<br />
While[Length[a] > 1,<br />
y = x0*y + Last[a];<br />
z = x0*z + y;<br />
a = Most[a];<br />
];<br />
y = x0*y + Last[a];<br />
Print["P(x)=" A.("x"^Range[0, Length[A] - 1])];<br />
Print["P(", x0, ")=", y, "\n", "P’(", x0, ")=", z];<br />
Return[{y, z}]<br />
]<br />
2008, B.E.<strong>Shapiro</strong><br />
Last revised: November 16, 2011<br />
Math 481A<br />
California State University Northridge
96 LESSON <strong>14</strong>. SYNTHETIC DIVISION AND HORNER’S METHOD<br />
Math 481A<br />
California State University Northridge<br />
2008, B.E.<strong>Shapiro</strong><br />
Last revised: November 16, 2011