Square-free factorization of polynomials

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


polylib::sqrfree(f, <recollect>)


polylib::sqrfree(f) returns the square-free factorization of f, that is, a factorization of f in the form f = up1e1 … prer with primitive and pairwise different square-free divisors pi.

polylib::sqrfree(f) returns the square-free factorization of the polynomial f, that is, a factorization of f in the form f = uf1e1 … frer with primitive and pairwise different square-free divisors fi (i.e., gcd(fi, fj) = 1 for ij).

u is a unit of the coefficient ring of f, and ei are positive integers.

The result of polylib::sqrfree is an object of the domain type Factored. Let g:= polylib::sqrfree(f) be such an object. It is represented internally as the list [u, f1, e1, ..., fr, er] of odd length 2 r + 1.

You may extract the unit u and the terms fiei by the ordinary index operator [ ], i.e., g[1] = u, g[2] = f1^e1, g[2] = f2^e2, ....

The calls Factored::factors(g) and Factored::exponents(g) return a list of the factors fi and the exponents ei (1 ≤ ir), respectively. The call convert(g, DOM_LIST) gives the internal representation of a factored object, i.e., the list [u, f1, e1, ..., fr, er].

Note that the result of polylib::sqrfree is printed as an expression and behaves like that. As an example, the result of polylib::sqrfree(x^2+2*x+1) is the object printed as (x+1)^2 which is of type "_power".

Please read the help page of Factored for details.

The call polylib::sqrfree(f, FALSE) returns a square-free factorization of f, where the exponents ei need not be pairwise different.

polylib::sqrfree can handle univariate and multivariate polynomials over Expr, residue class rings IntMod(p) with prime modulus p, domains representing a unique factorization domain of characteristic zero, and finite fields.

If the argument of polylib::sqrfree is an expression, its numerator and denominator are converted into polynomials in all occurring indeterminates.

These polynomials are regarded as polynomials over some extension of the rational numbers (i.e., over Expr, see poly). The choice of that extension follows the same rules as in the case of the function factor.

Factors of the denominator of an expression are indicated by negative multiplicities.


Example 1

The factors in a squarefree factorization are pairwise relatively prime, but they need not be irreducible:

  2 - 2*x - 6*x^4 + 6*x^5 + 6*x^8 - 6*x^9 -2*x^12 + 2*x^13

Example 2

Even if a factorization into irreducibles has been found, irreducible factors with the same multiplicity are collected again:

polylib::sqrfree(x^6 + x^4*y*6 + x^2*y^2*9)

You can avoid this by giving a second argument:

polylib::sqrfree(x^6 + x^4*y*6 + x^2*y^2*9, FALSE)

Example 3

polylib::sqrfree works also for polynomials:

polylib::sqrfree(poly(2 + 5*x + 4*x^2 + x^3))



A polynomial or an arithmetical expression



Return Values

Factored object, i.e., an object of the domain type Factored.

See Also

MuPAD Functions