What this calculator does
This tool performs partial fraction decomposition for a proper rational expression with two distinct linear factors in the denominator. Given a numerator of the form px + q and a denominator (x − a)(x − b), it splits the fraction into two simple terms A/(x − a) and B/(x − b). This is one of the most common techniques in algebra and calculus, especially when integrating rational functions.
How to use it
Enter the numerator coefficients p and q (so the top of the fraction is px + q), then enter the two roots a and b that define the factors (x − a) and (x − b). The roots must be different. The calculator returns the constants A and B that make the decomposition an exact identity.
The formula explained
We require $$\frac{px+q}{(x-a)(x-b)} = \frac{A}{x-a} + \frac{B}{x-b}.$$ Multiplying through gives \(px + q = A(x - b) + B(x - a)\). Using the cover-up method, substitute \(x = a\) to isolate A: $$A = \frac{pa + q}{a - b}.$$ Substitute \(x = b\) to isolate B: $$B = \frac{pb + q}{b - a}.$$ These two closed-form expressions are exactly what the calculator evaluates.
Worked example
Decompose \(\frac{3x + 5}{(x - 1)(x - 2)}\). Here \(p = 3\), \(q = 5\), \(a = 1\), \(b = 2\). Then $$A = \frac{3\cdot 1 + 5}{1 - 2} = \frac{8}{-1} = -8,$$ and $$B = \frac{3\cdot 2 + 5}{2 - 1} = \frac{11}{1} = 11.$$ So the decomposition is \(\frac{-8}{x - 1} + \frac{11}{x - 2}\).
More Worked Examples
Both examples use the formulas \(A = \frac{pa + q}{a - b}\) and \(B = \frac{pb + q}{b - a}\), for the form \(\frac{px+q}{(x-a)(x-b)}\) with \(a \ne b\).
Example 1: (x + 7)/((x + 1)(x − 3))
- Rewrite each factor as (x − root). The factor \((x+1)\) is \((x-(-1))\), so \(a = -1\). The factor \((x-3)\) gives \(b = 3\). The numerator is \(x + 7\), so \(p = 1\) and \(q = 7\).
- Compute A. \(A = \frac{(1)(-1) + 7}{-1 - 3} = \frac{6}{-4} = \) -1.5. Note the negative denominator: \(a - b = -1 - 3 = -4\).
- Compute B. \(B = \frac{(1)(3) + 7}{3 - (-1)} = \frac{10}{4} = \) 2.5. Here \(b - a = 3 + 1 = 4\), because subtracting a negative adds.
- Check. \(A + B = -1.5 + 2.5 = 1 = p\) ✓. Also \(-(Ab + Ba) = -((-1.5)(3) + (2.5)(-1)) = -(-4.5 - 2.5) = 7 = q\) ✓.
Result: \(\frac{x+7}{(x+1)(x-3)} = \frac{-1.5}{x+1} + \frac{2.5}{x-3}\).
Example 2: 4/((x − 2)(x + 2))
- Identify the inputs. The numerator is the constant 4, so \(p = 0\) and \(q = 4\). The roots are \(a = 2\) and \(b = -2\).
- Compute A. \(A = \frac{(0)(2) + 4}{2 - (-2)} = \frac{4}{4} = 1\).
- Compute B. \(B = \frac{(0)(-2) + 4}{-2 - 2} = \frac{4}{-4} = \) -1.
- Check. \(A + B = 1 + (-1) = 0 = p\) ✓. Also \(-(Ab + Ba) = -((1)(-2) + (-1)(2)) = -(-4) = 4 = q\) ✓.
Result: \(\frac{4}{(x-2)(x+2)} = \frac{1}{x-2} - \frac{1}{x+2}\). A constant numerator always gives \(A = -B\), because \(p = 0\).
Checking and Using Your Result
Verify by recombining. Put the two fractions over the common denominator \((x-a)(x-b)\). The numerator becomes
$$A(x - b) + B(x - a) = (A + B)\,x - (Ab + Ba).$$This must equal \(px + q\) for every x. Matching coefficients gives two checks: \(A + B = p\) and \(-(Ab + Ba) = q\). If both hold, the decomposition is correct.
A and B are residues. \(A\) is the value of \((x-a)\cdot\frac{px+q}{(x-a)(x-b)}\) at \(x = a\), which is \(\frac{pa+q}{a-b}\). That is the residue of the function at the simple pole \(x = a\). Likewise, \(B\) is the residue at \(x = b\). This is why the formulas work: covering up one factor and substituting its root into what remains gives that term's coefficient.
Integration. Once decomposed, each term integrates directly:
$$\int \frac{px+q}{(x-a)(x-b)}\,dx = A\ln|x - a| + B\ln|x - b| + C.$$The absolute values matter because the integrand is defined on both sides of each root.
Zero coefficients. \(A = 0\) exactly when \(pa + q = 0\), meaning the numerator vanishes at \(x = a\). Then the factor \((x-a)\) cancels from the original fraction, and what remains is \(\frac{B}{x-b}\) with \(B = p\). The same holds for \(B = 0\) and the factor \((x-b)\).
Requirement. The roots must be distinct (\(a \ne b\)). If \(a = b\), the denominator is a repeated factor, and the decomposition takes a different form: \(\frac{A}{x-a} + \frac{B}{(x-a)^2}\).
FAQ
Why must a and b be distinct? If \(a = b\) the denominator has a repeated factor \((x - a)^2\), which needs a different form \(\frac{A}{x - a} + \frac{B}{(x - a)^2}\), so this simple two-term formula no longer applies.
Does the numerator have to be px + q? The numerator must be of degree lower than the denominator (a proper fraction). A linear numerator px + q is the general case here; set \(p = 0\) for a constant numerator.
What if my factors look like (x + c)? Rewrite \((x + c)\) as \((x - (-c))\), so the corresponding root is \(a = -c\).