*Factoring polynomial* is an action in which polynomial is represented as a product of simpler polynomials that cannot be further factored.

Fundamental theorem of algebra says that every polynomial of degree $n$ can be represented as product of $n$ linear polynomials, but polynomials in that factorization can have complex coefficients. If we want to deal only with real numbers best we can do is represent polynomial in form of

$$p(x)=(a_1 x^2+b_1 x+ c_1)(a_2 x^2+b_2 x + c_2)\cdot…\cdot(a_k x^2 + b_k x + c_k)(x-x_1)(x-x_2)\cdot…\cdot(x-x_r),$$

where $a_1,…,a_k,b_1,…,b_k,c_1,…,c_k,x_1,…,x_r\in\mathbb{R}.$

In this lesson we will sometimes use complex numbers so it would be great if you are familiar with them but it is not necessary. If you are not familiar with complex numbers you can just skip those parts or learn about them in lesson Complex numbers.

**Remark 1 **Some of the factors $(a_j x^2 + b_j x + c_j)$ or $(x-x_i)$ in the representation above can appear multiple times. (See definition of multiplicity in lesson Fundamental theorem of algebra)

In other words, maximum factorization using only real numbers can contain quadratic polynomials as factors.

To understand this better let’s look at next example.

**Example 1 **Factor polynomial $p(x)=x^3-2x^2+x-2.$

$$x^3-2x^2+x-2=x^2(x-2)+(x-2)=(x-2)(x^2+1)$$

This is the best we can do if we don’t want to use complex numbers. To factor it further we find roots of $x^2+1$, $\pm i$, and factor it as $(x+i)(x-i)$ and then factor $(x-2)(x^2+1)$ to $(x-2)(x+i)(x-i)$.

As we saw in previous example, there are polynomials, such as $x^2+1$, that cannot be further factored using just real numbers, but can be further factored when using complex numbers.

For factorization of polynomials you should be familiar with some basic, but very useful formulas which you can find in lesson Determining polynomials, basic math operations, the most important rules for multiplying in section Multiplication.

So how do we factor polynomials? There is no universal rule here, but there are some tricks that can help you.

First thing you should do is see if there is something common to all terms of your expression and if there is, extract it. For example, in polynomial $x^3+3x^2-x$ $x$ is common to all terms so we can extract it: $x^3+3x^2-x=x(x^2+3x-1)$.

**Example 2** Factor polynomial $p(x)=x^2 + 4x$.

$x$ is common to both terms so we extract it:

$$\ x^2 + 4x = x\cdot x+x\cdot 4=x(x + 4)$$

How do you check if your factorization is correct? Simply multiply those factors and you should get expression you started with:

$$\ x(x + 4) = x\cdot x + x\cdot 4 = x^2 + 4x$$

**Example 3** Factor polynomial $p(x)=4x^4 + 4x^3 – 24x^2$

First we extract $4x^2$ from every term:

$$4x^4 + 4x^3 – 24x^2=4x^2\cdot x^2+ 4x^2\cdot x – 4x^2\cdot 6=4x^2(x^2+x-6)$$

Now we factor $x^2+x-6$. To do that first we write $x$ as $3x-2x$:

$$x^2+x-6=x^2+3x-2x-6$$

Next step is to group terms in a way that allows us to extract more:

$$x^2+3x-2x-6=(x^2+3x)-(2x+6)$$

and then we extract $x$ from the first term and $2$ from second term:

$$(x^2+3x)-(2x+6)=x(x+3)-2(x+3)$$

Now we extract common term $x+3$ and we are done:

$$x(x+3)-2(x+3)=(x+3)(x-2)$$

So, $4x^4 + 4x^3 – 24x^2=4x^2(x+3)(x-2)$.

Useful thing to know is how to factor quadratic polynomial if we know its roots.

If $x_1$ and $x_2$ are roots of quadratic polynomial $p(x)=x^2+bx+c$ then it can be factored as $(x-x_1)(x-x_2)$.

**Remark 2** Note that leading coefficient (one that is multiplying $x^2$) in polynomial above is $1$. If it isn’t, that is $p(x)=ax^2+bx+c$ you extract $a$ to get $p(x)=a(x^2+\frac{b}{a} x + \frac{c}{a})$ and then find roots $x_1$ and $x_2$ of polynomial $q(x):=x^2+\frac{b}{a} x + \frac{c}{a}$ and write it as $q(x)=(x-x_1)(x-x_2)$. Then you can write $p$ as $p(x)=a(x-x_1)(x-x_2)$

**Example 4** Factor polynomial $p(x)=x^2-x-20$.

Using formula for roots of quadratic polynomial we obtain roots of $p$:

$$x_{1,2}=\frac{-(-1) \pm \sqrt[]{(-1)^2-4\cdot1\cdot(-20)}}{2\cdot 1}$$

$$x_1=-4, x_2=5$$

Now we write $p$ as $p(x)=(x-5)(x+4)$. You can easily check that $(x-5)(x+4)=x^2-x-20$.

**Example 5** Factor polynomial $p(x)=2x^2-2x-4$

First we extract $2$, $2x^2-2x-4=2(x^2-x-2)$. Then we find roots $x_1=-1$ and $x_2=2$ of polynomial $x^2-x-2$ and write it as $(x-2)(x+1)$. Now we can write $p$ as $p(x)=2(x-2)(x+1)$. Again, you can easily check that $2(x-2)(x+1)=2x^2-2x-4$.

You can learn more about quadratic polynomials in lesson Quadratic equations.

**Example 6 **Factor polynomial $p(x)=x^4-x^3+2x^2-4x-8$.

$$x^4-x^3+2x^2-4x-8=x^4-x^3+2x^2-4x-8=$$

$$x^4+4x^2-2x^2-8-x^3-4x=x^2(x^2+4)-2(x^2+4)-x(x^2+4)=$$

$$(x^2+4)(x^2-x-2)=(x-2i)(x+2i)(x-2)(x+1)$$

where in last equality we used fact that $-2$ and $1$ are roots of $x^2-x-2$ and $\pm i$ are roots of $x^2+4$.

Sometimes it can be pretty hard to see how to group terms of polynomial to allow extraction, but you can help yourself with using Bézout’s theorem: you guess some root $x_1$ of given polynomial then divide polynomial with $(x-x_1)$. That way you will have to deal with polynomial with lesser degree and maybe it will be simpler. About division of polynomials you can learn in lesson Determining polynomials, basic math operations, the most important rules for multiplying in section Division.

In example above we see that $-1$ is root of given polynomial $p$ (because $(-1)^4-(-1)^3+2\cdot (-1)^2-4\cdot (-1)-8=0$) so we divide it with linear polynomial $x-(-1)=x+1$:

$$(x^4-x^3+2x^2-4x-8):(x+1)=x^3-2x^2+4x-8$$

So $x^4-x^3+2x^2-4x-8$ can be written as $(x^3-2x^2+4x-8)(x+1)$ and we just have to factor $x^3-2x^2+4x-8$:

$$x^3-2x^2+4x-8=(x^3-2x^2)+(4x-8)=x^2(x-2)+4(x-2)=(x^2+4)(x-2)=(x-2i)(x+2i)(x-2).$$

To easier guess roots of polynomials you can use Integer solutions of a polynomial function theorem, The Rational Root Theorem and The Irrational Root Theorem.

**Example 7 **Factor polynomial $p(x)=2x^4+ x^3- 4 x^2+ x-6$.

By Integer solutions of a polynomial function theorem if $p$ has integer roots they are divisors of 6, so potential candidates for roots are $-6,-3,-2,-1,1, 2, 3$ and $6$.

$$2\cdot 1^4+ 1^3- 4\cdot 1^2+ 1-6=-6$$ so 1 is not root.

$$2\cdot (-1)^4+ (-1)^3- 4\cdot (-1)^2+ (-1)-6=-10$$ so -1 is not root.

$$2\cdot 2^4+ 2^3- 4\cdot 2^2+ 2-6=20$$ so 2 is not root.

$$2\cdot (-2)^4+ (-2)^3- 4\cdot (-2)^2+ (-2)-6=0$$ so -2 is root.

Now we divide $p$ with $x+2$ and write it as

$$p(x)=(x+2)(2 x^3- 3 x^2 +2 x-3).$$

Lets check if $i$ is root of $q(x):=2 x^3- 3 x^2 +2 x-3$:

$$2 i^3- 3 i^2 +2 i-3=2(-i)-3(-1)+2i-3=0$$ so $i$ is root.

By Irrational Root Theorem then follows that $-i$ is also root of $q$. But then by Bézout’s theorem $(x-i)$ and $(x+i)$ both divide $q$ so their product $(x-i)(x+i)=x^2+1$ also divides $q$ and we calculate

$$q(x)=(x^2+1)(x-3).$$

Finally, we write $p$ as

$$p(x)=(x+2)(x^2+1)(x-3)=(x+2)(x-i)(x+i)(x-3).$$

Polynomials we were factoring so far were polynomials in one variable. We can similarly factor polynomials with more variables.

**Example 8 **Factor polynomial $p(x)=x^2 y + xy^2 + 4xy$.

We see that factor $xy$ is common to all terms so we extract it:

$$ x^2 y + xy^2 + 4xy = xy(x + y + 4).$$

**Example 9** Factor polynomial $p(x)=x^3 + x^2+ 2 x y + 2 x^2 y + x y^2 + y^2 $

First we need to appropriately group terms to allow extraction:

$$x^3 + x^2+ 2 x y + 2 x^2 y + x y^2 + y^2=(x^3+2x^2y+xy^2)+(x^2+2xy+y^2)$$

From first term we can extract $x$ and for second term we can use formula for square of sum to write it as $(x+y)^2$:

$$(x^3+2x^2y+xy^2)+(x^2+2xy+y^2)=x(x^2+2xy+y^2)+(x+y)^2$$

Using formula for square of sum again in the first term and then extracting common factor $(x+y)^2$ we obtain:

$$x(x^2+2xy+y^2)+(x+y)^2=x(x+y)^2+(x+y)^2=(x+y)^2(x+1).$$

**Example 10** Factor polynomial $p(x)=x^3+x-xy^2-y$

$$x^3+x-xy^2-y=(x^3-xy^2)+(x-y)=x(x^2-y^2)+(x-y)=x(x+y)(x-y)+(x-y)=$$

$$(x-y)(x(x+y)+1)=(x-y)(x^2+xy+1)$$

where we used formula for difference of squares in third equality to write $x^2-y^2$ as $(x+y)(x-y)$.

As we mentioned before, there is no general algorithm for factoring polynomials. Every polynomial is new problem and often there is more than one way to final factorization. We have showed you here some tricks that could help you but the best way to learn how to factor is practice. With practice you will get some intuition on how to group terms and what trick can help you with particular polynomial.