Partial fractions
Partial fractions express a quotient of polynomials as a sum of fractions whose denominators are powers of the factors of the original denominator[1][2]. Each term is simpler to integrate, to expand as a power series or to invert under a transform than the whole, which makes the decomposition a standard step in calculus, in the analysis of linear systems, and in computer algebra. Its existence follows from Bézout's identity for coprime polynomials, and computing it costs little beyond a factorization of the denominator; the level of factorization chosen, square-free, over the rationals or over the complex numbers, determines both the cost and the shape of the result[1][3]. Leibniz and Johann Bernoulli used partial fractions in 1702 and 1703 to integrate rational functions[6][8].
Example
The polynomial part comes from dividing the numerator by the denominator; each factor of the denominator contributes one term for each power up to its multiplicity, with a numerator of lower degree than the factor. The existence of such a decomposition follows from Bézout's identity: for coprime and there are and with , so .
Statement
Let be a field, with , and with the pairwise coprime. Then there are unique polynomials and such that
The factors need not be irreducible: any pairwise coprime factorization gives a decomposition, and irreducible factors give the finest one[2].
Algorithm
Divide first: with . Then split the proper fraction across one coprime factor at a time: with , solve with by the extended Euclidean algorithm, so that . Finally, for a numerator over a power , divide repeatedly by : the successive remainders are the numerators of , the digits of in base .
Partial fractions for a given coprime factorization of the denominator.
(* Partial fractions over Q for a given factorization of the denominatorinto pairwise coprime powers d = prod f_i^e_i. *)open Qpoly(* n / (a b) with a, b coprime: find s, t with s b + t a = n, so thatn / (a b) = s / a + t / b. *)let split n a b = let t, s = diophantine a b n in (s, t)(* r / f^e as sum over j of c_j / f^j, by repeated division by f. *)let expand_power r f e =let rec go r j acc = if j = 0 then acc elselet q, c = divmod r f in go q (j - 1) ((c, j) :: acc) inList.filter (fun (c, _) -> not (is_zero c)) (go r e [])(* Returns the polynomial part and a list of (numerator, factor, power). *)let apart n (factors : (t * int) list) =let d = List.fold_left (fun acc (f, e) -> mul acc (pow f e)) one factors inlet q, r = divmod n d inlet rec go r = function| [] -> []| [ (f, e) ] -> List.map (fun (c, j) -> (c, f, j)) (expand_power r f e)| (f, e) :: rest ->let rest_d = List.fold_left (fun acc (g, k) -> mul acc (pow g k)) one rest inlet a, b = split r (pow f e) rest_d inList.map (fun (c, j) -> (c, f, j)) (expand_power a f e) @ go b rest in(q, go r factors)(* Recombine, to check the result. *)let recombine (q, terms) =let d = List.fold_left (fun acc (_, f, j) -> let g = pow f j in mul acc (quo g (gcd acc g))) one terms inlet n = List.fold_left (fun acc (c, f, j) -> add acc (mul c (quo d (pow f j)))) (mul q d) terms in(n, d)(* One term c / f^j, written with the factor and its power. *)let show_term ?(ascending = false) (c, f, j) =let par s = if String.contains s ' ' || String.contains s '/' then "(" ^ s ^ ")" else s inlet fs = "(" ^ to_string ~ascending f ^ ")" ^ (if j > 1 then "^" ^ string_of_int j else "") inpar (to_string c) ^ " / " ^ fs
The example above, checked by recombining the terms.
open Qpoly
Running it.
polynomial part: 1(5/18) / (x - 1)(2/3) / (x - 1)^2((1/2)x - 1/2) / (x^2 + 1)(-7/9) / (x + 2)recombines to the original: true
The result agrees with SymPy's apart. The whole computation costs field operations with classical arithmetic for a denominator of degree , and Kung and Tong showed how to do it in with fast arithmetic[4][5].
Levels of factorization
The irreducible factorization over requires polynomial factoring. The square-free factorization , in which each collects the factors of multiplicity , requires only gcds, and it is already a coprime factorization, so it gives a coarser decomposition cheaply. For integration, this coarser level is all that is needed: Hermite reduction removes the repeated factors, and the logarithmic part can be computed without factoring[1]. Over the complex numbers every irreducible factor is linear, and the numerator of a simple pole is the residue ; Bronstein and Salvy showed how to express this full decomposition exactly, as a sum over the roots of a polynomial, without computing the roots[3].
One denominator at both levels.
open Qpoly(* The square-free factorization of the denominator needs only gcds; thefull factorization over Q needs factoring. Partial fractions can betaken at either level. *)
Running it.
1 / (x^9 - 3x^8 - 6x^7 + 8x^6 + 26x^5 + 24x^4 - 15x^3 - 47x^2 - 42x - 18)square-free partial fractions:(-(33/784)x^2 + 41/392) / (x^3 + x^2 - 2x - 2)((33/784)x^2 - (99/784)x + 17/784) / (x^3 - 2x^2 - 2x - 3)(-(3/28)x^2 + (9/28)x + 1/28) / (x^3 - 2x^2 - 2x - 3)^2over the irreducible factors:((1/49)x - 1/49) / (x^2 - 2)(-1/16) / (x + 1)(-795/1722448) / (x - 3)(1/4732) / (x - 3)^2((4581/107653)x + 176/107653) / (x^2 + x + 1)((31/1183)x - 6/1183) / (x^2 + x + 1)^2
Generating functions
A rational generating function has coefficients given by a linear recurrence, and partial fractions give their closed form: contributes to the -th coefficient and contributes [7].
The coefficients of 1 / ((1 − x)²(1 − 2x)) from its partial fractions, against direct series division.
open Qpoly(* Coefficients of the generating function 1 / ((1 - x)^2 (1 - 2x)):partial fractions turn it into sums of geometric series. *)
Running it.
-2 / (1 - x)-1 / (1 - x)^24 / (1 - 2x)from partial fractions: 1 4 11 26 57 120 247 502 1013 2036by series division: 1 4 11 26 57 120 247 502 1013 2036
The terms give the closed form .
History
Leibniz and Johann Bernoulli introduced the decomposition in 1702 and 1703 to reduce integrals of rational functions to known forms, and argued over whether every real polynomial splits into real linear and quadratic factors, which the fundamental theorem of algebra later confirmed[6][8]. Euler used it systematically. In computer algebra, Horowitz analyzed partial fraction algorithms for rational function integration in 1971[5], Kung and Tong gave fast algorithms in 1977[4], and Bronstein and Salvy the full decomposition over the algebraic closure in 1993[3].
see also
- Hermite reductionHermite reduction is the step of symbolic integration that splits the integral of a rational function A/D into a rational function and an integral whose denominator is square-free, using only gcds and the extended Euclidean algorithm, with no factorization of D. The rational part of the antiderivative comes entirely from the repeated factors of D, and each reduction step lowers their multiplicity by one. What remains integrates to a sum of logarithms, whose coefficients are the roots of the Rothstein–Trager resultant. Together the two steps integrate any rational function over a field of characteristic zero exactly, introducing algebraic numbers only where the answer needs them.
- Square-free decompositionThe square-free decomposition of a polynomial writes it as f = f_1 f_2^2 f_3^3 ..., where the f_i are square-free and pairwise coprime, so f_i collects the irreducible factors of multiplicity i. It needs only greatest common divisors with the derivative, not factorization, because gcd(f, f') contains every repeated factor with its multiplicity reduced by one. Yun's algorithm computes it at the cost of about one gcd. In characteristic p a p-th power has zero derivative, and the algorithm must take p-th roots.
- Risch algorithmThe Risch algorithm is a decision procedure for integration in finite terms: given an elementary function, it either finds an elementary antiderivative or proves that none exists. It rests on Liouville's theorem, which says that an elementary antiderivative, if one exists, is a function of the same field plus constant multiples of logarithms. The algorithm writes the integrand in a tower of logarithmic, exponential and algebraic extensions of the rational functions and works down it, using Hermite reduction, the Rothstein–Trager resultant and the Risch differential equation y′ + fy = g. Its transcendental case is completely algorithmic; its algebraic case is much harder; and both are decision procedures only relative to deciding whether a constant is zero.
- Hensel liftingHensel lifting turns a factorization of a polynomial modulo a prime p into a factorization modulo p², p⁴ and so on, as long as the factors modulo p are coprime. Each step solves a linear equation using the Bézout relation between the factors, and in quadratic form it doubles the precision, the p-adic analogue of Newton's method. It is the core of Zassenhaus's algorithm for factoring integer polynomials: factor modulo a small prime, lift until the modulus exceeds twice the Landau–Mignotte bound, and recombine the lifted factors into true factors over the integers.
referenced by
- Building a CAS in OCaml Part 4Factorization over Z by way of a finite field: Cantor-Zassenhaus, Berlekamp, Hensel lifting and subset recombination, then rational functions and partial fractions on top.
- Building a CAS in OCaml Part 5Calculus: a derivative table, Laurent series, limits read off a valuation, and symbolic integration of every rational function, and an explicit refusal for everything else.
further reading
- [1]M. Bronstein, Symbolic Integration I: Transcendental Functions, ch. 2, Springer (2nd ed., 2005).
- [2]J. von zur Gathen, J. Gerhard, Modern Computer Algebra, §22, Cambridge University Press (3rd ed., 2013).
- [3]M. Bronstein, B. Salvy, “Full partial fraction decomposition of rational functions”, ISSAC (1993).
- [4]H. T. Kung, D. M. Tong, “Fast algorithms for partial fraction decomposition”, SIAM Journal on Computing 6 (1977).
- [5]E. Horowitz, “Algorithms for partial fraction decomposition and rational function integration”, SYMSAM (1971).
- [6]G. W. Leibniz, “Specimen novum analyseos pro scientia infiniti circa summas et quadraturas”, Acta Eruditorum (1702).
- [7]R. L. Graham, D. E. Knuth, O. Patashnik, Concrete Mathematics, §7.3, Addison-Wesley (2nd ed., 1994).
- [8]Johann Bernoulli, “Problema exhibitum”, Acta Eruditorum (1703).
last updated