# Polynomial Long Division

## Related Calculators: Polynomial Long Division Calculator , Polynomial Calculator

Polynomial Long Division is a technique for dividing polynomial by another polynomial. It works in the same way as long division of numbers, but here you are dealing with variables.

You perform division step by step, by "guessing" terms of a quotient. Division is finished, when degree of the result is less than degree of the divisor.

Example 1. Divide x^3-2x^2-8x+21 by x+3.

Write division in special form:

$$\begin{array}{r}\\x+3\hspace{1pt})\overline{\hspace{1pt}x^3-2x^2-8x+21}\\\end{array}$$$Let's carefully think what to do next. The goal is to get rid of the leading term of dividend x^3-2x^2-8x+21. In other words, we need to get rid of x^3. To do it, we divide x^3 by the leading term of divisor x+3, i.e. x (divide monomials): x^3/x=color(red)(x^2). Now, we subtract color(red)(x^2)(x+3) from x^3-2x^2-8x+21: x^3-2x^2-8x+21-x^2(x+1)=x^3-2x^2-8x+21-(x^3+3x^2)= (multiply monomial by polynomial) =x^3-2x^2-8x+21-x^3-3x^2=-5x^2-8x+21. Nice, we got rid of x^3 and ended up with a polynomial of lower degree. Let's write it in vertical division: $$\begin{array}{r}\color{green}{x^2}\phantom{-2x^2-8x+21}\\\color{green}{x+3}\hspace{1pt})\overline{\hspace{1pt}x^3-2x^2-8x+21}\\-\underline{\color{green}{(x^3+3x^2)}}\phantom{-8x+21}\\\end{array}$$$

You need to be careful with minus sign (we subtract polynomials). The best way is to change signs of terms, and discard parenthesis and minus sign in front of parenthesis, in other words add polynomials.

$$\begin{array}{r}\color{green}{x^2}\phantom{-2x^2-8x+21}\\\color{green}{x+3}\hspace{1pt})\overline{\hspace{1pt}x^3-2x^2-8x+21}\\\underline{\color{green}{\color{red}{-}x^3\color{red}{-}3x^2}}\phantom{-8x+21}\\\end{array}$$$Next, perform addition: $$\begin{array}{r}\color{green}{x^2}\phantom{-2x^2-8x+21}\\\color{green}{x+3}\hspace{1pt})\overline{\hspace{1pt}x^3-2x^2-8x+21}\\\underline{\color{green}{-x^3-3x^2}}\phantom{-8x+21}\\-5x^2-8x+21\end{array}$$$

Now, repeat above steps.

We need to get rid of -5x^2.

To do it, we divide -5x^2 by the leading term of divisor x+3, i.e. x: (-5x^2)/x=color(red)(-5x).

Next, subtract color(red)(-5x)(x+3) from -5x^2-8x+21:

-5x^2-8x+21-(-5x(x+3))=-5x^2-8x+21-(-5x^2-15x)= (multiply monomial by polynomial)

=-5x^2-8x+21+5x^2+15x=7x+21.

We got rid of -5x^2 and ended up with a polynomial of lower degree:

$$\begin{array}{r}x^2\color{purple}{-5x}\phantom{-8x^2+21}\\\color{green}{x+3}\hspace{1pt})\overline{\hspace{1pt}x^3-2x^2-8x+21}\\\underline{-x^3-3x^2}\phantom{-8x+21}\\-5x^2-8x+21\\\underline{\color{purple}{\color{red}{+}5x^2\color{red}{+}15x}\phantom{+21}}\\7x+21\end{array}$$$Finally, get rid of 7x by multiplying x+3 by 7: $$\begin{array}{r}x^2-5x+\color{brown}{7}\phantom{x+21}\\\color{brown}{x+3}\hspace{1pt})\overline{\hspace{1pt}x^3-2x^2-8x+21}\\\underline{-x^3-3x^2}\phantom{-8x+21}\\-5x^2-8x+21\\\underline{+5x^2+15x}\phantom{+21}\\7x+21\\\underline{\color{brown}{-7x-21}}\\\color{cyan}{0}\end{array}$$$

We are done, because remainder is 0.

Thus, we can write that (x^3-2x^2-8x+21)/(x+3)=x^2-5x+7.

From another side it means, that x^3-2x^2-8x+21=(x+3)(x^2-5x+7).

To better understand the process of long division, let's write, that

color(purple)(x^3-2x^2-8x+21=x^2(x+3)+(-5x)(x+3)+7(x+3)) (you can simplify right hand side to make sure, that this is equality).

Each summand in the right hand side corresponds to the step in the division process.

Now, above equality can be divided by (x+3): (x^3-2x^2-8x+21)/(x+3)=(x^2(x+3))/(x+3)+(-5x(x+3))/(x+3)+(7(x+3))/(x+3)=x^2-5x+7.

Note, how x+3's in the denominators and numerators were cancelled.

Answer: (x^3-2x^2-8x+21)/(x+3)=x^2-5x+7.

Now, when you understood how to perform polynomial long division, it's time to consider harder examples.

First example was a "nice" example.

But in most cases there will be not "nice" cases.

Non-Zero Remainder. First not "nice" case is when remainder is not 0.

Similarly to division with remainder for numbers, in most cases you will end up with non-zero remainder (polynomial). But such cases are handled in the same way.

Example 2. Perform the long division: (6x^3-17x^2-8x+2)/(3x^2+2x-1).

I will do this example a bit faster.

$$\begin{array}{r}\color{green}{2x}\phantom{-^3}\color{purple}{-7}\phantom{-8x^2+21}\\3x^2+2x-1\hspace{1pt})\overline{\hspace{1pt}6x^3-17x^2-8x+2}\\\underline{\color{green}{\color{red}{-}6x^3\color{red}{-}4x^2\color{red}{+}2x}}\phantom{+21}\\-21x^2-6x+2\\\underline{\color{purple}{\color{red}{+}21x^2\color{red}{+}14x\color{red}{-}7}}\\\color{cyan}{8x-5}\end{array}$$$We are done, because degree of the remainder 8x-5 is less than degree of the divisor 3x^2+2x-1, however, remainder is not zero. We can write now (according to the steps), that 6x^3-17x^2-8x+2=2x(underline{3x^2+2x-1})-7(underline{3x^2+2x-1})+(8x-5). Or color(purple) (6x^3-17x^2-8x+2=(2x-7)(3x^2+2x-1)+8x-5) (distributive property of multiplication: ac-bc=(a-b)c). Finally, (6x^3-17x^2-8x+2)/(3x^2+2x-1)=2x-7+(8x-5)/(3x^2+2x-1). Answer: (6x^3-17x^2-8x+2)/(3x^2+2x-1)=2x-7+(8x-5)/(3x^2+2x-1), quotient is 2x-7, remainder is 8x-5. Missing Terms. Another not "nice" case is when there are missing terms. In some cases, during division process, there can appear terms that are not present in the dividend. There are two options to fix this problem: • add missing terms with zero coefficient • add gaps during long division. First option, actually, creates gaps at the beginning of the process, so you need not to worry about gaps later. However, second option is better, because often you don't know when and where to fill gaps. Example 3. Find quotient and remainder of (x^3-1)/(2x+8). When we perform long division, there will appear terms involving x and x^2. However, there are no such terms in x^3-1. To fix situation, we add mentioned terms with zero coefficient: x^3-1=x^3+0x^2+0x-1. We haven't changed anything, because adding zero doesn't change anything. Now, perform long division: $$\begin{array}{r}\color{green}{\frac{1}{2}x^2}\color{purple}{-2x}\color{brown}{+8}\phantom{x-1}\\2x+8\hspace{1pt})\overline{\hspace{1pt}x^3\color{magenta}{+0x^2+0x}-1}\\\underline{\color{green}{\color{red}{-}x^3\color{red}{-}4x^2}}\phantom{+0x-1}\\-4x^2+0x-1\\\underline{\color{purple}{\color{red}{+}4x^2\color{red}{+}16x}}\phantom{-1}\\16x-1\\\underline{\color{brown}{-16x-64}}\\\color{cyan}{-65}\end{array}$$$

Therefore, x^3-1=(1/2x^2-2x+8)(2x+8)-65.

Answer: Quotient is 1/2x^2-2x+8, remainder is -65.

Finally, you can divide polynomials, that contain many variables, can also be divided.

Example 4. Divide 3x^3y^3+x^2y^3+x^2y^2+xy^2-2xy by xy+1.

$$\begin{array}{r}3x^2y^2-2xy+xy^2\phantom{+x^2y^3+x^2y^2}\\xy+1\hspace{1pt})\overline{\hspace{1pt}3x^3y^3+x^2y^2-2xy+x^2y^3+xy^2}\\\underline{-3x^3y^3-3x^2y^2}\phantom{+x^2y^3+xy^2-2xy}\\-2x^2y^2-2xy+x^2y^3+xy^2\\\underline{+2x^2y^2+2xy}\phantom{+x^2y^3+xy^2}\\0+x^2y^3+xy^2\\\underline{-x^2y^3-xy^2}\\\color{cyan}{0}\end{array}$$\$

Note, that we swapped some terms to perform division.

Answer: (3x^3y^3+x^2y^3+x^2y^2+xy^2-2xy)/(x+1)=3x^2y^2-2xy+xy^2.

Now, it is time to exercise.

Exercise 1. Divide x^3-3x^2-3x+5 by x-1.

Answer: x^2-2x-5.

Exercise 2. Find quotient and remainder of (x^3+7x^2+10x-3)/(x+4).

Answer: Quotient is x^2+3x-2, remainder is 5.

Exercise 3. Divide the following: (x^3-2x^2+3)/(x^2+1).

Answer: (x^3-2x^2+3)/(x^2+1)=x-2+(5-x)/(x^2+1).

Exercise 4. Perform long division: (2a^3b^3+a^3b^2+a^2b^3-6a^2b-3a^2-3ab)/(a+b+2ab).

Answer: a^2b^2-3a.