{
  "id": "horners-method",
  "title": "Horner’s Method",
  "lang": "en",
  "source_lang": "en",
  "summary": "Horner’s method evaluates a polynomial through nested multiplication, reducing arithmetic work and providing a basis for synthetic division, derivative evaluation, and numerical root-finding.",
  "category": "mathematics",
  "subcategory": "applied",
  "type": "concept",
  "aliases": [
    "Horner’s rule",
    "Horner’s scheme",
    "Nested multiplication"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/horners-method/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/horners-method/",
      "json": "https://aiwiki.page/zh/horners-method.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Horner’s method is an algorithm for evaluating a polynomial by rewriting it as a nested sequence of multiplications and additions. For a degree-\\(n\\) polynomial in the power basis, it requires \\(n\\) multiplications and \\(n\\) additions, without explicitly calculating successive powers of the argument. The same calculation supplies the coefficients needed for division by a linear polynomial and can be extended to evaluate derivatives. It is a standard technique in numerical analysis, symbolic computation, and numerical root-finding."
    },
    {
      "heading": "Nested form and recurrence",
      "text": "Consider the polynomial\n\n\\[p(x)=a_nx^n+a_{n-1}x^{n-1}+\\cdots+a_1x+a_0, \\qquad a_n\\ne 0.\\]\n\nRepeatedly factoring out \\(x\\) gives its Horner form:\n\n\\[p(x)= \\bigl(\\cdots((a_nx+a_{n-1})x+a_{n-2})x+\\cdots+a_1\\bigr)x+a_0.\\]\n\nTo evaluate it at \\(x=c\\), define the recurrence\n\n\\[b_n=a_n,\\qquad b_k=a_k+c\\,b_{k+1} \\quad (k=n-1,n-2,\\ldots,0).\\]\n\nThe result is\n\n\\[p(c)=b_0.\\]\n\nEach step incorporates one more coefficient, proceeding from the highest degree to the constant term. An implementation needs only one running accumulator if the intermediate values are not required:\n\nfunction horner(a[0..n], c):\n    value = a[n]\n    for k = n-1 down to 0:\n        value = value*c + a[k]\n    return value\n\nThe coefficient array here is indexed in ascending order of degree, although the algorithm reads it in descending order. Other interfaces store coefficients in the reverse order, so coefficient conventions matter when using software implementations.\n\nExample\n\nFor\n\n\\[p(x)=2x^3-6x^2+2x-1,\\]\n\nthe nested form is\n\n\\[p(x)=((2x-6)x+2)x-1.\\]\n\nAt \\(x=3\\), the successive accumulator values are\n\n\\[2,\\qquad 2\\cdot3-6=0,\\qquad 0\\cdot3+2=2,\\qquad 2\\cdot3-1=5.\\]\n\nThus \\(p(3)=5\\).\n\nMissing powers must be represented by zero coefficients. For example,\n\n\\[x^4+3x-2 = (((x+0)x+0)x+3)x-2.\\]"
    },
    {
      "heading": "Why the method works",
      "text": "After the coefficients from \\(a_n\\) down through \\(a_k\\) have been processed, the accumulator contains\n\n\\[b_k=a_n c^{n-k}+a_{n-1}c^{n-k-1}+\\cdots+a_k.\\]\n\nMultiplication by \\(c\\), followed by addition of \\(a_{k-1}\\), produces the corresponding expression for the next step. This establishes the result by mathematical induction.\n\nThe identity is algebraic rather than specifically numerical. It applies to real and complex coefficients and, more generally, to polynomials over a commutative ring. No division is required, so it also works in modular arithmetic and over a finite field."
    },
    {
      "heading": "Computational cost",
      "text": "For a degree-\\(n\\) polynomial with \\(n\\geq 1\\), the basic scheme performs exactly:\n\n- \\(n\\) multiplications;\n- \\(n\\) additions.\n\nIts arithmetic cost is \\(O(n)\\) in big-O notation, and its auxiliary storage is \\(O(1)\\) when only the value is wanted.\n\nComputing each power independently by repeated multiplication can take \\(O(n^2)\\) arithmetic operations. Generating powers successively reduces that approach to \\(O(n)\\), but a straightforward implementation still generally performs more multiplications than Horner’s method.\n\nThese counts use a unit-cost arithmetic model. For large integers, rational arithmetic, or symbolic expressions, the cost of individual operations depends on operand size; linear arithmetic-operation count does not necessarily imply linear running time.\n\nHorner’s method is particularly suitable for dense polynomials in the power basis. It is not universally the fastest evaluation strategy. Sparse polynomials may benefit from algorithms that exploit gaps between exponents, while special structure can permit factorizations that use fewer operations."
    },
    {
      "heading": "Connection with synthetic division",
      "text": "The intermediate values \\(b_n,b_{n-1},\\ldots,b_1\\) are the coefficients of the quotient when \\(p(x)\\) is divided by \\(x-c\\):\n\n\\[p(x)=(x-c)q(x)+b_0,\\]\n\nwhere\n\n\\[q(x)=b_nx^{n-1}+b_{n-1}x^{n-2}+\\cdots+b_1.\\]\n\nThus the Horner recurrence simultaneously performs synthetic division and evaluates the remainder \\(b_0=p(c)\\).\n\nFor the preceding example, division by \\(x-3\\) gives\n\n\\[2x^3-6x^2+2x-1 = (x-3)(2x^2+2)+5.\\]\n\nIf \\(p(c)=0\\), then \\(x-c\\) is an exact factor. Removing such a factor is called deflation. Deflation is useful in polynomial root-finding, but using an approximate root can perturb the quotient coefficients and reduce the accuracy of subsequently computed roots."
    },
    {
      "heading": "Evaluating derivatives",
      "text": "A modified recurrence evaluates both \\(p(c)\\) and its derivative \\(p'(c)\\) in one pass. Initialize\n\n\\[v=a_n,\\qquad d=0.\\]\n\nFor \\(k=n-1,\\ldots,0\\), update\n\n\\[d\\leftarrow cd+v, \\qquad v\\leftarrow cv+a_k.\\]\n\nThe update of \\(d\\) must use the old value of \\(v\\). At completion,\n\n\\[v=p(c),\\qquad d=p'(c).\\]\n\nThis follows by differentiating each nested step: if a partial polynomial is updated from \\(v(x)\\) to \\(xv(x)+a_k\\), its derivative becomes \\(xv'(x)+v(x)\\). It is a simple instance of automatic differentiation.\n\nEfficient simultaneous evaluation is useful in Newton’s method, whose iteration for a polynomial is\n\n\\[x_{j+1}=x_j-\\frac{p(x_j)}{p'(x_j)},\\]\n\nprovided the denominator is nonzero.\n\nHigher derivatives can also be obtained through related recurrences or repeated synthetic division. If\n\n\\[p(x)=r_0+(x-c)\\bigl(r_1+(x-c)(r_2+\\cdots)\\bigr),\\]\n\nthen\n\n\\[r_j=\\frac{p^{(j)}(c)}{j!}.\\]\n\nRepeated division by \\(x-c\\) therefore converts power-basis coefficients into coefficients centered at \\(c\\), giving the polynomial’s finite Taylor expansion about that point."
    },
    {
      "heading": "Floating-point accuracy",
      "text": "In floating-point arithmetic, multiplication and addition generally introduce rounding errors. Horner’s method has favorable stability properties, but these do not guarantee a small relative error for every polynomial and argument.\n\nUnder the standard rounding model, assuming no overflow or underflow, the computed value \\(\\widehat p(c)\\) satisfies a bound of the form\n\n\\[|\\widehat p(c)-p(c)| \\leq \\gamma_{2n}\\sum_{k=0}^{n}|a_k|\\,|c|^k,\\]\n\nwhere\n\n\\[\\gamma_m=\\frac{mu}{1-mu}, \\qquad mu<1,\\]\n\nand \\(u\\) is the unit roundoff. This bound treats each multiplication and addition as separately rounded.\n\nThe method also admits a coefficientwise backward-error interpretation: the computed result is the exact value at \\(c\\) of a polynomial whose coefficients differ slightly from the supplied coefficients.\n\nNevertheless, cancellation can make the final result small compared with the magnitudes of the terms being combined. A relevant coefficientwise condition number, for \\(p(c)\\ne0\\), is\n\n\\[\\kappa_{\\mathrm{coeff}}(p,c) = \\frac{\\sum_{k=0}^{n}|a_k|\\,|c|^k}{|p(c)|}.\\]\n\nWhen this quantity is large, small coefficient perturbations or rounding errors can cause a large relative error in the answer. This often occurs near a root. For example, evaluating the expanded power-basis form of \\((x-1)^m\\) near \\(x=1\\) can involve severe cancellation, even though its factored form is simple to evaluate.\n\nHardware supporting fused multiply-add can compute each expression \\(cv+a_k\\) with one final rounding rather than two, improving error bounds and often performance. Compensated variants of Horner’s method estimate and correct rounding errors for greater accuracy."
    },
    {
      "heading": "Applications and alternative schemes",
      "text": "Horner evaluation is widely used in function approximation, where a mathematical function is represented locally by a polynomial. It also appears in interpolation, polynomial root-finding, and conversion of positional numerals into numerical values. For example, a base-\\(B\\) digit sequence is evaluated as\n\n\\[d_mB^m+\\cdots+d_1B+d_0 = (\\cdots(d_mB+d_{m-1})B+\\cdots)B+d_0.\\]\n\nThe nested scheme has a sequential dependency: each accumulator value depends on the preceding one. This can limit parallel execution within a single evaluation. Schemes such as Estrin’s method group terms and use powers such as \\(x^2,x^4,\\ldots\\), exposing more parallelism at the expense of different arithmetic and storage costs.\n\nHorner’s method is also basis-dependent. Polynomials represented using orthogonal polynomials, such as Chebyshev polynomials, are often better evaluated directly through a basis-specific recurrence rather than first converting them to the power basis."
    },
    {
      "heading": "Historical background",
      "text": "The method is named after the English mathematician William George Horner, who published a numerical equation-solving procedure in 1819. His work concerned root approximation, not merely the compact polynomial-evaluation loop now commonly taught under his name.\n\nRelated procedures substantially predate that publication. Chinese mathematical traditions used successive coefficient transformations for extracting roots and solving polynomial equations; Qin Jiushao’s thirteenth-century work is a prominent example. Consequently, “Horner’s method” may refer narrowly to nested polynomial evaluation or, in historical accounts, more broadly to a root-finding procedure based on repeated polynomial transformations."
    }
  ],
  "links": [
    "algorithm",
    "polynomial",
    "numerical-analysis",
    "recurrence-relation",
    "mathematical-induction",
    "real-number",
    "complex-number",
    "ring-mathematics",
    "modular-arithmetic",
    "finite-field",
    "big-o-notation",
    "integer",
    "derivative",
    "automatic-differentiation",
    "newtons-method",
    "taylor-series",
    "floating-point-arithmetic",
    "numerical-stability",
    "condition-number",
    "function-approximation",
    "interpolation",
    "positional-notation",
    "parallel-computing",
    "orthogonal-polynomials"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}