In high school algebra, it is demonstrated that a rational function (a quotient of two polynomial functions) can be expressed as the sum of partial fractions, which are terms of the form
(x−x0)kA
The importance of the partial fraction decomposition lies in the fact that it provides algorithms for various computations with rational functions, including the explicit computation of antiderivatives (discussed later in the blog post), Taylor series expansions and inverse Laplace transforms.
In this blog post, I assume that degP≤degQ, i.e. that the denominator has a lower degree than the numerator. Otherwise, one can use Euclidean division and seek partial fractions of R(x)/Q(x), where R(x) is the remainder of the division guaranteed to have a lower degree of Q.
Clearly, this method is very tedious and difficult to automate (the algorithm needs the ability to simplify and extensively manipulate rational functions).
The Heaviside method in the base case can deal only with rational functions, the denominators of which do not contain any repeated roots. To illustrate the intuition behind this method, consider the following function:
s(s−1)(s+1)2s+1=sA+s−1B+s+1C
Olivier Heaviside proposes to find the value of C by covering the s+1 term and substituting s=−1:
s(s−1)(s+1)2s+1−1=s+1C
Clearly, C=0.5. To justify this maneuver, multiply both sides by s+1 in the original expression:
Before we allow repeated roots, we must assume that the polynomial Q(x)∈F[x] does not have factors that are irreducible over F. This is not an unreasonable demand, as the polynomial can often be solved numerically.
Over the complex field, the rational function is by definition factored as follows:
Let gij(x)=(x−xi)j−1f(x). Then, according to the uniqueness of Laurent series, aij is the coefficient of the term (x−xi)−1 in the Laurent expansion of gij(x) about the point xi, i.e., its residue aij=Res(gij,xi).
Unfortunately, Heaviside’s original approach requires successive differentiation. This can be avoided in the following way:
Consider the following derivation for the partial fraction’s last term of a given root (given ki as the multiplicity of the i-th unique root xi):
aiki=x→xilimf(x)(x−xi)ki
By multiplying both sides of the definition by (x−xi)ki, we cancel out the (x−xi) factor in Q(x) and include (x−xi) or its higher power in each partial fraction, except the constant term aiki.
Consider the following function:
Qi1(x)Pi1(x)=Q(x)P(x)−(x−xi)kiaiki
Due to the uniqueness of the partial fraction expansion, the highest power of (x−xi) in Qi1(x) is ki−1, further implying that (x−xi) must be cancelled out when simplifying Qi1(x)Pi1(x). Thus, we can reduce the multiplicity of the pole at xi by one via a single polynomial division. By applying the technique again, we can determine aiki−1 readily:
We want to find the partial fractions of the following function:
x(x−1)(x−2)22x+1=xA+x−1B+x−2C+(x−2)2D
Applying the first step to A, B and D yields:
ABD=x→xilimf(x)(x−xi)ki=x→0limf(x)x=x→0limx(x−1)(x−2)2x(2x+1)=x→0lim(x−1)(x−2)2(2x+1)=(0−1)(0−2)21=−41=x→xilimf(x)(x−xi)ki=x→1limf(x)(x−1)=x→1limx(x−1)(x−2)2(x−1)(2x+1)=x→1limx(x−2)2(2x+1)=(1−2)22+1=3=x→xilimf(x)(x−xi)ki=x→2limf(x)(x−2)2=x→2limx(x−1)(x−2)2(x−2)2(2x+1)=x→2limx(x−1)(2x+1)=2(4+1)=2.5by definitionby values of x1 and k1by definition of fcancel out xsubstitute into the limit
The value of C=a31C = a_{31}C=a31 is calculated by considering the formula for aiki−ja_{i k_i-j}aiki−j with i=3i = 3i=3, ki=2k_i = 2ki=2, j=1j = 1j=1 and xi=2x_i = 2xi=2:
Partial fraction decomposition, especially when performed using this simple algorithm can be used to compute antiderivatives and infinite sums of rational functions.
P1(x)P_1(x)P1(x) and P2(x)P_2(x)P2(x) are currently unknown, but they will have degrees one less than those of Q1(x)Q_1(x)Q1(x) and Q2(x)Q_2(x)Q2(x), respectively. Thus:
The merit of this method is obvious: The integral of a rational function which has roots with non-one multiplicity was reduced to an integral of a rational function with simple roots, akin to the domain extension to the Heaviside method. The coefficients must be equated now to find the values from aaa to hhh, which is a rather tedious and simple task left to a determined reader.
The second term is a partial fraction decomposition of the rational function, which can be computed using methods described earlier. The notation ψ(a)(x)\psi ^{(a)}(x)ψ(a)(x) denotes the polygamma function of the aaa-th order, defined as the aaa-th derivative of the digamma function, the logarithmic derivative of Γ(x)\Gamma(x)Γ(x). While in this scenario a>0a>0a>0 and a∈Na\in \mathbb{N}a∈N is almost taken for granted, the following formula can be used to compute the polygamma function also given that ℜz>0\Re z > 0ℜz>0:
If zzz is outside of the domain, this is easily fixed using the digamma reflection formula:
ψ(1−x)−ψ(x)=πcotπx
\psi (1-x)-\psi (x)=\pi \cot \pi x
ψ(1−x)−ψ(x)=πcotπx
Meanwhile the same defect with the general formula is fixed using the polygamma reflection formula:
(−1)mψ(m)(1−z)−ψ(m)(z)=πdmdzmcotπz=πm+1Pm(cosπz)sinm+1(πz)
(-1)^{m}\psi ^{(m)}(1-z)-\psi ^{(m)}(z)=\pi {\frac {\mathrm {d} ^{m}}{\mathrm {d} z^{m}}}\cot {\pi z}=\pi ^{m+1}{\frac {P_{m}(\cos {\pi z})}{\sin ^{m+1}(\pi z)}}
(−1)mψ(m)(1−z)−ψ(m)(z)=πdzmdmcotπz=πm+1sinm+1(πz)Pm(cosπz)
The Heaviside method is a simple and elegant way to compute partial fraction decompositions of rational functions. Researching this topic has been a very interesting experience, and I hope that this blog post will be useful to someone who is also dealing with real and complex analysis in computer algebra.