Processing math: 100%

Zeros of polynomials

We all know how solve x2+x1=0, for example. If we consider x4+x3=0, then it is no longer clear how to compute the roots.

In addition, we saw that evaluating the quadratic formula for the roots a quadratic polynomial can itself be problematic. So, we develop methods that do not depend on any analytical structure, such as degree, of the polynomials

Definition

A polynomial of degree (or order) n is given by

P(x)=anxn+an1xn1++a1x+a0.

The numbers {ai}ni=0 are called the coefficients.

The following gives us a theoretical justification for searching for the roots of P(x):

Theorem (Fundamental Theorem of Algebra)

A polynomial P(x) with real or complex coefficients has n (possibly repeated and possibly complex) roots. Furthermore, for some (possibly complex) values x1,x2,,xk, and integers m1,m2,,mk

P(x)=an(xx1)m1(xx2)m2(xxk)mk,kj=1mk=n.

Corollary

Suppose P(x) and Q(x) are polynomials of degree n. If there are n+1 distict points x1,x2,,xn+1 (on the real axis or in the complex plane) such that P(xi)=Q(xi), then P(x)=Q(x) for all x.

Horner's Method (Newton's method with nesting)

Theorem

Let

P(x)=anxn+an1xn1++a1x+a0.

Define bn=an and

bk=ak+bk+1x0,for k=n1,n2,,1,0.

Then b0=P(x0). Moreover, if

Q(x)=bnxn1+bn1xn2++b2x+b1,

then

P(x)=(xx0)Q(x)+b0.

Proof

If we can prove the last claim then P(x0)=b0. So, consider

(xx0)Q(x)+b0=xQ(x)x0Q(x)+b0=bnxn+bn1xn1++b2x2+b1xbnx0xn1bn1x0xn2b2x0xb1x0+b0

Collecting the powers, we find

  • bnxn=anxn (by definition)
  • (bn1bnx0)xn1=an1xn1
  • (bn2bn1x0)xn2=an1xn2
  • b0b1x0=a0

This gives an iterative method for computing P(x0). Now, to compute P(x0):

P(x)=Q(x)+(xx0)Q(x)P(x0)=Q(x0).

So, as we apply Horner's method to compute P(x0), we also compute {bi} the coefficients of Q(x). So, we can apply Horner's method again to evaluate Q(x0).

The evaulation of P(x0) and P(x0)

Set bn=an, cn=bn.

For k=n1,n2,,1 set

  • bk=ak+bk+1x0
  • ck=bk+ck+1x0

Set b0=a0+b1x0

Then b0=P(x0) and c1=Q(x0)=P(x0).

In [1]:
a = [-1,1,-1,1,-1,1,1]; pow = [1:length(a)]-1;
b = a;  c = a; % initialize b & c, just good programming practice
p = @(x) sum((x.^pow).*a); 
dp = @(x) sum((x.^(pow(2:end)-1)).*a(2:end).*pow(2:end));

x0 = .5;
i = length(a);
while i > 2
    i = i-1;
    b(i) = a(i) + b(i+1)*x0;
    c(i) = b(i) + c(i+1)*x0;
end
b(1) = a(1) + b(2)*x0;
c(2)-dp(x0)
b(1)-p(x0)
ans =

     0


ans =

     0
In [95]:
x = linspace(-1,1,100); y = x;
for i = 1:100
    y(i)=p(x(i));
end
hold off; plot(x,y)
title('A plot of P(x)')
In [98]:
p0 = .1;
for j = 1:20;
    i = length(a);
    while i > 1
        i = i-1;
        b(i) = a(i) + b(i+1)*p0;
        c(i) = b(i) + c(i+1)*p0;
    end
    p0 = p0 - b(1)/c(2);
end
p0
p0 =

    0.8403
In [103]:
plot(x,y); hold on;
title('A plot of P(x)')
plot(x,0*x) % plot the x-axis
plot(p0,0,'ro') % plot the zero to see that we are computing it

Example

Horner's method actually amounts to synthetic division. Compute P(2) where

P(x)=x42x3+x2x+2

using Horner's method.