# Evaluating Polynomials Using The Nested Scheme - Horner's Algorithm

In this section we learn the nested scheme, which is also known as Horner's method, or Horner's algorithm to evaluate polynomials. This technique will allow us to calculate polynomial functions faster than by using the "traditional method".

So, for instance, by the end of this section we'll be able to calculate $$f(x) = x^5 - 4x^3 + 2x^2 - x + 3$$ when $$x = 3$$, without a calculator, with a quick algorithm and show that $$f(3)=153$$.

We learn the method in the tutorial below and then practice with some exercise questions.

### Tutorial: Nested Scheme - Horner's Algorithm

To learn the method we work through two examples. In the first we work through a typical introductory example in which we evaluate $$f(x) = 2x^4 - 3x^3 +x^2 - 2x+3$$ when $$x = 2$$.
In the second example we learn how to deal with cases in which some of the coefficients of the polynomial are equal to zero by evaluating $$f(x) = -x^5 + 2x^3 + 3x + 5$$ when $$x = -2$$, in which the $$x^4$$ and the $$x^2$$ coefficients are equal to $$0$$.

## Exercise 1

Using the nested scheme for evaluating polynomials, answer each of the following:

1. Evaluate $$f(x) = -x^2+3x - 9$$ when $$x = 7$$.
2. Evaluate $$f(x) = -3x^5 + x^4 - 2x^3 + 6x^2 + 2x - 8$$ when $$x = 2$$.
3. Evaluate $$f(x) = -2x^7 + 3x^5 + 2x^4 - 4x + 1$$ when $$x = -2$$.
4. Evaluate $$f(x) = x^5 - 4x^3 + 2x^2 - x +3$$ when $$x = 3$$.
5. Evaluate $$f(x) = -x^6 + 2x^5 - 3x^3 + x^2 - 4x + 5$$ when $$x = -2$$.
6. Evaluate $$f(x) = -8x^4 + 6x^3 + 2x^2 - 3x + 1$$ when $$x = \frac{1}{2}$$.
7. Evaluate $$f(x) = 2x^4 - 7x^3 + 8x^2 + 6$$ when $$x = \frac{3}{2}$$.
8. Evaluate $$f(x) = -27x^4 + 9x^2 - 4x + 5$$ when $$x = -\frac{2}{3}$$.

Note: this exercise can be downloaded as a worksheet to practice with:

## Solution Without Working

1. For $$f(x) = -x^2+3x - 9$$ when $$x = 7$$, we find: $f(7) = -37$
2. For $$f(x) = -3x^5 + x^4 - 2x^3 + 6x^2 + 2x - 8$$ when $$x = 2$$, we find: $f(2) = -76$
3. For $$f(x) = -2x^7 + 3x^5 + 2x^4 - 4x + 1$$ when $$x = -2$$, we find: $f(-2) = 201$
4. For $$f(x) = x^5 - 4x^3 + 2x^2 - x +3$$ when $$x = 3$$, we find: $f(3) = 153$
5. For $$f(x) = -x^6 + 2x^5 - 3x^3 + x^2 - 4x + 5$$ when $$x = -2$$, we find: $f(-2) = -87$
6. For $$f(x) = -8x^4 + 6x^3 + 2x^2 - 3x + 1$$ when $$x = \frac{1}{2}$$, we find: $f\begin{pmatrix}\frac{1}{2}\end{pmatrix} = \frac{1}{4} = 0.25$
7. For $$f(x) = 2x^4 - 7x^3 + 8x^2 + 6$$ when $$x = \frac{3}{2}$$, we find: $f\begin{pmatrix}\frac{3}{2} \end{pmatrix} = \frac{21}{2} = 10.5$
8. For $$f(x) = -27x^4 + 9x^2 - 4x + 5$$ when $$x = -\frac{2}{3}$$, we find: $f\begin{pmatrix}-\frac{2}{3}\end{pmatrix} = \frac{19}{3}$