Polynomial Long Division

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 x32x28x+21{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21} by x+3{x}+{3}.

Write division in special form:

x+3)x32x28x+21\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 x32x28x+21{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}.

In other words, we need to get rid of x3{{x}}^{{3}}.

To do it, we divide x3{{x}}^{{3}} by the leading term of divisor x+3{x}+{3}, i.e. x{x} (divide monomials): x3x=x2\frac{{{x}}^{{3}}}{{x}}={\color{red}{{{{x}}^{{2}}}}}.

Now, we subtract x2(x+3){\color{red}{{{{x}}^{{2}}}}}{\left({x}+{3}\right)} from x32x28x+21{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}:

x32x28x+21x2(x+1)=x32x28x+21(x3+3x2)={{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}-{{x}}^{{2}}{\left({x}+{1}\right)}={{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}-{\left({{x}}^{{3}}+{3}{{x}}^{{2}}\right)}= (multiply monomial by polynomial)

=x32x28x+21x33x2=5x28x+21={{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}-{{x}}^{{3}}-{3}{{x}}^{{2}}=-{5}{{x}}^{{2}}-{8}{x}+{21}.

Nice, we got rid of x3{{x}}^{{3}} and ended up with a polynomial of lower degree.

Let's write it in vertical division:

x22x28x+21x+3)x32x28x+21(x3+3x2)8x+21\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.

x22x28x+21x+3)x32x28x+21x33x28x+21\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:

x22x28x+21x+3)x32x28x+21x33x28x+215x28x+21\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 5x2-{5}{{x}}^{{2}}.

To do it, we divide 5x2-{5}{{x}}^{{2}} by the leading term of divisor x+3{x}+{3}, i.e. x{x}: 5x2x=5x\frac{{-{5}{{x}}^{{2}}}}{{x}}={\color{red}{{-{5}{x}}}}.

Next, subtract 5x(x+3){\color{red}{{-{5}{x}}}}{\left({x}+{3}\right)} from 5x28x+21-{5}{{x}}^{{2}}-{8}{x}+{21}:

5x28x+21(5x(x+3))=5x28x+21(5x215x)=-{5}{{x}}^{{2}}-{8}{x}+{21}-{\left(-{5}{x}{\left({x}+{3}\right)}\right)}=-{5}{{x}}^{{2}}-{8}{x}+{21}-{\left(-{5}{{x}}^{{2}}-{15}{x}\right)}= (multiply monomial by polynomial)

=5x28x+21+5x2+15x=7x+21=-{5}{{x}}^{{2}}-{8}{x}+{21}+{5}{{x}}^{{2}}+{15}{x}={7}{x}+{21}.

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

x25x8x2+21x+3)x32x28x+21x33x28x+215x28x+21+5x2+15x+217x+21\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{7}{x} by multiplying x+3{x}+{3} by 7{7}:

x25x+7x+21x+3)x32x28x+21x33x28x+215x28x+21+5x2+15x+217x+217x210\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 x32x28x+21x+3=x25x+7\frac{{{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}}}{{{x}+{3}}}={{x}}^{{2}}-{5}{x}+{7}.

From another side it means, that x32x28x+21=(x+3)(x25x+7){{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}={\left({x}+{3}\right)}{\left({{x}}^{{2}}-{5}{x}+{7}\right)}.

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

x32x28x+21=x2(x+3)+(5x)(x+3)+7(x+3){\color{purple}{{{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}={{x}}^{{2}}{\left({x}+{3}\right)}+{\left(-{5}{x}\right)}{\left({x}+{3}\right)}+{7}{\left({x}+{3}\right)}}}} (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){\left({x}+{3}\right)}: x32x28x+21x+3=x2(x+3)x+3+5x(x+3)x+3+7(x+3)x+3=x25x+7\frac{{{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}}}{{{x}+{3}}}=\frac{{{{x}}^{{2}}{\left({x}+{3}\right)}}}{{{x}+{3}}}+\frac{{-{5}{x}{\left({x}+{3}\right)}}}{{{x}+{3}}}+\frac{{{7}{\left({x}+{3}\right)}}}{{{x}+{3}}}={{x}}^{{2}}-{5}{x}+{7}.

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

Answer: x32x28x+21x+3=x25x+7\frac{{{{x}}^{{3}}-{2}{{x}}^{{2}}-{8}{x}+{21}}}{{{x}+{3}}}={{x}}^{{2}}-{5}{x}+{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: 6x317x28x+23x2+2x1\frac{{{6}{{x}}^{{3}}-{17}{{x}}^{{2}}-{8}{x}+{2}}}{{{3}{{x}}^{{2}}+{2}{x}-{1}}}.

I will do this example a bit faster.

2x378x2+213x2+2x1)6x317x28x+26x34x2+2x+2121x26x+2+21x2+14x78x5\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 8x5{8}{x}-{5} is less than degree of the divisor 3x2+2x1{3}{{x}}^{{2}}+{2}{x}-{1}, however, remainder is not zero.

We can write now (according to the steps), that

6x317x28x+2=2x(3x2+2x1)7(3x2+2x1)+(8x5){6}{{x}}^{{3}}-{17}{{x}}^{{2}}-{8}{x}+{2}={2}{x}{\left({\underline{{{3}{{x}}^{{2}}+{2}{x}-{1}}}}\right)}-{7}{\left({\underline{{{3}{{x}}^{{2}}+{2}{x}-{1}}}}\right)}+{\left({8}{x}-{5}\right)}.

Or 6x317x28x+2=(2x7)(3x2+2x1)+8x5{\color{purple}{{{6}{{x}}^{{3}}-{17}{{x}}^{{2}}-{8}{x}+{2}={\left({2}{x}-{7}\right)}{\left({3}{{x}}^{{2}}+{2}{x}-{1}\right)}+{8}{x}-{5}}}} (distributive property of multiplication: acbc=(ab)c{a}{c}-{b}{c}={\left({a}-{b}\right)}{c}).

Finally, 6x317x28x+23x2+2x1=2x7+8x53x2+2x1\frac{{{6}{{x}}^{{3}}-{17}{{x}}^{{2}}-{8}{x}+{2}}}{{{3}{{x}}^{{2}}+{2}{x}-{1}}}={2}{x}-{7}+\frac{{{8}{x}-{5}}}{{{3}{{x}}^{{2}}+{2}{x}-{1}}}.

Answer: 6x317x28x+23x2+2x1=2x7+8x53x2+2x1\frac{{{6}{{x}}^{{3}}-{17}{{x}}^{{2}}-{8}{x}+{2}}}{{{3}{{x}}^{{2}}+{2}{x}-{1}}}={2}{x}-{7}+\frac{{{8}{x}-{5}}}{{{3}{{x}}^{{2}}+{2}{x}-{1}}}, quotient is 2x7{2}{x}-{7}, remainder is 8x5{8}{x}-{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 x312x+8\frac{{{{x}}^{{3}}-{1}}}{{{2}{x}+{8}}}.

When we perform long division, there will appear terms involving x{x} and x2{{x}}^{{2}}. However, there are no such terms in x31{{x}}^{{3}}-{1}.

To fix situation, we add mentioned terms with zero coefficient: x31=x3+0x2+0x1{{x}}^{{3}}-{1}={{x}}^{{3}}+{0}{{x}}^{{2}}+{0}{x}-{1}. We haven't changed anything, because adding zero doesn't change anything.

Now, perform long division:

12x22x+8x12x+8)x3+0x2+0x1x34x2+0x14x2+0x1+4x2+16x116x116x6465\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, x31=(12x22x+8)(2x+8)65{{x}}^{{3}}-{1}={\left(\frac{{1}}{{2}}{{x}}^{{2}}-{2}{x}+{8}\right)}{\left({2}{x}+{8}\right)}-{65}.

Answer: Quotient is 12x22x+8\frac{{1}}{{2}}{{x}}^{{2}}-{2}{x}+{8}, remainder is 65-{65}.

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

Example 4. Divide 3x3y3+x2y3+x2y2+xy22xy{3}{{x}}^{{3}}{{y}}^{{3}}+{{x}}^{{2}}{{y}}^{{3}}+{{x}}^{{2}}{{y}}^{{2}}+{x}{{y}}^{{2}}-{2}{x}{y} by xy+1{x}{y}+{1}.

3x2y22xy+xy2+x2y3+x2y2xy+1)3x3y3+x2y22xy+x2y3+xy23x3y33x2y2+x2y3+xy22xy2x2y22xy+x2y3+xy2+2x2y2+2xy+x2y3+xy20+x2y3+xy2x2y3xy20\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: 3x3y3+x2y3+x2y2+xy22xyx+1=3x2y22xy+xy2\frac{{{3}{{x}}^{{3}}{{y}}^{{3}}+{{x}}^{{2}}{{y}}^{{3}}+{{x}}^{{2}}{{y}}^{{2}}+{x}{{y}}^{{2}}-{2}{x}{y}}}{{{x}+{1}}}={3}{{x}}^{{2}}{{y}}^{{2}}-{2}{x}{y}+{x}{{y}}^{{2}}.

Now, it is time to exercise.

Exercise 1. Divide x33x23x+5{{x}}^{{3}}-{3}{{x}}^{{2}}-{3}{x}+{5} by x1{x}-{1}.

Answer: x22x5{{x}}^{{2}}-{2}{x}-{5}.

Exercise 2. Find quotient and remainder of x3+7x2+10x3x+4\frac{{{{x}}^{{3}}+{7}{{x}}^{{2}}+{10}{x}-{3}}}{{{x}+{4}}}.

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

Exercise 3. Divide the following: x32x2+3x2+1\frac{{{{x}}^{{3}}-{2}{{x}}^{{2}}+{3}}}{{{{x}}^{{2}}+{1}}}.

Answer: x32x2+3x2+1=x2+5xx2+1\frac{{{{x}}^{{3}}-{2}{{x}}^{{2}}+{3}}}{{{{x}}^{{2}}+{1}}}={x}-{2}+\frac{{{5}-{x}}}{{{{x}}^{{2}}+{1}}}.

Exercise 4. Perform long division: 2a3b3+a3b2+a2b36a2b3a23aba+b+2ab\frac{{{2}{{a}}^{{3}}{{b}}^{{3}}+{{a}}^{{3}}{{b}}^{{2}}+{{a}}^{{2}}{{b}}^{{3}}-{6}{{a}}^{{2}}{b}-{3}{{a}}^{{2}}-{3}{a}{b}}}{{{a}+{b}+{2}{a}{b}}}.

Answer: a2b23a{{a}}^{{2}}{{b}}^{{2}}-{3}{a}.