Horner’s Polynomial Method Step-by-Step with Python

Your Daily Dose of Math, Science, and Python

Mathcube
Math Simplified

--

Photo by Antoine Dautry on Unsplash

Yesterday I learned from a colleague about an arithmetic tool I didn’t know about. It’s called Horner’s method, and I find it quite cool. Actually, it is designed to efficiently evaluate polynomials at a given point by hand. But it can also be used for polynomial division, polynomial root finding, or for partial fraction decomposition. In this post, I will show how Horner’s method works and give a step-by-step implementation in terms of Python code.

Daily Dose of Scientific Python

106 stories

The Method

Suppose you have the polynomial

and you want to evaluate it at 𝑥=2 by hand. Horner’s method is based on the observation that you can always rewrite the polynomial like this:

If you have trouble seeing this, read it from right to left!

Then you set up a table and write the coefficients of the polynomial in the first row. In the second row below the first coefficient, you write 0. Then you write the point where to evaluate at the left…

--

--