# Factorization

The polynomial x2 + cx + d, where a + b = c and ab = d, can be factorized into (x + a)(x + b).

In mathematics, factorization (also factorisation in British English) or factoring is the decomposition of an object (for example, a number, a polynomial, or a matrix) into a product of other objects, or factors, which when multiplied together give the original. For example, the number 15 factors into primes as 3 × 5, and the polynomial x2 − 4 factors as (x − 2)(x + 2). In all cases, a product of simpler objects is obtained.

The aim of factoring is usually to reduce something to “basic building blocks”, such as numbers to prime numbers, or polynomials to irreducible polynomials. Factoring integers is covered by the fundamental theorem of arithmetic and factoring polynomials by the fundamental theorem of algebra. Viète's formulas relate the coefficients of a polynomial to its roots.

The opposite of polynomial factorization is expansion, the multiplying together of polynomial factors to an “expanded” polynomial, written as just a sum of terms.

Integer factorization for large integers appears to be a difficult problem. There is no known method to carry it out quickly. Its complexity is the basis of the assumed security of some public key cryptography algorithms, such as RSA.

A matrix can also be factorized into a product of matrices of special types, for an application in which that form is convenient. One major example of this uses an orthogonal or unitary matrix, and a triangular matrix. There are different types: QR decomposition, LQ, QL, RQ, RZ.

Another example is the factorization of a function as the composition of other functions having certain properties; for example, every function can be viewed as the composition of a surjective function with an injective function. This situation is generalized by factorization systems.

## Integers

By the fundamental theorem of arithmetic, every positive integer greater than 1 has a unique prime factorization. Given an algorithm for integer factorization, one can factor any integer down to its constituent primes by repeated application of this algorithm.[1] For very large numbers, no efficient algorithm is known.

## Polynomials

Any quadratic polynomial over the complex numbers (polynomials of the form $ax^2+bx+c$ where $a$, $b$, and $c$$\mathbb{C}$) can be factored into an expression with the form $a(x - \alpha)(x - \beta) \$ using the quadratic formula. The method is as follows:

\begin{align} ax^2 + bx + c & = a(x - \alpha)(x - \beta) \\ & = a\left(x - \frac{-b + \sqrt{b^2-4ac}}{2a}\right) \left(x - \frac{-b - \sqrt{b^2-4ac}}{2a}\right), \end{align}

where $\alpha$ and $\beta$ are the two roots of the polynomial, found with the quadratic formula.

#### Polynomials factorable over the integers

Quadratic polynomials can sometimes be factored into two binomials with simple integer coefficients by use of Vieta's formulas, without the need to use the quadratic formula. In a quadratic equation, this will expose its two roots. The formula

$ax^2+bx+c,\,\!$

would be factored into:

$(mx+p)(nx+q),\,\!$

where

$mn = a,\ pq = c\,\!$

and

$pn + mq = b. \,$

Each binomial can then be set equal to zero, and solving for x reveals the two roots.

Consider for example 2x2 − 5x + 2 = 0. Because a = 2 and mn = a, mn = 2, which means that of m and n, one is 1 and the other is 2. Now we have (2x + p)(x + q) = 0. Because c = 2 and pq = c, pq = 2, which means that of p and q, one is 1 and the other is 2 or one is −1 and the other is −2. A guess and check of substituting the 1 and 2, and −1 and −2, into p and q (while applying pn + mq = b) tells us that 2x2 − 5x + 2 = 0 factors into (2x − 1)(x − 2) = 0, giving us the roots x = {0.5, 2}.

Note: A quick way to check whether the second term in the binomial should be positive or negative (in the example, 1 and 2 and −1 and −2) is to check the second operation in the trinomial (+ or −). If it is +, then check the first operation: if it is +, the terms will be positive, while if it is −, the terms will be negative. If the second operation is −, there will be one positive and one negative term; guess and check is the only way to determine which one is positive and which is negative.

If a polynomial with integer coefficients has a discriminant that is a perfect square, that polynomial is factorable over the integers. For example, consider the polynomial 2x2 + 2x − 12. If the values of the expression are substituted into the quadratic formula, the discriminant b2 − 4ac becomes 22 − (4 × 2 × (−12)), which equals 100. 100 is a perfect square, so the polynomial 2x2 + 2x − 12 is factorable over the integers; its factors are 2, (x − 2), and (x + 3).

Now consider the polynomial x2 + 93x − 2. Its discriminant, 932 − 4 × 1 × (−2), is equal to 8657, which is not a perfect square. So x2 + 93x − 2 cannot be factored over the integers.

#### Perfect square trinomials

A visual illustration of the identity (a + b)2 = a2 + 2ab + b2

Some quadratics can be factored into two identical binomials. These quadratics are called perfect square trinomials. Perfect square trinomials can be factored as follows:

$a^2 + 2ab + b^2 = (a + b)^2,\,\!$

and

$a^2 - 2ab + b^2 = (a - b)^2.\,\!$

#### Sum/difference of two squares

Another common type of algebraic factoring is called the difference of two squares. It is the application of the formula

$a^2 - b^2 = (a+b)(a-b),\,\!$

to any two terms, whether or not they are perfect squares. If the two terms are subtracted, simply apply the formula. If they are added, the two binomials obtained from the factoring will each have an imaginary term. This formula can be represented as

$a^2 + b^2 = (a+bi)(a-bi). \,\!$

For example, $4x^2 + 49$ can be factored into $(2x + 7i)(2x - 7i)$.

#### Factoring by grouping

Another way to factor some polynomials is factoring by grouping. For those who like algorithms, “factoring by grouping” may be the best way to approach factoring a trinomial, as it takes the guess work out of the process.

Factoring by grouping is done by placing the terms in the polynomial into two or more groups, where each group can be factored by a known method. The results of these factorizations can sometimes be combined to make an even more simplified expression. For example, to factor the polynomial

$4x^2+20x+3yx+15y \,$

Group similar terms, $(4x^2+20x)+(3yx+15y)\,$

Factor out greatest common factor, $4x(x+5)+3y(x+5)\,$

Factor out binomial $(x+5)(4x+3y)\,$

#### AC Method

If a quadratic polynomial has rational solutions, we can find p and q so that pq = ac and p + q = b. (If the discriminant is a square number these exist, otherwise we have irrational or complex solutions, and the assumption of rational solutions is not valid.)

\begin{align} ax^2 + bx + c & = \frac{a^2x^2 + abx + ac}{a} & = \frac{(ax+p)(ax+q)}{a} \end{align}

The terms on top will have common factors that can be factored out and used to cancel the denominator, if it is not 1. As an example consider the quadratic polynomial:

\begin{align} 6x^2 + 13x + 6 \end{align}

Inspection of the factors of ac = 36 leads to 4 + 9 = 13 = b.

\begin{align} 6x^2 + 13x + 6 & = \frac{(6x+4)(6x+9)}{6} \\ &= \frac{2(3x+2)(3)(2x+3)}{6} \\ &= (3x+2)(2x+3) \end{align}

### Factoring other polynomials

#### Sum/difference of two cubes

A visual representation of the factorization of cubes using volumes. For a sum of cubes, simply substitute z=-y.

Another formula for factoring is the sum or difference of two cubes. The sum can be represented by

$a^3 + b^3 = (a + b)(a^2 - ab + b^2),\,\!$

and the difference by

$a^3 - b^3 = (a - b)(a^2 + ab + b^2).\,\!$

#### Difference of two fourth powers

Another formula is the difference of two fourth powers, which is

$a^4 - b^4 = (a^2 + b^2)(a + b)(a - b).\,\!$
• This formula is derivable from the difference-of-two-squares formula by treating a4 and b4 as the squares of a2 and b2, respectively; applying the difference-of-two squares formula in factoring (a4 - b4) into ([a2 + b2] · [a2 - b2]); and reapplying the difference-of-two-squares formula to the second factor, thereby restating the overall expression as ([a2 + b2] · [a + b] · [a - b]).

#### Sum/difference of two fifth powers

Another formula for factoring is the sum or difference of two fifth powers. The sum can be represented by

$a^5 + b^5 = (a + b)(a^4 - a^3 b + a^2 b^2 - a b^3 + b^4),\,\!$

and the difference by

$a^5 - b^5 = (a - b)(a^4 + a^3 b + a^2 b^2 + a b^3 + b^4).\,\!$

(Both of these can be factored further, but not with integer coefficients.)

#### Sum/difference of two sixth powers

Then there's the formula for factoring the sum or difference of two sixth powers. The sum can be represented by

$a^6 + b^6 = (a^2 + b^2)(a^4 - a^2 b^2 + b^4),\,\!$

and the difference by

$a^6 - b^6 = (a + b)(a - b)(a^2 - ab + b^2)(a^2 + ab + b^2).\,\!$

#### Sum/difference of two seventh powers

And last there’s the formula for factoring the sum or difference of two seventh powers. The sum can be represented by

$a^7 + b^7 = (a + b) (a^6 - a^5 b + a^4 b^2 - a^3 b^3 + a^2 b^4 - a b^5 + b^6),\,\!$

and the difference by

$a^7 - b^7 = (a - b)(a^6 + a^5 b + a^4 b^2 + a^3 b^3 + a^2 b^4 + a b^5 + b^6).\,\!$

#### Sum/difference of two nth powers

The above factorization of differences of powers can be extended to any positive integer power n by use of the geometric series. By noting that

$x^{n-1} + x^{n-2} + \ldots + x + 1 = \frac{x^n -1}{x-1},$

and multiplying by the (x − 1) factor, the desired result is found. To give the general form as above, we can replace x by a/b and multiply both sides by bn. This gives the general form for the difference of two nth powers as

$a^n - b^n = (a-b)(a^{n-1} + ba^{n-2} + b^2 a^{n-3} + \ldots + b^{n-2} a + b^{n-1} ).\!$

The corresponding sum of two nth powers depends on whether n is even or odd. If n is odd, b can be replaced by −b in the above formula, to give

$a^n + b^n = (a+b)(a^{n-1} - ba^{n-2} + b^2 a^{n-3} - \ldots - b^{n-2} a + b^{n-1} ).\!$

If n is even, we consider two cases:

1. If n is a power of 2

$a^n + b^n\!$

is unfactorable.

2.Let n equal

$m \cdot 2^k, m>1, k \neq 0\!$

where m is odd.

Then, the expression can be written

$a^{m \cdot 2^k} + b^{m \cdot 2^k}.\!$

Now, the general factorization is

$a^n + b^n = (a^{2^k} + b^{2^k})(a^{n-2^k} - a^{n-2 \cdot 2^k} b^{2^k} + a^{n-3 \cdot 2^k} b^{2 \cdot 2^k} - \ldots - a^{2^k} b^{n-2 \cdot 2^k} + b^{n-2^k}) = (a^{2^k} + b^{2^k}) \sum_{i=1}^m a^{(m-i)2^k}(-b^{2^k})^{i-1}.\!$

#### Other factorization formulae

$x^3 + y^3 + z^3 - 3xyz = (x + y + z)(x^2 + y^2 + z^2 - xy - xz - yz).\!$