Partial Fractions

A rational function \dfrac{P(x)}{Q(x)} looks hopeless to integrate as written. But if its denominator factors, the fraction can be split into a sum of simpler fractions — each of which integrates to a logarithm by the substitution u = x - r. This decomposition is the method of partial fractions.

\frac{1}{(x - r)(x - s)} = \frac{A}{x - r} + \frac{B}{x - s}.

Find the constants A, B, and the impossible integral becomes a sum of \int \tfrac{dx}{x - r} = \ln|x - r| pieces.

Worked example: \displaystyle\int \frac{dx}{(x-1)(x+2)}

Step 1 — write the decomposition with unknowns. Two distinct linear factors, so two simple fractions:

\frac{1}{(x-1)(x+2)} = \frac{A}{x-1} + \frac{B}{x+2}.

Step 2 — clear the denominators. Multiply both sides by (x-1)(x+2):

1 = A(x+2) + B(x-1).

This must hold for every x, which lets us pick convenient values.

Step 3 — cover-up at x = 1. Setting x = 1 kills the B term (x - 1 = 0):

1 = A(1 + 2) + B(0) = 3A \qquad\Longrightarrow\qquad A = \frac{1}{3}.

Step 4 — cover-up at x = -2. Setting x = -2 kills the A term:

1 = A(0) + B(-2 - 1) = -3B \qquad\Longrightarrow\qquad B = -\frac{1}{3}.

Step 5 — write the decomposition.

\frac{1}{(x-1)(x+2)} = \frac{1/3}{x-1} - \frac{1/3}{x+2}.

Step 6 — integrate each piece. Each is a logarithm (via u = x - 1 and u = x + 2):

\int \frac{dx}{(x-1)(x+2)} = \frac{1}{3}\ln|x-1| - \frac{1}{3}\ln|x+2| + C.

Equivalently, combining the logs, \tfrac{1}{3}\ln\left|\dfrac{x-1}{x+2}\right| + C.

The shapes of decomposition

Distinct linear factors are the easy case; two more shapes round out the method. Each repeated factor and each irreducible quadratic gets its own template of unknowns.

Write a proper rational function (degree of P below degree of Q) as a sum of these building blocks, one per factor of Q:

Cover-up. For a distinct linear factor (x - r), you can read its constant off instantly: cover that factor in the denominator and evaluate what remains at x = r. For our example, the constant over (x - 1) is

A = \left.\frac{1}{\;x + 2\;}\right|_{x = 1} = \frac{1}{3},

and the constant over (x + 2) is \left.\tfrac{1}{x - 1}\right|_{x = -2} = -\tfrac{1}{3} — exactly Steps 3–4, done in your head. (Cover-up shortcut applies only to simple linear factors; for repeated or quadratic factors, equate coefficients instead.)

Make it proper first. Partial fractions require the numerator's degree to be strictly less than the denominator's. If \deg P \ge \deg Q, do polynomial long division first to peel off a polynomial part, leaving a proper remainder fraction to decompose:

\frac{x^2}{(x-1)(x+2)} = 1 + \frac{-x + 2}{(x-1)(x+2)},

where the polynomial part 1 integrates trivially and the proper remainder is decomposed as usual.

See it: a rational function and its antiderivative

The faint curve is the rational integrand \dfrac{1}{(x-1)(x-s)} (with its two vertical asymptotes); the bold curve is the log-sum antiderivative \dfrac{1}{1-s}\big(\ln|x-1| - \ln|x-s|\big) obtained by partial fractions. Slide the right root s and watch both the integrand and its antiderivative respond.