Square-free polynomial

In mathematics, a square-free polynomial is a univariate polynomial (over a field or an integral domain) that has no multiple root in an algebraically closed field containing its coefficients. In characteristic 0, or over a finite field, a univariate polynomial is square free if and only if does not have as a divisor any square of a non-constant polynomial. In applications in physics and engineering, a square-free polynomial is commonly called a polynomial with no repeated roots.

The product rule implies that, if $p2$ divides $f$, then $p$ divides the formal derivative $f$ of $f$. The converse is also true and hence, $$f$$ is square-free if and only if $$1$$ is a greatest common divisor of the polynomial and its derivative.

A square-free decomposition or square-free factorization of a polynomial is a factorization into powers of square-free polynomials

f = a_1 a_2^2 a_3^3 \cdots a_n^n =\prod_{k=1}^n a_k^k\, $$ where those of the $a_{k}$ that are non-constant are pairwise coprime square-free polynomials (here, two polynomials are said coprime is their greatest common divisor is a constant; in other words that is the coprimality over the field of fractions of the coefficients that is considered). Every non-zero polynomial admits a square-free factorization, which is unique up to the multiplication and division of the factors by non-zero constants. The square-free factorization is much easier to compute than the complete factorization into irreducible factors, and is thus often preferred when the complete factorization is not really needed, as for the partial fraction decomposition and the symbolic integration of rational fractions. Square-free factorization is the first step of the polynomial factorization algorithms that are implemented in computer algebra systems. Therefore, the algorithm of square-free factorization is basic in computer algebra.

Over a field of characteristic 0, the quotient of $$f$$ by its greatest common divisor (GCD) with its derivative is the product of the $$a_i$$ in the above square-free decomposition. Over a perfect field of non-zero characteristic $p$, this quotient is the product of the $$a_i$$ such that $i$ is not a multiple of $p$. Further GCD computations and exact divisions allow computing the square-free factorization (see square-free factorization over a finite field). In characteristic zero, a better algorithm is known, Yun's algorithm, which is described below. Its computational complexity is, at most, twice that of the GCD computation of the input polynomial and its derivative. More precisely, if $$T_{n}$$ is the time needed to compute the GCD of two polynomials of degree $$n$$ and the quotient of these polynomials by the GCD, then $$2T_{n}$$ is an upper bound for the time needed to compute the complete square free decomposition.

There are also known algorithms for square-free decomposition of multivariate polynomials, that proceed generally by considering a multivariate polynomial as a univariate polynomial with polynomial coefficients, and applying recursively a univariate algorithm.

Yun's algorithm
This section describes Yun's algorithm for the square-free decomposition of univariate polynomials over a field of characteristic 0. It proceeds by a succession of GCD computations and exact divisions.

The input is thus a non-zero polynomial f, and the first step of the algorithm consists of computing the GCD a0 of f and its formal derivative f'.

If

f = a_1 a_2^2 a_3^3 \cdots a_k^k $$ is the desired factorization, we have thus

a_0 = a_2^1 a_3^2 \cdots a_k^{k-1}, $$

f/a_0 = a_1 a_2 a_3 \cdots a_k $$ and

f'/a_0 = \sum_{i=1}^k i a_i' a_1 \cdots a_{i-1} a_{i+1} \cdots a_k. $$

If we set $$b_1=f/a_0$$, $$c_1=f'/a_0$$ and $$d_1=c_1-b_1'$$, we get that

\gcd(b_1,d_1) = a_1, $$

b_2=b_1/a_1 = a_2 a_3 \cdots a_n, $$ and

c_2=d_1/a_1 = \sum_{i=2}^k (i-1) a_i' a_2 \cdots a_{i-1} a_{i+1} \cdots a_k. $$

Iterating this process until $$b_{k+1}=1$$ we find all the $$a_i.$$

This is formalized into an algorithm as follows:

The degree of $$c_i$$ and $$d_i$$ is one less than the degree of $$b_i.$$ As $$f$$ is the product of the $$b_i,$$ the sum of the degrees of the $$b_i$$ is the degree of $$f.$$ As the complexity of GCD computations and divisions increase more than linearly with the degree, it follows that the total running time of the "repeat" loop is less than the running time of the first line of the algorithm, and that the total running time of Yun's algorithm is upper bounded by twice the time needed to compute the GCD of $$f$$ and $$f'$$ and the quotient of $$f$$ and $$f'$$ by their GCD.

Square root
In general, a polynomial has no square root. More precisely, most polynomials cannot be written as the square of another polynomial.

A polynomial has a square root if and only if all exponents of the square-free decomposition are even. In this case, a square root is obtained by dividing these exponents by 2.

Thus the problem of deciding if a polynomial has a square root, and of computing it if it exists, is a special case of square-free factorization.