Skip to content

Partial Fraction Decomposition Calculator

Split a rational function P(x)/Q(x) into partial fractions with exact coefficients and every step: linear, repeated and quadratic factors.

Your details

e.g. 5x - 4, x^3, 2x^2 + 3x - 1, or coefficients from the highest degree: 5, -4

Expanded or factored: x^2 - x - 2, (x-1)^2(x^2+1), x^3 + x

Results update as you type

Partial fraction decomposition

3/(x + 1) + 2/(x − 2)

Form with unknowns
A/(x + 1) + B/(x − 2)
Coefficients
A = 3, B = 2
Factored denominator
(x + 1)(x − 2)
Number of partial fractions
2

Step-by-step solution
  1. The fraction is already proper (deg P < deg Q).
  2. Factor the denominator: Q(x) = (x + 1)(x − 2)
  3. Set up the decomposition: A/(x + 1) + B/(x − 2)
  4. Multiply by Q(x): 5x − 4 = A(x − 2) + B(x + 1)
  5. Equate the coefficients of each power of x:
  6. x¹: A + B = 5
  7. x⁰: −2A + B = −4
  8. Solve: A = 3, B = 2
  9. Result: 3/(x + 1) + 2/(x − 2)

Partial fraction decomposition rewrites a rational function — a polynomial divided by a polynomial — as a sum of simpler fractions whose denominators are the factors of the original denominator. It is the standard first move when you need to integrate a rational function, take an inverse Laplace transform, sum a telescoping series or solve a recurrence: 5x−4x2−x−2\frac{5x-4}{x^2-x-2} is hard to integrate as it stands, but 2x−2+3x+1\frac{2}{x-2} + \frac{3}{x+1} integrates to two logarithms at once.

Type the numerator P(x)P(x) and the denominator Q(x)Q(x), expanded or already factored. The calculator works entirely with exact fractions, never decimals. It cancels any common factor, performs polynomial long division when the fraction is improper, factors the denominator over the rational numbers (rational roots with their multiplicities, then irreducible quadratic factors, repeated ones included), sets up the decomposition with unknown coefficients, builds the linear system by equating coefficients, solves it and prints the result together with every intermediate line.

It handles the four textbook cases: distinct linear factors, repeated linear factors, irreducible quadratic factors and repeated quadratic factors. When Q(x)Q(x) contains an irreducible factor of degree three or more over the rationals — x3−2x^3 - 2, for instance — no decomposition with rational coefficients into linear and quadratic pieces exists, and the calculator says so.

How to use this calculator

  1. Enter the numerator P(x)P(x), for example 5x - 4 or x^3. Powers use ^; you can also type a list of coefficients from the highest degree.
  2. Enter the denominator Q(x)Q(x), expanded (x^2 - x - 2) or factored ((x-1)^2(x^2+1)).
  3. Read the decomposition. Below it you get the form with letters A,B,C,…A, B, C, \dots, their values, the factored denominator and, for an improper fraction, the polynomial part.
  4. Open the steps to follow the method exactly as you would write it by hand: division, factoring, setting up, equating coefficients, solving.

Fractional coefficients such as x/2 are accepted; decimals are converted to exact fractions (0.5 becomes 1/2).

The formula

If deg⁡P≥deg⁡Q\deg P \ge \deg Q, first divide: PQ=S+RQ\frac{P}{Q} = S + \frac{R}{Q} with deg⁡R<deg⁡Q\deg R < \deg Q. Then factor QQ and write one group of terms per factor:

R(x)(x−a)m(x2+bx+c)n=∑k=1mAk(x−a)k+∑k=1nBkx+Ck(x2+bx+c)k\frac{R(x)}{(x-a)^m (x^2+bx+c)^n} = \sum_{k=1}^{m} \frac{A_k}{(x-a)^k} + \sum_{k=1}^{n} \frac{B_k x + C_k}{(x^2+bx+c)^k}

A linear factor repeated mm times contributes mm constants; an irreducible quadratic factor (b2−4c<0b^2 - 4c < 0, or more generally no rational root) repeated nn times contributes nn linear numerators. In total there are exactly deg⁡Q\deg Q unknowns.

Multiplying both sides by Q(x)Q(x) gives a polynomial identity. Equating the coefficients of x0,x1,…,xdeg⁡Q−1x^0, x^1, \dots, x^{\deg Q - 1} produces a square linear system that always has a unique solution, so the decomposition is unique. For distinct linear factors there is a shortcut, the cover-up method: A=R(a)Q′(a)A = \frac{R(a)}{Q'(a)} for the factor x−ax - a.

Worked example

Distinct linear factors. 5x−4x2−x−2\frac{5x-4}{x^2-x-2}: the denominator factors as (x+1)(x−2)(x+1)(x-2). Write Ax+1+Bx−2\frac{A}{x+1} + \frac{B}{x-2} and multiply out: 5x−4=A(x−2)+B(x+1)5x - 4 = A(x-2) + B(x+1). With x=−1x = -1: −9=−3A-9 = -3A, so A=3A = 3; with x=2x = 2: 6=3B6 = 3B, so B=2B = 2. Result: 3/(x+1)+2/(x−2)3/(x + 1) + 2/(x - 2).

Irreducible quadratic factor. x2+2x+3(x+1)(x2+1)=1/(x+1)+2/(x2+1)\frac{x^2+2x+3}{(x+1)(x^2+1)} = 1/(x + 1) + 2/(x^2 + 1).

Repeated linear factor. x2+1x(x−1)2=1/x+2/(x−1)2\frac{x^2+1}{x(x-1)^2} = 1/x + 2/(x - 1)^2.

Improper fraction. x3x2−1\frac{x^3}{x^2-1}: long division gives xx with remainder xx, then xx2−1\frac{x}{x^2-1} splits into halves: x+1/(2(x+1))+1/(2(x−1))x + 1/(2(x + 1)) + 1/(2(x - 1)).

Repeated quadratic factor. x3(x2+1)2=x/(x2+1)−x/(x2+1)2\frac{x^3}{(x^2+1)^2} = x/(x^2 + 1) - x/(x^2 + 1)^2.

Why partial fractions matter for integration

Every term of a decomposition has a known antiderivative: ∫Ax−a dx=Aln⁡∣x−a∣\int \frac{A}{x-a}\,dx = A\ln|x-a|, ∫A(x−a)k dx=−A(k−1)(x−a)k−1\int \frac{A}{(x-a)^k}\,dx = \frac{-A}{(k-1)(x-a)^{k-1}} for k≥2k \ge 2, and a quadratic term splits into a logarithm plus an arctangent after completing the square. That is why integral tables and computer algebra systems reduce any rational function to partial fractions first. The same decomposition gives inverse Laplace and z-transforms term by term in control theory and signal processing, and turns sums like ∑1n(n+1)\sum \frac{1}{n(n+1)} into telescoping series.

Once you have the decomposition here, the integral calculator can integrate each simple term, and the polynomial calculator checks the long division or the factorization.

Limits of this calculator

The denominator is factored over the rational numbers. Linear factors come from the rational root theorem; the remaining part must split into quadratics with rational coefficients. Quadratics such as x2−2x^2 - 2 are kept whole (their roots are irrational), which is the usual textbook convention over Q\mathbb{Q}. A denominator like x3−2x^3 - 2 or x4+1x^4 + 1, whose real factorization needs irrational coefficients, is reported instead of being approximated. Degrees are limited to 12 for the denominator and 30 for the numerator.

Frequently asked questions

What is partial fraction decomposition?

It is the rewriting of a rational function P(x)/Q(x) as a polynomial plus a sum of fractions whose denominators are powers of the factors of Q(x). For example (5x − 4)/(x² − x − 2) = 2/(x − 2) + 3/(x + 1).

What do I do when the degree of the numerator is not smaller?

Divide first. Polynomial long division gives a quotient S(x) and a remainder R(x) of lower degree; only R(x)/Q(x) is decomposed, and the quotient is added in front. The calculator does this automatically, as with x³/(x² − 1) = x + x/(x² − 1).

How do repeated factors work?

A factor raised to the power m needs one term for each power from 1 to m: (x − 1)² gives A/(x − 1) + B/(x − 1)², and (x² + 1)² gives (Ax + B)/(x² + 1) + (Cx + D)/(x² + 1)².

What is an irreducible quadratic factor?

A second-degree factor that cannot be split into linear factors with rational coefficients, such as x² + 1 or x² + x + 1 (negative discriminant). Its partial fraction has a linear numerator, Bx + C, instead of a constant.

Is the decomposition unique?

Yes. Once the denominator is factored, the coefficients are fixed: the system obtained by equating coefficients has exactly one solution. Two correct methods (substituting values of x or equating coefficients) always give the same answer.

Why does the calculator refuse some denominators?

If Q(x) contains a factor of degree 3 or more that cannot be factored over the rationals, such as x³ − 2, the decomposition would need irrational or complex coefficients. The tool works with exact rational arithmetic and reports that case instead of giving approximate decimals.

Sources

Last updated:

More Math calculators

People also use