Partial Fractions

Integration is facilitated when an antiderivative for $f$ can be found, as then definite integrals can be evaluated through the fundamental theorem of calculus.

However, despite integration being an algorithmic procedure, integration is not. There are "tricks" to try, such as substitution and integration by parts. These work in some cases. However, there are classes of functions for which algorithms exist. For example, the SymPy integrate function implements an algorithm that decides if an elementary function has an antiderivative. The elementary functions include exponentials, their inverses (logarithms), trigonometric functions, their inverses, and powers, including $n$th roots. Not every elementary function will have an antiderivative comprised of (finite) combinations of elementary functions. The typical example is $e^{x^2}$, which has no simple antiderivative, despite its ubiquitousness.

There are classes of functions where an (elementary) antiderivative can always be found. Polynomials provide a case. More surprisingly, so do their ratios, rational functions.

Partial fraction decomposition

Let $f(x) = p(x)/q(x)$, where $p$ and $q$ are polynomial functions. Further, we assume without comment that $p$ and $q$ have no common factors. (If they did, we can divide them out, an act which has no effect on the integrability of $f(x)$.

The function $q(x)$ will factor over the real numbers. The fundamental theorem of algebra can be applied to say that $q(x)=q_1(x)^{n_1} \cdots q_k(x)^{n_k}$ where $q_i(x)$ is a linear or quadratic polynomial and $n_k$ a positive integer.

Partial Fraction Decomposition: There are unique polynomials $a_{ij}$ with degree $a_{ij} <$ degree $q_i$ such that $~ \frac{p(x)}{q(x)} = a(x) + \sum_{i=1}^k \sum_{j=1}^{n_i} \frac{a_{ij}(x)}{q_i(x)^j}. ~$

The method is attributed to John Bernoulli, one of the prolific Bernoulli brothers who put a stamp on several areas of math. This Bernoulli was a mentor to Euler.

This basically says that each factor $q_i(x)^{n_i}$ contributes a term like:

\[ ~ \frac{a_{i1}}{q_i(x)^1} + \frac{a_{i2}}{q_i(x)^2} + \cdots + \frac{a_{in_i}}{q_i(x)^{n_i}}, ~ \]

where each $a_{ij}$ has degree less than the degree of $q_i$.

The value of this decomposition is that the terms $a_{ij}(x)/q_i(x)^j$ each have an antiderivative, and so the sum of them will also have an antiderivative.

In SymPy, the apart function will find the partial fraction decomposition. For example, here we see $n_i$ terms for each power of $q_i$

using CalculusWithJulia  # loads `SymPy`
@vars a b c A B x real=true
(a, b, c, A, B, x)
apart((x-2)*(x-3) / (x*(x-1)^2*(x^2 + 2)^3))
\begin{equation*}- \frac{8 x - 13}{9 \left(x^{2} + 2\right)^{3}} - \frac{35 x - 34}{54 \left(x^{2} + 2\right)^{2}} - \frac{45 x - 28}{108 \left(x^{2} + 2\right)} - \frac{1}{3 \left(x - 1\right)} + \frac{2}{27 \left(x - 1\right)^{2}} + \frac{3}{4 x}\end{equation*}

Sketch of proof

A standard proof uses two facts of number systems: the division algorithm and a representation of the greatest common divisor in terms of sum, extended to polynomials. Our sketch shows how these are used.

Take one of the factors of the denominators, and consider this representation of the rational function $P(x)/(q(x)^k Q(x))$ where there are no common factors to any of the three polynomials.

Since $q(x)$ and $Q(x)$ share no factors, Bezout's identity says there exists polynomials $a(x)$ and $b(x)$ with:

\[ ~ a(x) Q(x) + b(x) q(x) = 1. ~ \]

Then dividing by $q^k(x)Q(x)$ gives the decomposition

\[ ~ \frac{1}{q(x)^k Q(x)} = \frac{a(x)}{q(x)^k} + \frac{b(x)}{q(x)^{k-1}Q(x)}. ~ \]

So we get by multiplying the $P(x)$:

\[ ~ \frac{P(x)}{q(x)^k Q(x)} = \frac{A(x)}{q(x)^k} + \frac{B(x)}{q(x)^{k-1}Q(x)}. ~ \]

This may look more complicated, but what it does is peel off one term (The first) and leave something which is smaller, in this case by a factor of $q(x)$. This process can be repeated pulling off a power of a factor at a time until nothing is left to do.

What remains is to establish that we can take $A(x) = a(x)\cdot P(x)$ with a degree less than that of $q(x)$.

In Proposition 3.8 of Bradley and Cook it is shown how an expression of the form $A(x)/a(x)^k$ can be written as $q_1(x) + r_k(x)/a(x)^k + \cdots + r_2(x)/a(x)^2 + r_1(x)/a(x)$ with the degree of each $r_i(x)$ less than that of $a(x)$ by repeated application of the division algorithm. This fact can be used to finish the proof.

To generate the $r_1$, $r_2$, $\dots$, $r_k$, the division algorithm is applied $k$ times giving: $A=aq_k + r_k$, $q_k = a q_{k-1} + r_{k-1}$, $\dots$, $q_2 = a q_1 + r_1$. These are put together to show $A/a^k=q_1 + r_k/a^k + r_{k-1}/a^{k-1} + \cdots + r_2/a^2 + r_1/a$.

Integrating the terms in a partial fraction decomposition

We discuss by example how each type of possible terms in a partial fraction decomposition has an antiderivative. Hence, rational functions will always have an antiderivative that can be computed.

Linear factors

For $j=1$, if $q_i$ is linear, then $a_{ij}/q_i^j$ must look like a constant over a linear term, or something like:

p = a/(x-c)
\begin{equation*}\frac{a}{- c + x}\end{equation*}

This has a logarithmic antiderivative:

integrate(p, x)
\begin{equation*}a \log{\left(- c + x \right)}\end{equation*}

For $j > 1$, we have powers.

@vars j positive=true
integrate(a/(x-c)^j, x)
\begin{equation*}a \left(\begin{cases} \frac{\left(- c + x\right)^{1 - j}}{1 - j} & \text{for}\: j \neq 1 \\\log{\left(- c + x \right)} & \text{otherwise} \end{cases}\right)\end{equation*}

Quadratic factors

When $q_i$ is quadratic, it looks like $ax^2 + bx + c$. Then $a_{ij}$ can be a constant or a linear polynomial. The latter can be written as $Ax + B$.

Rather than try to consider the general case of

\[ ~ \frac{Ax +B }{(ax^2 + bx + c)^j}, ~ \]

which can be handled, it is best to shift the value of $x$ so that this is no more than a constant times:

\[ ~ \frac{Ax + B}{((ax)^2 \pm 1)^j} ~ \]

This can be done by finding a $d$ so that $a(x-d)^2 + b(x-d) + c = dx^2 + e = e((\sqrt{d/e}x^2 \pm 1)$.

The integrals of the type $Ax/((ax)^2 \pm 1)$ can completed by $u$-substitution, with $u=(ax)^2 \pm 1$.

For example,

integrate(A*x/((a*x)^2 + 1)^4, x)
\begin{equation*}- \frac{A}{6 a^{8} x^{6} + 18 a^{6} x^{4} + 18 a^{4} x^{2} + 6 a^{2}}\end{equation*}

The integrals of the type $B/((ax)^2\pm 1)$ are completed by trigonometric substitution and various reduction formulas. They can get involved, but are tractable. For example:

integrate(B/((a*x)^2 + 1)^4, x)
\begin{equation*}B \left(\frac{15 a^{4} x^{5} + 40 a^{2} x^{3} + 33 x}{48 a^{6} x^{6} + 144 a^{4} x^{4} + 144 a^{2} x^{2} + 48} + \frac{5 \operatorname{atan}{\left(a x \right)}}{16 a}\right)\end{equation*}


integrate(B/((a*x)^2 - 1)^4, x)
\begin{equation*}B \left(- \frac{15 a^{4} x^{5} - 40 a^{2} x^{3} + 33 x}{48 a^{6} x^{6} - 144 a^{4} x^{4} + 144 a^{2} x^{2} - 48} - \frac{5 \log{\left(x - \frac{1}{a} \right)}}{32 a} + \frac{5 \log{\left(x + \frac{1}{a} \right)}}{32 a}\right)\end{equation*}


Find an antiderivative for $1/(x\cdot(x^2+1)^2)$.

We have a partial fraction decomposition is:

q = (x * (x^2 + 1)^2)
\begin{equation*}- \frac{x}{x^{2} + 1} - \frac{x}{\left(x^{2} + 1\right)^{2}} + \frac{1}{x}\end{equation*}

We see three terms. The first and second will be done by $u$-substitution, the third by a logarithm:

integrate(1/q, x)
\begin{equation*}\log{\left(x \right)} - \frac{\log{\left(x^{2} + 1 \right)}}{2} + \frac{1}{2 x^{2} + 2}\end{equation*}

Find an antiderivative of $1/(x^2 - 2x-3)$.

We again just let SymPy do the work. A partial fraction decomposition is given by:

q =  (x^2 - 2x - 3)
\begin{equation*}- \frac{1}{4 \left(x + 1\right)} + \frac{1}{4 \left(x - 3\right)}\end{equation*}

We see what should yield two logarithmic terms:

integrate(1/q, x)
\begin{equation*}\frac{\log{\left(x - 3 \right)}}{4} - \frac{\log{\left(x + 1 \right)}}{4}\end{equation*}



The partial fraction decomposition of $1/(x(x-1))$ must be of the form $A/x + B/(x-1)$.

What is $A$? (Use SymPy or just put the sum over a common denominator and solve for $A$ and $B$.)

What is $B$?


The following gives the partial fraction decomposition for a rational expression:

\[ ~ \frac{3x+5}{(1-2x)^2} = \frac{A}{1-2x} + \frac{B}{(1-2x)^2}. ~ \]

Find $A$ (being careful with the sign):

Find $B$:


The following specifies the general partial fraction decomposition for a rational expression:

\[ ~ \frac{1}{(x+1)(x-1)^2} = \frac{A}{x+1} + \frac{B}{x-1} + \frac{C}{(x-1)^2}. ~ \]

Find $A$:

Find $B$:

Find $C$:


Compute the following exactly:

\[ ~ \int_0^1 \frac{(x-2)(x-3)}{(x-4)^2\cdot(x-5)} dx ~ \]

Is $-6\log(5) - 5\log(3) - 1/6 + 11\log(4)$ the answer?


In the assumptions for the partial fraction decomposition is the fact that $p(x)$ and $q(x)$ share no common factors. Suppose, this isn't the case and in fact we have:

\[ ~ \frac{p(x)}{q(x)} = \frac{(x-c)^m s(x)}{(x-c)^n t(x)}. ~ \]

Here $s$ and $t$ are polynomials such that $s(c)$ and $t(c)$ are non-zero.

If $m > n$, then why can we cancel out the $(x-c)^n$ and not have a concern?

If $m = n$, then why can we cancel out the $(x-c)^n$ and not have a concern?

If $m < n$, then why can we cancel out the $(x-c)^n$ and not have a concern?