Compute a partial fraction decomposition

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


partfrac(f, <x>)
partfrac(f, x, options)


partfrac(f, x) returns the partial fraction decomposition of the rational expression f with respect to the variable x.

Consider the rational expression with polynomials g, p, q satisfying degree (p) < degree(q). Here, q = denom(f) is the denominator of f, and g, p, given by (g, p) =divide(numer(f), q, [x]), are the quotient and the remainder of the polynomial division of the numerator of f by the denominator q. Let

be a factorization of the denominator into nonconstant and pairwise coprime polynomials qi with integer exponents ei. The partial fraction decomposition based on this factorization is a representation

with polynomials pi, j satisfying degree( pi , j) < degree ( qi]). In particular, the polynomials pi, j are constant if qi is a linear polynomial.

partfrac uses the factors qi of q = denom(f) found by the function factor. The factorization is computed over the field implied by the coefficients of the denominator (see factor for details). See Example 2.

If f has only one indeterminate and you do not use options, the second argument x in a call to partfrac can be omitted. Otherwise, you must specify the indeterminate as a second parameter.

The partial fraction decomposition can also be computed for expressions that are rational with respect to a symbolic function call. This function call must be specified as the indeterminate. See Example 3.

MuPAD® factorizes the denominator by calling factor with the given values of the options MaxDegree, Adjoin, and Domain. See the factor help page for further details on these options. In particular, the factorization can be performed numerically. See Example 5.

The option Full invokes a full factorization of the denominator into linear factors. In this case, the option MaxDegree determines whether the roots of the polynomial are expressed in terms of RootOf or in terms of radicals (see the solve help page). Roots belonging to an irreducible factor of the denominator of degree five or larger cannot be expressed in terms of radicals in general. If some roots are expressed in terms of RootOf, the partial fraction decomposition contains a symbolic sum running over these roots. See Example 6.


Example 1

In the following calls, there is no need to specify an indeterminate because the rational expressions are univariate:

partfrac(x^2/(x^3 - 3*x + 2))

partfrac(23 + (x^4 + x^3)/(x^3 - 3*x + 2))

partfrac(x^3/(x^2 + 3*I*x - 2))

The following expression contains two indeterminates x and y. One has to specify the variable with respect to which the partial fraction decomposition shall be computed:

f := x^2/(x^2 - y^2):
partfrac(f, x), partfrac(f, y)

delete f:

Example 2

The following example demonstrates the dependence of the partial fraction decomposition on the function factor:

partfrac(1/(x^2 - 2), x)

Note that the denominator x2 - 2 does not factor over the rational numbers:

factor(x^2 - 2)

However, it factors over the extension containing . In the following calls, this extended coefficient field is implicitly assumed by factor and, consequently, by partfrac:

factor(sqrt(2)*x^2 - 2*sqrt(2))

partfrac(x/(sqrt(2)*x^2 - 2*sqrt(2)), x)

An extension of the coefficient field may also be enforced using the option Adjoin:

partfrac(1/(x^2 - 2), x, Adjoin = [sqrt(2)])

Example 3

Rational expressions of symbolic function calls may also be decomposed into partial fractions:

partfrac(1/(sin(x)^4 - sin(x)^2 + sin(x) - 1), sin(x))

Example 4

Use List to return a list consisting of the numerators and denominators of the partial fraction decomposition:

partfrac(x^2/(x^3 - 3*x + 2), x, List)

Example 5

The denominator can also be factored numerically over R_ or C_:

partfrac(1/(x^3 - 2), x, Domain = R_)

partfrac(1/(x^3 - 2), x, Domain = C_)

Example 6

Use Full to factorize the denominator into linear factors symbolically:

partfrac(1/(x^3 + x - 2), x, Full)

For irreducible denominators of degree at least 3, the partial fraction decomposition is a symbolic sum over the roots:

S:= partfrac(1/(x^3 + x - 3), x, Full)

MuPAD uses the freeze function to keep the result in the form of an unevaluated symbolic sum. To evaluate this symbolic sum, use unfreeze. Evaluating this symbolic sum simplifies it back to the original input:

unfreeze(S); delete S:



A rational expression in x


The indeterminate: typically, an identifier or an indexed identifier



Factor the denominator completely into linear factors, and perform a partial fraction decomposition with respect to that factorization.


Return a list consisting of the numerators and denominators of the partial fraction decomposition.


Option, specified as MaxDegree = n

Adjoin only coefficients of the denominator, the algebraic degree of which does not exceed n to the field over which the denominator is factored, and (in case the option Full is also given) do not use explicit formulas involving radicals to solve polynomial equations of degree larger than n.


Option, specified as Adjoin = adjoin

Factor the denominator over the smallest field containing the rational numbers, all coefficients of the denominator, and the elements of adjoin.


Option, specified as Domain = d

Factor the denominator over the domain d, where d is Expr, R_, or C_. By default, d = Expr. For more details, see the factor help page.


Option, specified as Mapcoeffs = mp

When building the resulting expression, for each coefficient c, insert mp(c) instead.

Overloaded By


Was this topic helpful?