Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Synthetic division
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Expanded synthetic division == This method generalizes to division by any [[monic polynomial]] with only a slight modification with '''changes in bold'''. Note that while it may not be displayed in the following example, the divisor must also be written with verbose coefficients. (Such as with <math>2x^3+0x^2-4x+8</math>) Using the same steps as before, perform the following division: :<math>\frac{x^3 - 12x^2 - 42}{x^2 + x - 3}</math> We concern ourselves only with the coefficients. Write the coefficients of the polynomial to be divided at the top. :<math> \begin{array}{|rrrr} \ 1 & -12 & 0 & -42 \end{array}</math> Negate the coefficients of the divisor. :<math> \begin{array}{rrr} -1x^2 &-1x &+3 \end{array}</math> Write in every coefficient but the first one on the left '''in an upward right diagonal''' (see next diagram). :<math>\begin{array}{cc} \begin{array}{rr} \\ &3 \\ -1& \\ \end{array} & \begin{array}{|rrrr} \ 1 & -12 & 0 & -42 \\ & & & \\ & & & \\ \hline \end{array} \end{array}</math> Note the change of sign from '''1 to −1 and from −3 to 3.''' "Drop" the first coefficient after the bar to the last row. :<math>\begin{array}{cc} \begin{array}{rr} \\ &3 \\ -1& \\ \\ \end{array} & \begin{array}{|rrrr} 1 & -12 & 0 & -42 \\ & & & \\ & & & \\ \hline 1 & & & \\ \end{array} \end{array}</math> Multiply the dropped number by the '''diagonal''' before the bar and place the resulting entries '''diagonally to the right''' from the dropped entry. :<math>\begin{array}{cc} \begin{array}{rr} \\ &3 \\ -1& \\ \\ \end{array} & \begin{array}{|rrrr} 1 & -12 & 0 & -42 \\ & & 3 & \\ & -1 & & \\ \hline 1 & & & \\ \end{array} \end{array}</math> Perform an addition in the next column. :<math>\begin{array}{cc} \begin{array}{rr} \\ &3 \\ -1& \\ \\ \end{array} & \begin{array}{|rrrr} 1 & -12 & 0 & -42 \\ & & 3 & \\ & -1 & & \\ \hline 1 & -13 & & \\ \end{array} \end{array}</math> Repeat the previous two steps '''until you would go past the entries at the top with the next diagonal'''. :<math>\begin{array}{cc} \begin{array}{rr} \\ &3 \\ -1& \\ \\ \end{array} & \begin{array}{|rrrr} 1 & -12 & 0 & -42 \\ & & 3 & -39 \\ & -1 & 13 & \\ \hline 1 & -13 & 16 & \\ \end{array} \end{array}</math> Then simply add up any remaining columns. :<math>\begin{array}{cc} \begin{array}{rr} \\ &3 \\ -1& \\ \\ \end{array} & \begin{array}{|rrrr} 1 & -12 & 0 & -42 \\ & & 3 & -39 \\ & -1 & 13 & \\ \hline 1 & -13 & 16 & -81 \\ \end{array} \end{array}</math> Count the terms to the left of the bar. Since there are two, the remainder has degree one and this is the two right-most terms under the bar. Mark the separation with a vertical bar. :<math> \begin{array}{rr|rr} 1 & -13 & 16 & -81 \end{array}</math> The terms are written with increasing degree from right to left beginning with degree zero for both the remainder and the result. :<math> \begin{array}{rr|rr} 1x & -13 & 16x & -81 \end{array}</math> The result of our division is: :<math>\frac{x^3 - 12x^2 - 42}{x^2 + x - 3} = x - 13 + \frac{16x - 81}{x^2 + x - 3}</math> === For non-monic divisors === With a little prodding, the expanded technique may be generalised even further to work for any polynomial, not just [[Monic polynomial|monics]]. The usual way of doing this would be to divide the divisor <math>g(x)</math> with its leading coefficient (call it ''a''): :<math>h(x) = \frac{g(x)}{a}</math> then using synthetic division with <math>h(x)</math> as the divisor, and then dividing the quotient by ''a'' to get the quotient of the original division (the remainder stays the same). But this often produces unsightly fractions which get removed later and is thus more prone to error. It is possible to do it without first reducing the coefficients of <math>g(x)</math>. As can be observed by first performing long division with such a non-monic divisor, the coefficients of <math>f(x)</math> are divided by the leading coefficient of <math>g(x)</math> after "dropping", and before multiplying. Let's illustrate by performing the following division: :<math>\frac{6x^3+5x^2-7}{3x^2-2x-1}</math> A slightly modified table is used: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & & \\ & & & \\ \hline & & & \\ & & & \\ \end{array} \end{array}</math> Note the extra row at the bottom. This is used to write values found by dividing the "dropped" values by the leading coefficient of <math>g(x)</math> (in this case, indicated by the ''/3''; note that, unlike the rest of the coefficients of <math>g(x)</math>, the sign of this number is not changed). Next, the first coefficient of <math>f(x)</math> is dropped as usual: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & & \\ & & & \\ \hline 6 & & & \\ & & & \\ \end{array} \end{array}</math> and then the dropped value is divided by 3 and placed in the row below: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & & \\ & & & \\ \hline 6 & & & \\ 2 & & & \\ \end{array} \end{array}</math> Next, the '''new''' (divided) value is used to fill the top rows with multiples of 2 and 1, as in the expanded technique: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & 2 & \\ & 4 & & \\ \hline 6 & & & \\ 2 & & & \\ \end{array} \end{array}</math> The 5 is dropped next, with the obligatory adding of the 4 below it, and the answer is divided again: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & 2 & \\ & 4 & & \\ \hline 6 & 9 & & \\ 2 & 3 & & \\ \end{array} \end{array}</math> Then the 3 is used to fill the top rows: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & 2 & 3 \\ & 4 & 6 & \\ \hline 6 & 9 & & \\ 2 & 3 & & \\ \end{array} \end{array}</math> At this point, if, after getting the third sum, we were to try and use it to fill the top rows, we would "fall off" the right side, thus the third sum is the first coefficient of the remainder, as in regular synthetic division. But the values of the remainder are '''not''' divided by the leading coefficient of the divisor: :<math>\begin{array}{cc} \begin{array}{rrr} \\ &1& \\ 2&& \\ \\&&/3 \\ \end{array} \begin{array}{|rrrr} 6 & 5 & 0 & -7 \\ & & 2 & 3 \\ & 4 & 6 & \\ \hline 6 & 9 & 8 & -4 \\ 2 & 3 & & \\ \end{array} \end{array}</math> Now we can read off the coefficients of the answer. As in expanded synthetic division, the last two values (2 is the degree of the divisor) are the coefficients of the remainder, and the remaining values are the coefficients of the quotient: :<math> \begin{array}{rr|rr} 2x & +3 & 8x & -4 \end{array}</math> and the result is :<math>\frac{6x^3+5x^2-7}{3x^2-2x-1} = 2x + 3 + \frac{8x - 4}{3x^2-2x-1}</math> === Compact Expanded Synthetic Division === However, the '''diagonal''' format above becomes less space-efficient when the degree of the divisor exceeds half of the degree of the dividend. Consider the following division: :<math>\dfrac{a_7 x^7 + a_6 x^6 + a_5 x^5 + a_4 x^4 + a_3 x^3 + a_2 x^2 + a_1 x + a_0}{b_4 x^4 - b_3 x^3 - b_2 x^2 - b_1 x - b_0}</math> It is easy to see that we have complete freedom to write each product in any row as long as it is in the correct column, so the algorithm can be '''compactified''' by a '''greedy strategy''', as illustrated in the division below: :<math>\begin{array}{cc} \begin{array}{rrrr} \\ \\ \\ \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & & & & q_0 b_3 & & & \\ & & & q_1 b_3 & q_1 b_2 & q_0 b_2 & & \\ & & q_2 b_3 & q_2 b_2 & q_2 b_1 & q_1 b_1 & q_0 b_1 & \\ & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & q_2 b_0 & q_1 b_0 & q_0 b_0 \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & q_2' & q_1' & q_0' & r_3 & r_2 & r_1 & r_0 \\ q_3 & q_2 & q_1 & q_0 & & & & \\ \end{array} \end{array}</math> The following describes how to perform the algorithm; this algorithm includes steps for dividing non-monic divisors: {{ordered list |1= Write the coefficients of the dividend on a bar. :<math>\begin{array}{cc} \begin{array}{|rrrrrrrr} \ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline \end{array} \end{array}</math> |2= Ignoring the first (leading) coefficient of the divisor, negate each coefficients and place them on the left-hand side of the bar. :<math>\begin{array}{cc} \begin{array}{rrrr} b_3 & b_2 & b_1 & b_0 \\ \end{array} & \begin{array}{|rrrrrrrr}\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline \end{array} \end{array}</math> |3= From the number of coefficients placed on the left side of the bar, count the number of dividend coefficients above the bar, starting from the rightmost column. Then place a vertical bar to the left, and as well as the row below, of that column. This vertical bar marks the separation between the quotient and the remainder. :<math>\begin{array}{cc} \begin{array}{rrrr} b_3 & b_2 & b_1 & b_0 \\ \\ \end{array} & \begin{array}{|rrrr|rrrr} a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline & & & & & & & \\ \end{array} \end{array}</math> |4= Drop the first coefficient of the dividend below the bar. :<math>\begin{array}{cc} \begin{array}{rrrr} b_3 & b_2 & b_1 & b_0 \\ \\ \end{array} & \begin{array}{|rrrr|rrrr} a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & & & & & & & \\ \end{array} \end{array}</math> |5= {{unordered list |Divide the previously dropped/summed number by the leading coefficient of the divisor and place it on the row below (this doesn't need to be done if the leading coefficient is 1).<br /> In this case <math>q_3 = \dfrac{a_7}{b_4}</math>, where the index <math>3 = 7 - 4</math> has been chosen by subtracting the index of the divisor from the dividend.<br /> |Multiply the previously dropped/summed number (or the divided dropped/summed number) to each negated divisor coefficients on the left (starting with the left most); skip if the dropped/summed number is zero. Place each product on top of the subsequent columns. :<math>\begin{array}{cc} \begin{array}{rrrr} \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & & & \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & & & & & & & \\ q_3 & & & & & & & \\ \end{array} \end{array}</math> }} |6= Perform a column-wise addition on the next column. In this case, <math>q_2' = q_3 b_3 + a_6</math>. :<math>\begin{array}{cc} \begin{array}{rrrr} \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & & & \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & q_2' & & & & & & \\ q_3 & & & & & & & \\ \end{array} \end{array}</math> |7= Repeat the previous two steps. Stop when you performed the previous two steps on the number just before the vertical bar. {{ordered list |list_style_type=lower-roman |1= Let <math>q_2 = \dfrac{q_2'}{b_4}</math>. :<math>\begin{array}{cc} \begin{array}{rrrr} \\ \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & & q_2 b_3 & q_2 b_2 & q_2 b_1 & & & \\ & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & q_2 b_0 & & \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & q_2' & q_1' & & & & & \\ q_3 & q_2 & & & & & & \\ \end{array} \end{array}</math> |2= Let <math>q_1 = \dfrac{q_1'}{b_4}</math>. :<math>\begin{array}{cc} \begin{array}{rrrr} \\ \\ \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & & & q_1 b_3 & q_1 b_2 & & & \\ & & q_2 b_3 & q_2 b_2 & q_2 b_1 & q_1 b_1 & & \\ & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & q_2 b_0 & q_1 b_0 & \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & q_2' & q_1' & q_0' & & & & \\ q_3 & q_2 & q_1 & & & & & \\ \end{array} \end{array}</math> |3= Let <math>q_0 = \dfrac{q_0'}{b_4}</math>. :<math>\begin{array}{cc} \begin{array}{rrrr} \\ \\ \\ \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & & & & q_0 b_3 & & & \\ & & & q_1 b_3 & q_1 b_2 & q_0 b_2 & & \\ & & q_2 b_3 & q_2 b_2 & q_2 b_1 & q_1 b_1 & q_0 b_1 & \\ & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & q_2 b_0 & q_1 b_0 & q_0 b_0 \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & q_2' & q_1' & q_0' & r_3 & & & \\ q_3 & q_2 & q_1 & q_0 & & & & \\ \end{array} \end{array}</math> }} |8= Perform the remaining column-wise additions on the subsequent columns (calculating the remainder). :<math>\begin{array}{cc} \begin{array}{rrrr} \\ \\ \\ \\ b_3 & b_2 & b_1 & b_0 \\ \\ &&&&/b_4 \\ \end{array} \begin{array}{|rrrr|rrrr} & & & & q_0 b_3 & & & \\ & & & q_1 b_3 & q_1 b_2 & q_0 b_2 & & \\ & & q_2 b_3 & q_2 b_2 & q_2 b_1 & q_1 b_1 & q_0 b_1 & \\ & q_3 b_3 & q_3 b_2 & q_3 b_1 & q_3 b_0 & q_2 b_0 & q_1 b_0 & q_0 b_0 \\ a_7 & a_6 & a_5 & a_4 & a_3 & a_2 & a_1 & a_0 \\ \hline a_7 & q_2' & q_1' & q_0' & r_3 & r_2 & r_1 & r_0 \\ q_3 & q_2 & q_1 & q_0 & & & & \\ \end{array} \end{array}</math> |9= The bottommost results below the horizontal bar are coefficients of the polynomials (the quotient and the remainder), where the coefficients of the quotient are to the left of the vertical bar separation and the coefficients of the remainder are to the right. These coefficients are interpreted as having increasing degree from right to left, beginning with degree zero for both the quotient and the remainder.<br /> We interpret the results to get: :<math>\dfrac{a_7 x^7 + a_6 x^6 + a_5 x^5 + a_4 x^4 + a_3 x^3 + a_2 x^2 + a_1 x + a_0}{b_4 x^4 - b_3 x^3 - b_2 x^2 - b_1 x - b_0} = q_3 x^3 + q_2 x^2 + q_1 x + q_0 + \dfrac{r_3 x^3 + r_2 x^2 + r_1 x + r_0}{b_4 x^4 - b_3 x^3 - b_2 x^2 - b_1 x - b_0}</math> }} === Python implementation === The following snippet implements Expanded Synthetic Division in [[Python (programming language)|Python]] for arbitrary univariate polynomials: <syntaxhighlight lang="python"> def expanded_synthetic_division(dividend, divisor): """Fast polynomial division by using Expanded Synthetic Division. Also works with non-monic polynomials. Dividend and divisor are both polynomials, which are here simply lists of coefficients. E.g.: x**2 + 3*x + 5 will be represented as [1, 3, 5] """ out = list(dividend) # Copy the dividend normalizer = divisor[0] for i in range(len(dividend) - len(divisor) + 1): # For general polynomial division (when polynomials are non-monic), # we need to normalize by dividing the coefficient with the divisor's first coefficient out[i] /= normalizer coef = out[i] if coef != 0: # Useless to multiply if coef is 0 # In synthetic division, we always skip the first coefficient of the divisor, # because it is only used to normalize the dividend coefficients for j in range(1, len(divisor)): out[i + j] += -divisor[j] * coef # The resulting out contains both the quotient and the remainder, # the remainder being the size of the divisor (the remainder # has necessarily the same degree as the divisor since it is # what we couldn't divide from the dividend), so we compute the index # where this separation is, and return the quotient and remainder. separator = 1 - len(divisor) return out[:separator], out[separator:] # Return quotient, remainder. </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)