# How to quickly solve partial fractions equation?

Often I am dealing with an integral of let's say:

$$\int\frac{dt}{(t-2)(t+3)}$$

or

$$\int \frac{dt}{t(t-4)}$$

or to make this a more general case in which I am interested the most:

$$\int \frac{dt}{(t+\alpha)(t+\beta)} \quad \quad \alpha, \beta \in \mathbb{R}$$

Basically any integral with decomposed polynomial of second degree in the denominator. Obviously this leads to sum of two natural logarithms.

What I do is write down partial fractions equation and then solve system of linear equations (2 variables here):

$$\frac{1}{(t+\alpha)(t+\beta)} = \frac{A}{t+\alpha} + \frac{B}{t+\beta}$$

After solving this I end up with some $$A, B$$ coefficients and I can solve the integral.

Is there faster way to find $$A, B$$ ? Some algorithm or anything that I can follow and would always work for such case? Surely, solving that does not take much time but I just wonder if it could be done even faster.

(bonus question: what if there were more variables, like 3 variables?)

I would greatly appreciate all feedback as it could help me save countless number of minutes in the future.

• Also when I think about it, I wonder if there's even a general method (beyond the one you referred to). I can see very easily a general solution for when (i) the numerator is $1$ (ii) $\alpha \ne \beta$ (iii) we only have a product of two factors in the denominator, but that's such a narrow set of circumstances that I wonder if it's worth it. Maybe someone has a more general form though. – Eevee Trainer Apr 12 at 1:25

Here's your answer for general $$n$$.

$$\dfrac1{\prod_{k=1}^n (x-a_k)} =\sum_{k=1}^n \dfrac{b_k}{x-a_k}$$.

Therefore $$1 =\sum_{k=1}^n \dfrac{b_k\prod_{j=1}^n (x-a_j)}{x-a_k} =\sum_{k=1}^n b_k\prod_{j=1, j\ne k}^n (x-a_j)$$.

Setting $$x = a_i$$ for each $$i$$, all the terms except the one with $$k=i$$ have the factor $$a_i-a_i$$, so $$1 = b_i\prod_{j=1, j\ne i}^n (a_i-a_j)$$ so that $$b_i =\dfrac1{\prod_{j=1, j\ne i}^n (a_i-a_j)}$$.

For $$n=2$$, $$b_1 =\dfrac1{a_1-a_2}$$, $$b_2 =\dfrac1{a_2-a_1}$$.

For $$n=3$$, $$b_1 =\dfrac1{(a_1-a_2)(a_1-a_3)}$$, $$b_2 =\dfrac1{(a_2-a_1)(a_2-a_3)}$$, $$b_3 =\dfrac1{(a_3-a_1)(a_3-a_2)}$$.

If your fraction is in form of $$\frac {1}{(t-\alpha_1)(t-\alpha_2)(t-\alpha_3)...(t-\alpha_k)}$$ where the $$\alpha s$$ are different, there is an easy way to find the partial fraction decomposition.

Let $$t=\alpha_i$$ and cover $$(t-\alpha_i)$$ while evaluating the above fraction to get your $$A_i$$

For example $$\frac{1}{(t-1)(t-3)(t+4)} = \frac {A_1}{(t-1)} + \frac{ A_2}{(t-3)} +\frac { A_3}{(t+4)}$$ Where $$A_1 = \frac {1}{(1-3)(1+4)}=\frac{-1}{10}$$ $$A_2 = \frac {1}{(3-1)(3+4)} = \frac{1}{14}$$

$$A_3=\frac {1}{(-4-1)(-4-3)}=\frac{1}{35}$$

Unless I am misunderstanding the question, by "root rotation" (when $$\beta \neq \alpha$$):

$$\frac{1}{(t + \alpha)(t + \beta)} = \frac{A}{t + \alpha} + \frac{B}{t + \beta}$$

$$1 = A(t + \beta) + B(t + \alpha)$$

Evaluating $$-\beta$$ for $$t$$:

$$1 = B(\alpha - \beta)$$

$$B = \frac{1}{\alpha - \beta}$$

Similarly, for $$A$$, sub in $$-\alpha$$:

$$1 = A(\beta - \alpha)$$

$$A = \frac{1}{\beta - \alpha}$$

• I'll be coming back to this post. This is what I was looking for. – weno Apr 12 at 1:45
• Unless that takes you too much time, would you be able to derive formulas for $A, B, C$, please? Function of form $\frac{1}{(t+\alpha)(t+\beta)(t+\gamma)}$ and $\alpha \neq \beta \neq \gamma$ – weno Apr 12 at 1:47

Let $$n$$,$$m$$ be integers such that $$n\ge 2$$ and $$n-1 \ge m \ge 0$$ .Then if the roots of the polynomial in question are all distinct the following formula holds: $$$$\frac{x^m}{\prod\limits_{j=1}^n (x-b_j)} = \sum\limits_{i=1}^n \frac{1}{x-b_i} \cdot \frac{b_i^m}{\prod\limits_{j=1,j\neq i}^n (b_i-b_j)}$$$$ Now, if the roots are not distinct then it gets more complicated but even at the outset it is clear that we can generate a similar formula by differentiating both sides with respect to the particular root a certain number of times. For example if $$n=2$$ and $$m_1 \ge 1$$, $$m_2 \ge 1$$ and $$m\ge 0$$ the following formula holds true: $$\begin{eqnarray} \frac{x^m}{(x-b_1)^{m_1} (x-b_2)^{m_2}}=\sum\limits_{j=0}^m \left( \sum\limits_{l_1=1}^{m_1} \binom{m_1+m_2-1-l_1}{m_2-1}(-1)^{m_2} b_1^j \frac{1_{l_1=1} \binom{m-1}{j-1} + 1_{l_1>1} \binom{m}{j}}{(x-b_1)^{l_1-m+j} (-b_1+b_2)^{m_1+m_2-l_1}}+ \sum\limits_{l_1=1}^{m_2} \binom{m_1+m_2-1-l_1}{m_1-1}(-1)^{m_1} b_2^j \frac{1_{l_1=1} \binom{m-1}{j-1} + 1_{l_1>1} \binom{m}{j}}{(x-b_2)^{l_1-m+j} (-b_2+b_1)^{m_1+m_2-l_1}} \right) \end{eqnarray}$$

In[5732]:= ll = {}; x =.; b1 =.; b2 =.; m = RandomInteger[{0, 10}];
For[count = 1, count <= 100, count++,
{m1, m2} = RandomInteger[{1, 5}, 2]; x =.; b1 =.; b2 =.;
xx1 =
Sum[
Binomial[m1 + m2 - 1 - l1, m2 - 1] ((-1)^
m2 b1^j If[l1 == 1, Binomial[m - 1, j - 1],
Binomial[m, j]])/((x - b1)^(l1 - m + j) (-b1 + b2)^(
m1 + m2 - l1)), {l1, 1, m1}, {j, 0, m}] +
Sum[ Binomial[m1 + m2 - 1 - l1, m1 - 1] ((-1)^
m1 b2^j If[l1 == 1, Binomial[m - 1, j - 1],
Binomial[m, j]])/((x - b2)^(l1 - m + j) (-b2 + b1)^(
m1 + m2 - l1)), {l1, 1, m2}, {j, 0, m}];
xx2 = x^m/((x - b1)^m1 (x - b2)^m2);
ll = Join[ll, {Simplify[xx1 - xx2]}];
];
ll

Out[5734]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}


It would be interesting to derive similar formulae in the case $$n > 2$$.