MathsAlgebra

Polynomial
evaluator.

Type a polynomial and a value of x to get P(x), its slope there and its real roots.

How it's worked out

Horner's method rewrites the polynomial as a nest, so you never build a power on its own. Start with the leading coefficient, the number on the highest power. Multiply by x, add the next coefficient, and repeat until the constant term is in.

a3x3+a2x2+a1x+a0\displaystyle a_3 x^3 + a_2 x^2 + a_1 x + a_0=((a3x+a2)x+a1)x+a0\displaystyle {}= ((a_3 x + a_2) x + a_1) x + a_0

A polynomial of degree n, where n is the highest power, takes n multiplications and n additions this way. Ostrowski and Pan proved that a general polynomial cannot be done in fewer. Fewer sums also leave less room for a slip when you work by hand.

MathWorld calls the same work synthetic substitution, because it is Horner's rule written as a synthetic division table. The running totals are the coefficients of P(x) divided by x minus your value, and the last total is the remainder. By the remainder theorem, that remainder is the value of P at your x.

The slope comes from the power rule, one term at a time, and Horner's method then evaluates that too. To check the answer, the tool also works out each term by itself and adds them.

P′(x)\displaystyle P'(x)=3a3x2+2a2x+a1\displaystyle {}= 3 a_3 x^2 + 2 a_2 x + a_1

Worked examples

Lin checks a quartic from her numerical methods class

Lin needs 2x⁴ − 3x² + 3x − 4 at x = −2. There is no cube term, so a 0 holds its place. The running totals are 2, −4, 5, −7, 10, so the value is 10 and the slope there is −49.

Adding the terms one at a time gives 32, −12, −6, −4, which also total 10. That took more multiplying, because each power had to be built first.

Open this example in the tool

Sam tracks a ball thrown straight up

A ball leaves Sam's hand at 20 m/s from 1.5 m up, so its height in meters is −4.9t² + 20t + 1.5. Treat t, the seconds since the throw, as the x in the tool. At 3 seconds the ball is 17.4 m up, and the slope is its velocity: −9.4 m/s, so it is already falling.

The curve turns at 2.04 seconds, where the ball peaks at 21.91 m. The model ignores air drag, so read these as close estimates rather than exact heights.

Open this example in the tool

Rae gets an exact fraction from a decimal

Rae evaluates x³ − 1 at 0.5 and wants the answer for her worksheet as a fraction. The exact value is −7 over 8, and as a decimal it is −0.875. The exact form works when the coefficients and x are decimals with up to 12 places.

Open this example in the tool

Reading your result

A value of 0 means a root. If P at your x is 0, then x minus that number is a factor. Between 2 and 3, the curve of x³ − 6x² + 11x − 6 is −0.375 at 2.5, and it is 0 at both ends of that gap.

A sign change traps a root. For x³ − 7x + 6, the values at x = −4, −2, 0, 1.5, 3 are −30, 12, 6, −1.125, 12. The sign flips three times along that list, so three roots are trapped: −3, 1, 2.

The sign of the slope says which way the curve is going. Above 0 it rises, below 0 it falls, and at 0 it may turn. Not always, though: x³ has a slope of 0 at 0 and keeps climbing.

Listed roots are real and distinct. The search looks between the turning points, narrowing in on each crossing, and it also tests each turning point for a touch of the axis. For exact fractions, use the rational root theorem calculator.

Common mistakes

  • Dropping a zero in the nest. Leave out the empty x cubed in a quartic and every later total is wrong. The maths field fills the gap for you, but on paper you need to write the 0.
  • Treating −x² like (−x)². At x = 3, −x² is −9, because the power binds tighter than the minus sign. Type a bracket if you mean the other one.
  • Reading a round decimal as exact. At 2 decimal places a small value can show as 0, so a value that rounds to 0 is not proof of a root. Switch to Exact, or raise the decimal places.
  • Trusting a huge x. With x near a million and a high degree, the digits run past what a computer's decimal holds, and the last digits lose their meaning.

Questions people ask

Yes. Both bring down the first coefficient, multiply by your value, add the next coefficient, and repeat. Synthetic substitution is the name in school algebra, and it sets the numbers out in a table.

Sources