This is a guest post by Nandeesh H.N. of Kolkata
Horner’s method is commonly used to find the roots of a polynomial function. However it can also be used to evaluate the polynomial function for a given value of x.
Suppose, we want to evaluate the polynomial
p(x) = 4x^5 – 3x^4 + 7x^3 + 6x^2 + 3x + 9 at x = 2.41.
The usual method of evaluation is to evaluate each product (such as 4*2.41^5 or 7*2.41^3) separately and then add. The drawback is that to evaluate any power of x, we go through all of the previous powers.
A slightly better method is to make a table of powers of 2.41 and put them in the given polynomial.
But Horner’s method is still more efficient. It results in fewer multiplications and additions and is faster and more precise when using float variables.
Ex: Compute p(x) = 4x^5 – 3x^4 + 7x^3 + 6x^2 + 3x + 9 at x = 2.41.
Start with the coefficient of highest power of x as the starting value of the required answer.
It is 4.
Multiply by x and add coefficient of next lower power of x.
Repeat this till all powers of x are exhausted.
4 * 2.41 – 3 = 6.640
6.640 * 2.41 + 7 = 23.002
23.002 * 2.41 + 6 = 61.436
61.436 * 2.41 + 3 = 151.060
151.060 * 2.41 + 9 = 373.055
So, the value of the polynomial is 373.055 at x=2.41.
Imagine, evaluating the first to fifth powers of 2.41 and doing all those multiplications and additions. Is not the Horner’s method great?
Horner’s method is equivalent to rewriting the above polynomial as ((((4x-3)x+7)x+6)x+3)x+9 and evaluating.
A convenient method of using Horner’s method is to write the computations in the form of Horner’s table as given below for the above polynomial.
Polynomial p(x) = 4x^5 – 3x^4 + 7x^3 + 6x^2 + 3x + 9
The first figure is of course the value of x for which polynomial is to be evaluated.
- The first line is of the coefficients of the polynomial.
- Write the first coefficient (4) as it is in the third line.
- Multiply 2.41 with 4 and write 9.64 under the second coefficient in the second line.
- Add -3 and 9.64 and write total 6.64 in the third line.
- Multiply 2.41 with 6.64 and write 16.002 in the second line under the third coefficient.
- Repeat the above process.
Under the last column we get the answer 373.055 as the value of the polynomial at x=2.41.
This post is contributed by Nandeesh Nagarajaia. He is a Chemical Engineer who did his B.Tech from NIT Suratkal. He is now in IT field as Assistant General Manager(Systems) in Hindustan Copper Limited. He love Maths and enjoy teaching Maths to his sons.
On behalf of all the QuickerMaths.com users, I am highly grateful for his contribution.