Slides - Dan Kalman Homepage

Hitchhiker's Guide to Math K3
Part K3: Horner Form
An alternate
polynomial
standard form.
The Hitchhiker’s Guide to
Mathematics
An MAA Minicourse
Dan Kalman
American University
http://www.dankalman.net
And
Bruce Torrence
Randolph Macon College
http://faculty.rmc.edu/btorrenc
1
2
Derivation of Horner Form
Horner’s Form
• Standard descending form
• Horner form
• Also referred to as partially factored or
nested form
3
4
1
Hitchhiker's Guide to Math K3
Quick Evaluation
Horner evaluation
• Compute p(2):
(((5·2 – 11)2 + 6)2 + 7)2 – 3
• Answer = 27
• Compute p(3):
(((5·3 – 11)3 + 6)3 + 7)3 – 3
• Answer = 180
• Compute p(2/5):
(((5·# – 11)# + 6)# + 7)# – 3
• Answer = 23/125?
Start with leading
coefficient
Multiply by x and
add next coefficient
Does this remind you of anything?
5
Synthetic Division
6
Synthetic Division
Say you want to divide
by (x – 2).
Set up the standard computation table for
synthetic division …
7
8
2
Hitchhiker's Guide to Math K3
Horner & Synthetic Division
Differentiation
• Synthetic division by (x – a) is identical to
Horner evaluation of p(a)
• The final result equals both the remainder
and p(a) . That’s the Remainder Theorem
• New observation: the intermediate results
in Horner evaluation are the coefficients
for the quotient
• These observations lead to the rules for
polynomial differentiation
• Consider quotient [p(x) - p(a)] / (x - a)
• Since a is a root of the numerator, the
division works out evenly – no remainder
• Express the coefficients of the quotient as
intermediate results of Horner evaluation
• Now set x = a and watch the differentiation
rule drop out
9
Efficient Calculation
10
Binary Powering
• Horner evaluation takes fewer operations
than the standard descending form (try
counting key presses)
• This was once a significant issue in
scientific computer programming
• Not so true any more
• However, a variant on Horner evaluation
can make a huge difference in matrix
operations
• Binary Powering
11
• Brute force approach to computing A30:
repeated multiplication by A 29 times
• For an n by n matrix A, each multiplication
requires on the order of n3 operations
• Say n = 500 – that’s 125 million operations
just to multiply by A one time!
• Better approach: ((A2A)2A)2A)2 = A30
• This only takes 7 matrix multiplications
• How do you know when to square and
when to multiply by A?
12
3
Hitchhiker's Guide to Math K3
Binary Powering Explained
• Express exponent in binary notation
30 = 11110 = 24 + 23 + 22 + 21 + 0
• This is a polynomial p(x)
- coefficients of 1, 1, 1, 1, and 0
- evaluated at x = 2
• Horner evaluation: (((2+1)2+1)2+1)2+0
• So: A30 = A(((2+1)2+1)2+1)2+0 = ((A2A)2A)2A)2
• In general: start with A2. Express the
exponent in binary, and disregard the first
digit. Then for each 1 digit square and
multiply by A; for each 0 digit just square. 13
Down for the Count
•
•
•
•
•
•
•
Suppose binary form has j 0’s and k 1’s
j + 2(k – 1) multiplications required
Worst case: ~2 log2(n) multiplications
Compare with n – 1 for brute force method
Binary exponentiation is good
MUCH better than brute force
Not optimal!
14
But wait… there’s more
• Fractional exponents: how do you take a
cuberoot on a calculator with only a
squareroot key?
• Express 1/3 as an infinite binary “decimal”
• Truncate to a finite number of digits
• Express as polynomial in powers of 1/2
• Adapt binary powering
• Approximate cube root as combinations of
squareroots and multiplications
15
Final Horner
Application
Lill’s Method
16
4
Hitchhiker's Guide to Math K3
Lill’s Method Example
Lill’s Method
• Goal: find a root of
• Misnomer – not really a method for finding
roots
• Geometric visualization of a root
• Lill was an Austrian military engineer
• Published his method in 1867
• More recently this method has received
renewed interest in connection with
origami
• Use coefficients to
construct a right
polygonal path (the
Primary Lill Path).
17
Secondary Path
Add a line from start to second leg of path
Note the green angle, 
Add another edge perpendicular to first
Repeat
All green angles
are equal
• Varying  changes
the end point of
the secondary path
• Want paths to end
at same point
18
Lill’s Theorem
•
•
•
•
•
If the primary and secondary paths end on
the same point, then x = - tan  is a root of
the polynomial

19
20
5
Hitchhiker's Guide to Math K3
Understanding Lill’s Theorem
Find legs of the triangles with red hypotenuses
(4x 6) tan 
 (4x 6) x
(4x 6)x 5

((4x 6) x 5) x +4


If the ends don’t match,
the blue bit left over will be
(((4x + 6)x+5)x+4)x+1 …
This = 0 when ends match

6  4x  4x  6
4 tan = 4x
Averse to Lill’s Theorem?
Lill, backed by Horner,
Works in a corner,
Angled a fraction of 
Sublime rule of thumb:
When ends become one
A root lies revealed to the eye.
4
21
22
6