# Polynomial Long Division

By Catalin David

## Introduction

The general form of a monomial

f(x)=axn, where:

-a is the coefficient and can be part of the sets N, Z, Q, R, C

-x is the variable

-n is the degree and is part of N

Two monomials are equal if they have the same variable and the same degree.

Example: 3x2 and -5x2; ½x4 and 2√3x4

The sum of unequal monomials is called a polynomial. In this case, the monomials will be the terms of the polynomial. A polynomial formed of two terms is called a binomial.
Example: p(x)=3x2-5; h(x)=5x-1
A polynomial formed of three terms is called a trinomial.

The general form of the polynomial with only one variable
p(x)=anxn+an-1xn-1+...+a1x1 +a0
where:

• an,an-1,an-2,...,a1,a0 are the coefficients of the polynomial. They can be natural numbers, integers, rational numbers, real numbers or complex numbers.
• an is the coefficient of the term of the largest degree(the leading coefficient)
• a0 is the coefficient of the term of the smallest degree(the constant)
• n is the degree of the polynomial

Example 1
p(x)=5x3-2x2+7x-1

• third-degree polynomial with the coefficients 5, -2, 7 and -1
• 5 is the leading coefficient
• -1 is the constant
• x is the variable

Example 2
h(x)=-2√3x4+½x-4

• fourth-degree polynomial with coefficients -2√3,½ and -4
• -2√3 is the leading coefficient
• -4 is the constant
• x is the variable

## Dividing Polynomials

p(x) and q(x) are two polynomials:
p(x)=anxn+an-1xn-1+...+a1x1 +a0
q(x)=apxp+ap-1xp-1+...+a1x1 +a0

To find out the quotient and the remainder of dividing p(x) by q(x) we need to use the following algorithm:

1. The degree of p(x) has to be either equal to or greater than the degree of q(x).
2. We write the terms of each polynomial in descending order of the degrees. If p(x) has a missing term, it will be written with the coefficient 0.
3. The leading term of p(x) is divided by the leading term of q(x) and the result is written under the line of the divisor (denominator).
4. We multiply the result with all the terms of q(x) and the results are written with changed sign under the terms of p(x) with corresponding degrees.
5. We add up the terms with the same degrees.
6. Next to the results, we write the other terms of p(x).
7. We divide the leading term of the new polynomial by the first term of q(x) and repeat steps 3-6.
8. We repeat all these steps until the new polynomial will be of a smaller degree than the one of q(x). This will be the remainder of the division.
9. The polynomial written under the line of the divisor will be quotient.

Example 1
Step 1 and 2) $p(x)=x^5-3x^4+2x^3+7x^2-3x+5 \\ q(x)=x^2-x+1$

3)    x5-3x4+2x3+7x2-3x+5
x2-x+1
x3
4)    x5-3x4+2x3+7x2-3x+5
-x5+x4-x3
x2-x+1
x3
5)    x5-3x4+2x3+7x2-3x+5
-x5+x4-x3
/  -2x4-x3
x2-x+1
x3
6)    x5-3x4+2x3+7x2-3x+5
-x5+x4-x3
/  -2x4-x3+7x2-3x+5
x2-x+1
x3
7)    x5-3x4+2x3+7x2-3x+5
-x5+x4-x3
/  -2x4+x3+7x2-3x+5
2x4-2x3+2x2
/  -x3+9x2-3x+5
x2-x+1
x3-2x2
8)    x5-3x4+2x3+7x2-3x+5
-x5+x4-x3
/  -2x4-x3+7x2-3x+5
2x4-2x3+2x2
/  -x3+9x2-3x+5
x3 - x2+x
/   8x2-2x+5
-8x2+8x-8
/  6x-3    STOP
x2-x+1
x3-2x2-x+8   --> C(x) Quotient

Answer: p(x)=x5 - 3x4 + 2x3 + 7x2- 3x + 5 = (x2 - x + 1)(x3 - 2x2 - x + 8) + 6x - 3

Example 2
p(x)=x4+3x2+2x-8
q(x)=x2-3x

x4+0x3+3x2+2x-8
-x4+3x3
/  3x3+3x2+2x-8
-3x3+9x2
/    12x2+2x-8
-12x2+36x
/    38x-8 r(x)    STOP
x2-3x
x2+3x+12   --> C(x) Quotient

Answer: x4 + 3x2 + 2x - 8 = (x2 - 3x)(x2 + 3x + 12) + 38x - 8

## Dividing by a first-grade polynomial

It can be done by using the algorithm mentioned before, or in a faster way by using Horner's rule.
If f(x)=anxn+an-1xn-1 +...+a1x+a0, the polynomial can be written f(x)=a0+x(a1+x(a2+...+x(an-1+anx)...))

q(x) is of the first degree ⇒ q(x)=mx+n
The quotient polynomial will be of the degree n-1.

Following Horner's rule, $x_0=-\frac{n}{m}$.
bn-1=an
bn-2=x0.bn-1+an-1
bn-3=x0.bn-2+an-2
...
b1=x0.b2+a2
b0=x0.b1+a1
r=x0.b0+a0
where bn-1xn-1+bn-2xn-2+...+b1x+b0 is the quotient. The remainder will be a zero degree polynomial because the degree of the remainder must be smaller than the degree of the divisor.
Euclidean division ⇒ p(x)=q(x).c(x)+r ⇒ p(x)=(mx+n).c(x)+r if $x_0=-\frac{n}{m}$
We can observe that p(x0)=0.c(x0)+r ⇒ p(x0)=r

Example 3
p(x)=5x4-2x3+4x2-6x-7
q(x)=x-3
p(x)=-7+x(-6+x(4+x(-2+5x)))
x0=3

b3=5
b2=3.5-2=13
b1=3.13+4=43 ⇒ c(x)=5x3+13x2+43x+123; r=362
b0=3.43-6=123
r=3.123-7=362
5x4-2x3+4x2-6x-7=(x-3)(5x3+13x2+43x+123)+362

Example 4
p(x)=-2x5+3x4+x2-4x+1
q(x)=x+2
p(x)=-2x5+3x4+0x3+x2-4x+1
q(x)=x+2
x0=-2
p(x)=1+x(-4+x(1+x(0+x(3-2x))))

b4=-2          b1=(-2).(-14)+1=29
b3=(-2).(-2)+3=7     b0=(-2).29-4=-62
b2=(-2).7+0=-14     r=(-2).(-62)+1=125
⇒ c(x)=-2x4+7x3-14x2+29x-62; r=125
-2x5+3x4+x2-4x+1=(x+2)(-2x4+7x3-14x2+29x-62)+125

Example 5
p(x)=3x3-5x2+2x+3
q(x)=2x-1
$x_0=\frac{1}{2}$
p(x)=3+x(2+x(-5+3x))
b2=3
$b_1=\frac{1}{2}\cdot 3-5=-\frac{7}{2}$
$b_0=\frac{1}{2}\cdot \left(-\frac{7}{2}\right)+2=-\frac{7}{4}+2=\frac{1}{4}$
$r=\frac{1}{2}\cdot \frac{1}{4}+3=\frac{1}{8}+3=\frac{25}{8} \Rightarrow c(x)=3x^2-\frac{7}{2}x+\frac{1}{4}$
$\Rightarrow 3x^3-5x^2+2x+3=(2x-1)(3x^2--\frac{7}{2}x+\frac{1}{4})+\frac{25}{8}$
Conclusion
If we divide by a polynomial of a degree higher than one, to find out the quotient and the remainder we use steps 1-9.
If we divide by a first-degree polynomial mx+n, to find out the quotient and the remainder we use Horner's rule where $x_0=-\frac{n}{m}$.
If we only have to find out the remainder of a division by a first-degree polynomial, we find out p(x0).
Example 6
p(x)=-4x4+3x3+5x2-x+2
q(x)=x-1
x0=1
r=p(1)=-4.1+3.1+5.1-1+2=5
r=5

#### Polynomial long division - video

Feedback   Contact email: