How (and Why) Long Division of Polynomials Works

Having just looked at the Rational Zero Theorem, I realized we’ve never covered how to divide polynomials, which is used closely with that theorem. Here we’ll look at long division, and then, next time, at synthetic division, its efficient version.

How it works, with three warnings

Here is a question from 2004:

Polynomial Long Division

Use long division to divide (2x - 3) into 4x^4 - x^2 - 2x + 1.  I really need help in doing this.

Doctor Roberts worked through a slightly simpler example:

Dear Angela,

There are three things that tend to give students problems when it comes to polynomial long division.  I'll address all three, but if your confusion is about something else, let me know.

First, when you write the expressions down to divide them, make sure to include _every_ power of x.  If there is a power missing in the given problem, fill it in with a 0 to hold that place.  For example, if you were dividing x - 1 into 2x^3 + x - 5, you'd write it like this:
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  

Adding the zero term keeps the columns in order, as we will see when we do the problem shortly.  Also, since the answer may include the second power of x, this provides a column to write that part of the answer.  And note that nothing really changed about the polynomial, since zero times x^2 is zero.

Adding zero terms is sometimes needed in the divisor as well.  For example, if you had been dividing by x^2 - 1 instead of x - 1, you would write the divisor as x^2 + 0x - 1.

That zero term is literally holding a place for subsequent \(x^2\) terms that will go above and below it. It isn’t as important when the divisor is missing a term, but do that if it helps you avoid errors.

For more about place-holders, see

Polynomial Long Division

We’ll find one term in the quotient at a time:

OK, let's start doing this division, and I'll point out the other two common problems as we come to them.  To start the division, look only at the first term of the divisor and the first term of the dividend, so that gives us 'x' and '2x^3'.  What times 'x' will make it 2x^3?  Or, maybe you prefer to think about what you would get if you divide 2x^3 by x.  Either way, the answer is 2x^2.

Some students initially find it easiest to think of this division as simplifying the fraction \(\displaystyle\frac{2x^3}{x}=2x^2\); I just think, what do I have to multiply \(x\) by to get \(2x^3\)? That is, what is missing? We need a 2, and another two x’s; so we get \(2x^2\).

So that's the first term of the quotient, or answer.  Let's put it on top in the x^2 column (good thing we added that 0x^2!):

                 2x^2
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  

Now multiply the 2x^2 times the (x - 1) and write the answers in the correct columns:

                 2x^2
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  
          2x^3 - 2x^2

Not everyone puts the quotient term in the column above the matching term in the dividend, but this helps in keeping track of your work, and will remind you when you are finished, so I strongly recommend it.

He then multiplied each term in the divisor, \(x-1\), by the new quotient term, \(2x^2\), to get $$2x^2(x-1)=2x^2\cdot x-2x^2\cdot 1=2x^3-2x^2.$$

As with regular long division, once you have determined how many times the divisor goes in, written that number up top, and multiplied, the next step is to subtract.  And this is the second common mistake that people make with polynomial long division.  Remember that you are subtracting the whole expression of 2x^3 - 2x^2.  The subtraction will change the signs on _both_ of those terms since

  -(2x^3 - 2x^2) is equal to -2x^3 + 2x^2.

So what we get when we subtract is:

                 2x^2
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  
         -2x^3 + 2x^2
          -----------
             0 + 2x^2

Can you see why we got +2x^2?  What you really had for the subtraction was 0x^2 - (-2x^2), which became 0x^2 + 2x^2, which is just 2x^2.  Some people find it helpful to immediately change the signs after they multiply [as I did] and then just add, while others prefer to do the subtraction and just remember that they are subtracting and think about what happens if you subtract a negative.  Whatever makes the most sense to you is fine, but in my experience this is the place where most students make their mistakes in the long division process.

I personally prefer the latter way, which looks like this:

                 2x^2
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  
        -(2x^3 - 2x^2)
          -----------
             0 + 2x^2

I make sure to write the subtraction and the parentheses, to remind me what I am doing; the benefit is that when I later check my work, I can see the result of the multiplication sitting there, and not wonder about the signs. Decide, with practice, what works for you.

Continuing, we can "bring down" the next term, which would be the 1x, and then proceed the same way as the first cycle.  What's 2x^2 divided by x?  Sounds like 2x to me!  Put that up top in the x column and multiply it by x - 1, then subtract:

                 2x^2 + 2x
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  
         -2x^3 + 2x^2
          -----------
                 2x^2 + 1x
                 2x^2 - 2x
                 ---------
                        3x

Note that this time I did not change the signs and add, I just remembered that when I subtract I have 1x - (-2x) which is 1x + 2x or 3x.

Each time we subtract, we treat the result as a new dividend, doing everything over again.

(You should consistently use one approach to the subtraction, rather than vary it as he is doing to demonstrate both.)

Now bring down the -5 and continue by dividing 3x by x to get 3:

                 2x^2 + 2x + 3
        ______________________
  x - 1 ) 2x^3 + 0x^2 + 1x - 5  
         -2x^3 + 2x^2
          -----------
                 2x^2 + 1x
                 2x^2 - 2x
                 ---------
                        3x - 5
                        3x - 3
                        ------
                           - 2

Again, this time I had -5 - (-3) which is -5 + 3 or -2.  Since there is nothing left to "bring down", and because the degree of the remainder (there is no x in it, so it's degree zero) is less than the degree of the divisor (with the x^1 it's degree one) we're finished and the -2 is the remainder.

We’ll see more about remainders below.

This brings us to the third idea that sometimes causes problems--what to do with the remainder.  To figure what to do, let's look at how remainders work with regular division.
                        __
Say we want to divide 3 )5.  The answer is 1 rem. 2, since 3 goes into 5 one time with 2 left over.  Another way to write this is 
    __
  3 )5 = 1 + 2/3.  

The remainder is divided by the divisor and added to the answer. Checking the answer, 3(1 + 2/3) = 3 + 6/3 = 3 + 2 = 5.

So, in polynomial division, if there's a remainder, just write it as a fraction, with the remainder as the numerator and the divisor as the denominator, and add it to the rest of the answer.  If it's negative, as in our example, you can write it one of two ways:

                   -2                            2
  2x^2 + 2x + 3 + -----   OR   2x^2 + 2x + 3 - -----
                  x - 1                        x - 1

Note that the two choices are either to write it as adding a negative (on the left) or subtracting a positive (on the right).  Either is fine, though the right hand one is slightly more elegant.

You or your teacher may have a preference.

So, the three things to keep in mind for long division are:

  1. Write the divisor and dividend in descending
     order of powers of the variable and fill in
     zero terms where needed.

  2. Be careful in the subtraction step, especially
     when subtracting a negative.

  3. If you have a reminder, write it as a fraction
     by putting it over the divisor.

Can you take a shot at your problem now?  If you get stuck, write back and show me what you've done and I'll give you some help.

All these hints will be needed in doing the original problem!

For another explanation of the process, comparing it to long division of numbers, see

Polynomial Division Compared with Long Division

Why it works: Undoing a multiplication

This question, from 2011, focuses on why the process is what it is, comparing it to numerical division:

Why Does the Algorithm for Polynomial Long Division Ignore Smaller Terms?

I've read this post on long division by numbers:

  Why Does Long Division Work?
  http://mathforum.org/library/drmath/view/70275.html 

Despite a lot of searching, I want to see more of why the vertical manipulation works. Here is an example of what I'm looking for.

Example

   (2x^2 + 7x + 5) divided by (2x + 5).

This is easily divided out by long division to get (x + 1).

My question is about the division PROCESS to get the quotient (x + 1).

Why/how does the process work? What's the proof to the process that makes it start out with 2x^2/2x = x, then multiply back through the binomial divisor, then subtract and repeat with a new line?

How can we show/prove that this "algorithm" works for all division for polynomials with divisor degree less than that of the dividend?

Basically, I want a simple explanation to the question, "Why do we divide by the first term and continue while ignoring the other terms until the multiplication?"

For my example, I purposely chose a polynomial for the divisor that is not a monic. Are there two cases?

The 2006 page Cody referred to briefly explains how ordinary division works, and comments, “Incidentally, if you’ve taken algebra you’ve probably seen long division of polynomials, which uses the same general algorithm, but without the need for ‘borrowing’ between digits, so it’s more straightforward. Some of the details are easier to understand in that context.” When we divide numbers (for example, \(486\div18\)), we have to look beyond the first digit (not just dividing 4 by 1, but 48 by 18), because the digits interact; as we’ll see, that doesn’t happen with terms of a polynomial.

A monic polynomial, by the way, is one whose leading coefficient is just 1. Cody wondered if that makes a difference in the process. It doesn’t; but it’s good to have a more general example, as I will also do.

I answered:

Hi, Cody.

Any polynomial works the same way -- and for the same reasons.

Let's examine division in light of what it is supposed to do. Division means finding the other factor to get a given product; for example, with numbers, dividing 7 by 3 means finding what number q we can multiply by 3 to get (close to) 7:

   7 / 3 = 2 R 1

means that

   7 = 3 * 2 + 1

So we can understand a division by seeing how it arrives at the required other factor.

In this very simple example, we could carry out the division by just asking, what number can fill in the first blank in “\(\mathbf{7}={\color{DarkGreen}3}({\color{Red}\_})+({\color{Orchid}\_})\)”, making the second blank the smallest possible positive integer? Here, too, we’ll be looking for the missing parts of a multiplication.

(You may be observing that we haven’t actually found a factor of 7 here; the result of this division would properly be \(7\div3=\frac{7}{3}=2\frac{1}{3}\). The kind of division we are doing here is called Euclidean division, or integer division with remainder. We are really finding the “other factor” of the nearest perfect multiple of 3 less than or equal to the given dividend 7. That’s what division of polynomials is an extension of.)

I'll first multiply two simple polynomials and add a remainder, in order to create a division problem, the answer to which we know ahead of time:

          3x + 1 <-- factor (divisor)
   *      2x - 3 <-- factor (quotient)
   -------------
         -9x - 3 <-- partial product (-3)(3x + 1)
   6x^2 + 2x     <-- partial product (2x)(3x + 1)
   -------------
   6x^2 - 7x - 3
             + 4 <-- addend (remainder)
   -------------
   6x^2 - 7x + 1 <-- product (dividend)

So if we divide 6x^2 - 7x + 1 by 3x + 1, we should get a quotient of 2x - 3, with a remainder of 4.

Here I’ve shown that $$6x^2-7x+1=({\color{DarkGreen}{x+1}})({\color{Red}{2x-3}})+{\color{Orchid}4},$$ so the division will be $$(6x^2-7x+1)\div({\color{DarkGreen}{x+1}})=({\color{Red}{2x-3}})\text{ rem }{\color{Orchid}4}.$$

We’ll see how long division reconstructs the second factor, finding the partial products in the process.

Let's start. Reversing the process of multiplication (in which we repeatedly ADDED multiples of 3x + 1 by single terms), we want to SUBTRACT appropriate multiples of 3x + 1 by single terms, building the quotient term by term as we dismantle the dividend. Each subtraction should eliminate a term of the dividend, so that we will reduce its degree at each step.

What multiple of 3x + 1 can we subtract from 6x^2 - 7x + 1 in order to eliminate the leading term? Well, in order to have ...

   (3x + 1)(__ + ...) = 6x^2 + ...

... the blank has to be 2x. Note that since we are focused on eliminating the leading term of the dividend, and in multiplication that term is formed by multiplying the leading terms of the factors, all we have to look at in making this decision are the leading terms 6x^2 and 3x. That answers your main question.

So we look only at the leading terms of the dividend and the divisor because that determines the term of the quotient that we want to find.

So the first term of our quotient has to be 2x. That gives us

  (3x + 1)(2x + __) = (6x^2 + 2x) + (3x + 1)(__)

Now we can subtract the product we have so far, 6x^2 + 2x, from 6x^2 - 7x + 1 in order to see what more we need:

      6x^2 - 7x + 1
   - (6x^2 + 2x    )
   -----------------
            -9x + 1

This becomes our new dividend, and we can repeat the process to find the next term of the quotient:

Now for our next term to eliminate the new leading term, we need

   (3x + 1)(__) = -9x + ...

What can fill in the blank to get this leading term? -3. Let's try it:

   (3x + 1)(-3) = -9x - 3

This is the new term of the quotient.

Look back at the multiplication I did above. In doing our divisions, we've been working backward, discovering the partial products needed to add up to the dividend. We first found the partial product 6x^2 + 2x that accounts for the 6x^2 in the dividend; we subtracted that off to see that the next partial product had to account for a -9x, and we saw that it was -9x - 3. Subtracting off this last partial product, we see that we still have to add 4 to get the dividend.

These are exactly the partial products in our original multiplication.

The work we just did so laboriously is the following:

                   2x - 3
          ----------------
   3x + 1 ) 6x^2 - 7x + 1
          -(6x^2 + 2x    ) <-- (2x)(3x + 1)
            -------------
                  -9x + 1
                -(-9x - 3) <-- (-3)(3x + 1)
                  -------
                        4

What this means, expanded, is just a repeated subtraction:

   (6x^2 - 7x + 1) - (6x^2 + 2x)  - (-9x - 3)    = 4
 
   (6x^2 - 7x + 1) - (2x)(3x + 1) - (-3)(3x + 1) = 4

   (6x^2 - 7x + 1) - (2x - 3)(3x + 1)            = 4

   (6x^2 - 7x + 1)                               = (2x - 3)(3x + 1) + 4

And this is what we were trying to accomplish.

Note that I wrote the division in my style, to emphasize the subtractions.

Does that help? Again, the reason we look at the leading terms of the divisor and (current) dividend at each step is so that what we subtract will reduce the degree of the dividend, leaving us eventually with only a remainder (with degree less than the divisor).

But there’s another question students sometimes ask, about remainders.

Why are remainders what they are?

Here is a question from 2016:

Why Are Remainders Small?

Dear Dr. Math, 

Polynomial divisions always seem to show that the degree of the remainder is less than that of the divisor. Is there a simple explanation for why this is so?

I mean, we can say that the degree of P(x) is greater than the degree of D(x) in

   P(x)/D(x) = Q(x) + R(x)/D(x)
   
But how can I conclude this?

   degree of R(x) < degree of D(x)

Could you please explain why the degree of the remainder should be less than the degree of the divisor? 

Thank you for your time and help.

I answered:

Hi, Chris.

It's not something you can conclude -- but it is something you can require.

That is, the "division algorithm" is a theorem that says you can always find Q and R such that this will be true:

   P(x) = Q(x)D(x) + R(x)

They will be unique if we require that the degree of R be less than that of D. In essence, we are DEFINING the remainder as the polynomial that fits in that equation such that its degree is less than that of the divisor, and proving that this always exists and is unique.

The theorem says that this is possible; and there are reasons to want to get such a result; so we make that the definition of a remainder, so that there will only be one “correct” answer.

[Technically, as I mentioned in answering a recent question about this, the remainder either has a lower degree than the divisor, or is zero. That’s because a zero polynomial has undefined degree, so we can’t properly say it is lower! But we often ignore that detail.]

We have an analogous situation in the division of integers. Given numbers p and d, we can find MANY numbers q and r such that

   p = qd + r

We define the quotient and remainder uniquely by requiring that r < d. For example, given p = 7 and d = 3, we can write ...

   7 = 0*3 + 7
   7 = 1*3 + 4
   7 = 2*3 + 1
   7 = 3*3 - 2

... and so on. But only one of these has 0 <= r < d, namely

   7 = 2*3 + 1

So we say that the quotient of 7/3 is 2, and the remainder is 1. 

It's not that it has to be less than 3 to write the equation, but rather that we WANT it to be less than 3 so that there is only one valid answer.

To put it another way, if the "remainder" you get is NOT less than 3, you can always increase the quotient so that it will be. And going back to polynomials, if the degree of R is not less than that of D, you can always go another step and bring the degree down to where you want it.

Ultimately, what we are doing when we divide (numbers or polynomials) is going as far as possible while keeping the remainder positive (or zero); that is, we want to leave the smallest possible positive remainder, and if that remainder were larger than the divisor, we could go further. It’s similar with polynomials.

But that begs a question:

But how can a remainder be negative?

Here is a 2010 question from a teacher:

Negative Remainders in Arithmetic and Algebra: a Difference of Degrees

Dear Dr. Math,

When elementary students learn long division, the remainders are always positive. They continue in this way, becoming accustomed to positive remainders ... until they reach Algebra II, which suddenly confronts them with negative polynomial remainders.

What is the best way to explain the meaning of negative remainders to students learning polynomial long division ?

I went through the algorithm (divisor * quotient + remainder = dividend), showing them the example that ...

   17/5 = 3 + 2/5
   
... is the same as

   4 + (-3)/5.
   
But that didn't really seem to explain what negative remainders mean, so I felt my explanation was not adequate.

Thanks for your help.

If we let the remainder be negative (\(-3\)), the answer would not be unique. That’s why it isn’t allowed. Hold that thought.

The question concerns a case like \((x^2-3x-1)\div(x-1)=x-2\) with a remainder of \(-3\), because $$x^2-3x-1=(x-1)(x-2)-3$$

Why can this remainder be negative, when the other could not?

I answered:

Hi, Bob.

When we do long division of numbers, our goal is to have a remainder that is positive and less than the divisor:

  A = D * Q + R  with 0 <= R < D

where A is the dividend, D is the divisor, Q is the quotient, and R is the remainder.

When it comes to polynomials, however, we can't say that one polynomial is less than another; that would depend on the value of x. What we CAN do is to compare the DEGREE of two polynomials. And when we divide polynomials, our goal is to have a remainder of DEGREE less than that of the divisor:

  A(x) = D(x) * Q(x) + R(x)  with 0 <= deg(R) < deg(D)

So in this context, whether the remainder (or, for that matter, a term of the quotient) is positive or negative is irrelevant. The degree of -2x + 1 is less than the degree of 3x^2 + 5x - 4, so we would accept the former as a remainder if we are dividing by the latter.

As an example of the last sentence, if we divide \(6x^3+7x^2-15x+5\) by \(3x^2+5x-4\), we get a quotient of \(2x-1\) and a remainder of \(-2x+1\), whose leading term is negative. Above, I gave an example where the remainder is just a negative number. The point is that (a) we can’t make the remainder positive, and (b) having degree 1 in this example is enough to stop the work. We can’t continue reducing the degree past that!

It may also be helpful to note that in numbers (written in positional base-ten notation), each digit represents the coefficient of a power of 10, and must be positive and less than 10. In polynomials, each term represents a power of x, and the coefficient need only be a number. Sign doesn't matter. That is the difference between numerals and polynomials, and it plays out in how we do long division in each context.

This is among the reasons that polynomial division is considerably easier than numerical division (no matter what students think).

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.