# Horner’s method

The Horner’s method is an algorithm that evaluates polynomials. The following pseudocode shows how to use this method to find the
value of anxn + an-1xn-1 + . . . + a1x + a0 at x = c.
procedure Horner(c, a0, a1, a2, . . . , an : real numbers)
y := an
for i := 1 to n
y := y × c + an-i
end {y = ancn + an-1cn-1 + . . . + a1c + a0}

(a) Evaluate x2 + 5x + 3 at x = 2 by working through each step of the algorithm.
(b) Exactly how many multiplications and additions are used by this algorithm to evaluate a polynomial of degree n at x = c? (Do not count additions used to increment the loop variable.)

[

Related Precalculus Mathematics Homework Help News on Phys.org
Dick
Homework Helper
n=2. a2=1, a1=5, a0=3. c=2. There - I did the hard part. Now just DO it. Step through the algorithm.

okey x^2 + 5x + 3 at x=2

x^2(is a2) + 5x(is a1) + 3 (is a0) at x=2 (is n=2)
correct or not?

i will give anonther example make sure about it

lets assume evaluate 3x^2 + x + 1 at x=2

so according to you 3x^2(is a=2) + x(is a=1) + 1 (is a=0) at x=2(is n=2)
is it correct

thanx

Integral
Staff Emeritus
Gold Member
Boy are they going out of their way to make this obscure.

Horner's method is simply factoring the polynomial to eliminate all orders of x greater then 1. Then you start multiplying and adding your way through the nest.
For example expand a quadratic like this:
$$ax^2 + bx + c = x(ax+b) + c$$

To do the calculation start inside the parens and work your way out.

This method is very useful for RPN calculators.

Integral, Is Horner's method just an elaborate way to say that the value of a polynomial at x=a is simply the remainder when the polynomial is divided by x-a?

Nevermind... (I've never seen it written as Horner's method before; I just scratched it out on paper, and "that's all it is?") You're right! They did make that pretty obscure.

OP, if you're having trouble following it, have you been exposed to synthetic division before? Simply, synthetic division is used to divide a polynomial by a linear binomial in the form (x-a). The remainder after such a division is equal to f(a).

AlephZero
Homework Helper
To answer the question, it doesn't matter if you don't know what Horner's method is, or what it's supposed to do.

You are given an algorithm, and asked to work through it step by step and count the number of operations. A computer just follows the instructions in the algorithm. To answer the question, you need to do the same as the computer would do.

hello
how did you calculate c=2

okey x^2 + 5x + 3 at x=2
what is c?

HallsofIvy
Homework Helper
hello
how did you calculate c=2

okey x^2 + 5x + 3 at x=2
what is c?
No one "calculated" c= 2! The definition of Horner's method said "use this method to find the value of a_nx^n + a_(n-1)x^(n-1) + . . . + a_1x + a_0 at x = c".
Your problem asks you to find the value of a given polynomia "at x= 2".

Just compare that "general form "anx^n + an-1x^(n-1) + . . . + a1x + a0 at x = c" with the specific problem you are given. In x^2+ 5x+ 3, the highest power of x is 2: n= 2. The coefficient of that highest power is 1, the next 5, the constant term is 3: a_2= 1, a_1= 5, a_0= 3. Because the problem says "at x= 2" compared with "at x= c", c= 2.

Here's a test: "evaluate 4x^3+ 3x^2- 2x+ 4 at x= 1". What are n, a_3, a_2, a_1, a_0, and c?

By the way, notice the use of "_2" for subscripts and "^2" for exponents? Makes it much easier to read.

Last edited by a moderator:
thank you HallsofIvy it is clear now......