Suppose you need the value of at some number . The textbook way is to compute each power of separately and add up the terms — but computing from scratch, then , and so on, recomputes the same multiplications over and over.
Horner's method rewrites the polynomial as a chain of nested parentheses:
Read it from the inside out: multiply the leading coefficient by , add the next coefficient, multiply by again, add the next one, and keep going. No power of is ever computed on its own — every multiplication does double duty, carrying forward all the work done so far.
The result is exactly multiplications and additions for a degree- polynomial, done in one pass with a single running value. It looks almost too simple to have a name, and yet it is the provably optimal way to do this — you cannot evaluate a general polynomial with fewer arithmetic operations.
Comments
Loading comments...