The Horner scheme (based on William George Horner ) is a transformation method for polynomials to facilitate the calculation of function values. It can be used to simplify the polynomial division and the calculation of zeros and derivatives .
Function of the Horner scheme
For polynomials in the classical style, which must potencies , etc. calculated when the function value at one point to be calculated. In the transformed polynomial according to the Horner scheme, there are no powers, only multiplication and addition . The calculation is accelerated because fewer multiplications are required: the number of these is reduced to almost half by using the Horner scheme.
In the classical notation, multiplications are necessary for a polynomial of degree :
- Multiplications to form the powers ;
- further multiplications to multiply the powers by their coefficients.
Overall, you therefore need multiplications for the calculation.
In the Horn scheme, however, one gets by with multiplications.
The number of - arithmetically less complex - additions is the same in both cases, namely .
By continuing to exclude the free polynomial variables , the polynomial is displayed as a nesting of products and sums.
The following example illustrates the lower computational effort in the Horn scheme:
In the classic representation (left side), in addition to the additions, subtractions and multiplications, four powers are formed, which are recorded by the multiplications by using the Horner scheme (right side) and are therefore omitted. If the intermediate results are reused, this saves four multiplications.
The form shown here is particularly suitable for calculating in the reverse Polish notation (UPN) .
Between 1975 and 2003 income tax in the FRG was calculated according to the Horner scheme in order to avoid rounding errors when calculating with electronic pocket calculators or computers and thus to ensure legal security.
Tabular notation of the Horn scheme
Let's look at the above example again and put:
The coefficients, intermediate products and partial sums are now transferred to a three-line table, with the coefficients being entered in the first line. The subtotals are in the third line. The first coefficient of the polynomial is taken over directly. The previously calculated partial sum multiplied by results in the next summand, which is then entered in the second line under the following coefficients.
So you gradually get the following calculation scheme:
The calculation of the above polynomial for with the help of the Horner scheme is as follows:
As a reminder, the value for which the polynomial is to be calculated is usually written in the middle line in front of the scheme, the first number in the upper line is also written in the lower line. Then you multiply this number by the value for which you want to calculate the polynomial, write the result in the middle line of the second column, add the two values in the second column and write the result in the bottom line. Then the column sum from the bottom line is repeatedly multiplied by the value for which the polynomial is to be calculated and the result is written in the middle line of the next column, the column is added, etc. The last number (here five) is the final result.
However , there are much higher interim results for:
Using the cascaded Horner scheme ( see below ) increases the number of multiplications, but reduces the intermediate results, which is more advantageous for calculating the polynomial by hand:
Possible uses of the Horn schema
Conversion between different number systems
Our familiar representation of numbers in the decimal place value system is nothing more than an abbreviated notation for special polynomials, namely polynomials with the base . The same applies to all other place value systems, for example the binary system . There is . We can take advantage of the Horner scheme to convert numbers from any other place value system to the decimal system, and vice versa.
Conversion to the decimal system
Example: The binary number 110101 is to be converted into the decimal system. What is the resulting decimal number ?
We write 110101 in binary as a polynomial:
According to the Horner scheme:
We don't need to calculate this in one go, but can proceed step by step. Each step consists of a multiplication by 2 and an addition. For the sake of clarity, we write the steps one below the other and note the intermediate results:
We have found the decimal representation we were looking for.
In general terms, the procedure is as follows: A number from a place value system is converted into the decimal system by adding
- the value of the first digit is taken as the initial value
- then gradually multiply the result from the previous step by and add the next digit
- until all digits are used up.
The easiest way to write down the invoice again in tabular form:
Cascaded Horner scheme
The disadvantage of the one-step Horner scheme is that multiplications with large factors can be necessary (in the above example 2 * 26 = 52). To stay within the multiplication table, the cascaded or multi-level Horner scheme is used.
Only the one is used for the multiplication. The tens is written like a carry over to the next line under the ones. With the 13 from the example above, the 3 is written under the 12 and the 1 under the 3. In the next step, only 3 * 2 + 0 = 6 is calculated (instead of 13 * 2 + 0 = 26). This result is treated as well; the tens here is 0. The last calculation (6 * 2 + 1) results in 13. The one of this result is the last digit of the final result.
To calculate the other digits, the same scheme is used again for the tens (00101) in the last line. The leading zeros can be neglected:
Since there are now only zeros in the carry line, the process is ended. The total result (53) is read in the last column of the units from bottom to top.
The cascaded Horner scheme can be represented in a very simplified way by doing a little more mental arithmetic. This speeds up the calculation considerably.
The digits of the initial number are first written vertically one below the other. A vertical line is drawn to the left of it. Below the last digit a horizontal line, below which the result is at the end.
First the most significant digit (the first 1) is transferred one line lower into the previous column. This is now to the left of the second digit (also a 1). The left number is multiplied by the number base (here 2), the right number is added (1 * 2 + 1). The tens of the result (3) is written one column further to the left, the one one line lower.
The same procedure is followed with the one of the result (3) and the next digit (0). The result (3 * 2 + 0 = 6) is noted in the same way as the previous result.
The third calculation is 6 * 2 + 1 = 13, then 3 * 2 + 0 = 6 and finally 6 * 2 + 1 = 13 again. As in the previous steps, the ones and tens of the result are written diagonally below each other.
The last digit of the final result (3) is now under the horizontal line.
To calculate the other digits, the leading column with the tens that have not been taken into account so far is now treated in the same way as the starting number.
The first valid digit is transferred one line down to the previous column. This number (1) is multiplied by the base (2) and the next digit (0) is added to the product (2). Tens and ones of the result (02) are entered diagonally in the scheme as shown above.
The result of the last calculation (2 * 2 + 1 = 05) is also entered. The ones of this result (5) are the next digit of the final result.
Since there are only zeros in the tens column, the calculation is over. The final result (53) can now be read in the result line, this time in the correct order.
Procedure for the reverse direction
In the opposite way, a decimal number can be converted into a number in another number system. Instead of a continued multiplication by the base of the other number system, there is a continued division by this number. The digits of the number in the other number system result from right to left by the division remainders.
In the table notation, the digits of the output number are written one below the other and a horizontal line is drawn for the result. The vertical line is drawn here to the right of the digits. As a reminder, the number base can be noted at the bottom right.
The first digit, increased by a leading zero, (05) is divided by the number base (2). The quotient (2) is written in the previous column. The rest (1) in the line below.
This remainder forms a new two-digit number (13) with the next digit (3). This number is again divided by the base, the result (6 remainder 1) is entered diagonally in the scheme as above.
Since all digits have now been processed, the remainder of the last calculation (1) is the last digit of the final result.
The quotients that have not been edited are treated as a new decimal number (26) using the same procedure.
The digit obtained is a 0. There is now a 13 in the column of the unprocessed quotients.
After this step there is a 06 in the quotient column. The leading zero is ignored, the process starts with the 6th.
The number to deal with now is 3.
Now there is only one 1 left.
After the last calculation there is a 0 in the quotient column. The procedure is now complete. The number you are looking for is in the correct order in the result line.
Polynomial division with linear divisor
Using the following example
First the polynomial division is represented with a linear divisor in the Horner scheme.
The polynomial division is usually done in a written form.
If you omit the powers of , you get the following representation:
If you now condense this scheme onto three lines and transfer the first coefficient of the dividend to the third line, you get:
As you can see now, the values underlined twice in the last line are the coefficients of the result polynomial and the last value behind is the remainder of the division (here zero).
If you multiply the sign in the second line, the calculation is carried out as follows:
If you now note the reversed sign of the absolute term of the divisor in front of the scheme, you get the general representation of the Horner scheme:
The above example can now be summarized in the following formula:
Has the division task:
as a result
the coefficients are determined according to the following rule:
The Horner scheme is then as follows:
Note: With this result, the calculation can function values of a polynomial on the site also derived as follows:
Let's look at the division through
Polynomial division with a divisor of the 2nd degree
Has the division task:
as a result
the coefficients are determined according to the following rule:
The generalized Horner scheme is then as follows:
In the Horner scheme:
This results in:
In some cases, for example to improve convergence in Newton's method , it can be very helpful to transform a polynomial into a polynomial , constant, so that with :
Such a linear transformation can be obtained by substituting instead of and then multiplying out. This calculation can be carried out much more efficiently with the complete Horner scheme.
Let us consider the polynomial of degree , which we want to expand in terms of powers of : To do this, we divide the polynomial by using the Horner scheme . As shown above, we can read off the polynomial and the remainder from the scheme , so that:
Now the division is carried out on the result polynomial , and we get or the remainder :
After divisions you get:
With is then the linear transformation
I.e. the remainder of the continued division with the linear factor form the coefficients of the transformed polynomial .
Would you like If, for example, you calculate the zero of the polynomial , you can easily guess the point as the first approximation. For the further calculation it is now helpful to develop according to (see “Methodus fluxionum et serierum infinitarum” ). So we are looking for the polynomial .
So the polynomial we are looking for is .
Calculation of the derivative
Another property of the Horner scheme is that the first derivative can be calculated very quickly at this point .
Let's look at the division
with the result
which we can read from the Horner scheme. Further up you could see that it is. The following applies:
The derivative can be calculated using the difference quotient . The following applies:
I.e. the numbers in the third line of the Horner scheme form the coefficients for . By applying the Horner scheme again, the value of the derivative can finally be calculated.
Let us consider the polynomial at the point x = 2
From the scheme you can now read: and
From the Horner scheme
The values of the other derivatives can also be read from the Horner scheme. Be
- and , with
the polynomial which we can read from the complete Horner scheme ( see above ) is
Determination of zeros
The Horner scheme can be used in various numerical methods for determining the roots of polynomials.
Has one z. For example , you can "guess" a zero , as shown above, so you can quickly check whether the assumption is correct.
In order to shorten the “guessing” of the root in some simple tasks, one can use the theorem about rational zeros . From this it follows that an integer zero is a divisor of . If there is a factor in front of the highest power of (e.g. 3 for:) , then the divisors of and, ideally, the entire function are to be divided by it (→ ).
Example: Take a look at . The possible divisors of 6 and thus candidates for zeros are 1, 2, 3, 6, and also −1, −2, −3, −6. With the Horn scheme you can now calculate the function values at these points and thus determine the actual zeros. The zeros are then −1, +1, +6. If you have determined a zero, you can also split off a linear factor with the Horn scheme, as explained above.
Another area of application is the Newtonian approximation method . For Newton's method is required in each iteration -Step and . As described above, these values can be calculated very quickly using the Horner scheme.
William George Horner was not the first to discover this process. It was mainly thanks to De Morgan that the process became known by his name. Paolo Ruffini published a corresponding procedure 15 years before Horner; it is therefore also known as regla de Ruffini in Spain . The first known descriptions of the process go back to the 11th century ( Jia Xian in China and as-Samaw'al in the Middle East). The Chinese Zhu Shijie described a conversion method for solving equations, which he called fan fa , in his book Siyuan yujian in 1303 . The Arabs also used the method (as-Samawal, Sharaf al-Din al-Tusi ).
- William George Horner: A new method of solving numerical equations of all orders, by continuous approximation. In: Philosophical Transactions of the Royal Society of London. 1819, pp. 308-335.
- Charles D. Miller, Margaret L. Lial, David I. Schneider: Fundamentals of College Algebra. 3rd revised edition. Scott & Foresman / Little & Brown Higher Education, 1990, ISBN 0-673-38638-4 , pp. 204-209.
- Gisela Engeln-Müllges , Klaus Niederdrenk, Reinhard Wodicka: Numerical algorithms: procedures, examples, applications. Springer 2005, ISBN 3-540-62669-7 , pp. 92-100 ( excerpt in Google book search)
- Online calculator for polynomial division with the Horner scheme
- Markus Bauer: The Horner scheme . Technical work, Ottobrunn grammar school 2001
- The Hornerschema and other tricks on Matroids Matheplanet on July 27, 2003
- Olaf Schimmel: Calculation with the Horner scheme ( Memento from November 11, 2014 in the Internet Archive )
References and comments
- Josef Stoer: Numerical Mathematics 1 . 9th edition. Springer, 2004.
- When calculating the powers , k≥2, one can first calculate the lower and then the higher powers. This makes use of the fact that it is already calculated when it is needed. For one therefore needs only one more multiplication and not their .
- Interactive wage and income tax calculator: rounding rule ( Memento from May 21, 2014 in the Internet Archive ) Federal Ministry of Finance: Interactive wage and income tax calculator: rounding rule
- The income tax rate formulas since 1958 Wolfgang & Johannes Parmentier: The income tax rate formulas since 1958
- John J. O'Connor, Edmund F. Robertson : Horner scheme. In: MacTutor History of Mathematics archive .