User:Cactus0192837465/sandbox

Deeper page User:Cactus0192837465/sandboxfewnomial

....

Reference for algorithms: https://www.hindawi.com/journals/jam/2014/895036/

In algebra, the partial fraction decomposition or partial fraction expansion of a rational function (that is, a fraction such that the numerator and the denominator are both polynomials) is an operation that consists of expressing the fraction as a sum of a polynomial (possibly zero) and one or several fractions with a simpler denominator.

The importance of the partial fraction decomposition lies in the fact that it provides an algorithm for computing the antiderivative of a rational function, computing explicitly their Taylor series expansions, computing their  inverse Z-transform, their  inverse Laplace transform, and many other applications. The concept was discovered in 1702 by both Johann Bernoulli and Gottfried Leibniz independently.

In symbols, one can use partial fraction expansion to change a rational fraction in the form


 * $$ \frac{p(x)}{q(x)} $$

where $$P$$ and $$Q$$ are polynomials, into an expression of the form


 * $$b(x)+\sum_{i=1}^k\sum_{j=1}^{n_i}\frac{a_{ij}(x)}{q_i^j(x)}$$

where:


 * the denominators of each fraction is a power of an irreducible (not factorable into polynomials of positive degree) polynomial $$q_i$$ and
 * the numerators $$a_{i,j}$$ are polynomials of smaller degree than this irreducible polynomial $$q_i$$.

As factorization of polynomials may be difficult, a coarser decomposition might be preferred, which consists of replacing factorization by square-free factorization. This amounts to replace "irreducible" by "square-free" in the preceding description of the outcome.

Statement of the theorem
When the field $$K$$ is the complex numbers, each $$q_i(x)$$ must have degree 1 by the fundamental theorem of algebra and the numerators are constant.

When $$K$$ is the real numbers, some of the $$q_i(x)$$ might be quadratic without real roots, so, in the partial fraction decomposition, a quotient of a linear polynomial by a power of a quadratic might occur.

In the preceding theorem, one may replace "distinct irreducible polynomials" by "pairwise coprime polynomials that are coprime with their derivative". For example, the $$q_i(x)$$ may be the factors of the square-free factorization of $$q(x)$$. When $$K$$ is the field of the rational numbers, as it is typically the case in computer algebra, this allows to replace factorization by greatest common divisor to compute the partial fraction decomposition.

Proof and efficient computation
Given a rational function $$R(x)=\frac{p(x)}{q(x)}$$ the polynomial long division allows to write $$p(x)=b(x)q(x)+r(x)$$, where $$\operatorname{deg}(r)<\operatorname{deg}(q)$$. This allows to write
 * $$\begin{align}R(x)&=\frac{p(x)}{q(x)}\\&=\frac{b(x)q(x)+r(x)}{q(x)}\\&=b(x)+\frac{r(x)}{q(x)}\end{align}$$

as a sum of a polynomial $$b(x)$$ and a proper fraction $$\frac{r(x)}{q(x)}$$. In other words, the fraction $$\frac{r(x)}{q(x)}$$ satisfies that $$\operatorname{deg}(r)<\operatorname{deg}(q)$$.

If $$q(x)=q_1(x)q_2(x)$$ with $$q_1$$ and $$q_2$$ relatively prime, then by Bézout's identity for polynomials there are polynomials $$r_1$$ and $$r_2$$ such that
 * $$1=r_1(x)q_1(x)+r_2(x)q_2(x)$$

These polynomials can be computed using the extended Euclid's algorithm.

Therefore,
 * $$r(x)=r(x)r_1(x)q_1(x)+r(x)r_2(x)q_2(x)$$.

A further application of polynomial long division, dividing $$r(x)r_1(x)$$ by $$q_2(x)$$, allows to write $$r(x)r_1(x)=a(x)q_2(x)+s_2(x)$$ with $$\operatorname{deg}(s_2)<\operatorname{deg}(q_2)$$. Therefore,
 * $$\begin{align}r(x)&=r(x)r_1(x)q_1(x)+r(x)r_2(x)q_2(x)\\&=s_2(x)q_1(x)+(r(x)r_2(x)+a(x)q_1(x))q_2(x)\\&=s_2(x)q_1(x)+s_1(x)q_2(x)\end{align}$$,

where $$s_1(x)=r(x)r_2(x)+a(x)q_1(x)$$ and by degree considerations $$\operatorname{deg}(s_1)<\operatorname{def}(q_1)$$ and $$\operatorname{deg}(s_2)<\operatorname{def}(q_2)$$.

This allows writing
 * $$\begin{align}R(x)&=b(x)+\frac{r(x)}{q(x)}\\&=b(x)+\frac{s_1q_2(x)+s_2(x)q_1(x)}{q_1(x)q_2(x)}\\&=b(x)+\frac{s_1(x)}{q_1(x)}+\frac{s_2(x)}{q_2(x)}\end{align}$$

where the last two fractions are proper and have denominators of smaller degree than $$\operatorname{deg}(q)$$.

Repeating the same argument with each of the resulting fractions eventually each denominator is only a power of an irreducible polynomial. In this case the argument above cannot be applied any further because any factorization of a power of an irreducible polynomial into two factors of positive degree would give factors that are not relatively prime.

Finally, for a fraction
 * $$\frac{s(x)}{[g(x)]^n}$$

with $$g(x)$$ irreducible and $$\operatorname{deg}{s}<\operatorname{deg}{[g(x)]^n}$$, repeated application of the polynomial long division, dividing $$s(x)$$, and the subsequent quotients obtained, by $$g(x)$$ yields
 * $$\begin{align}s(x)&=g(x)g_1(x)+r_n(x)\\

g_1(x)&=g(x)g_2(x)+r_{n-1}(x)\\ \vdots&\ \vdots\\ g_{n-2}(x)&=g(x)g_{n-1}(x)+r_{2}(x)\\ g_{n-1}(x)&=g(x)g_{n}(x)+r_{1}(x)\end{align}$$ where $$g_n(x)=0$$ and $$\operatorname{deg}(r_i)<\operatorname{deg}(g)$$ for $$i=1,2,\ldots,n$$ This allows to write
 * $$s(x)=[g(x)]^{n-1}r_{1}(x)+[g(x)]^{n-2}r_{2}(x)+\ldots+g(x)r_{n-1}+r_n$$,

which results in the final form
 * $$\frac{s(x)}{[g(x)]^{n}}=\frac{r_1(x)}{g(x)}+\frac{r_2(x)}{[g(x)]^2}+\ldots+\frac{r_{n-1}(x)}{[g(x)]^{n-1}}+\frac{r_n(x)}{[g(x)]^n}$$

as a sum of simple fractions.

Special cases
The general algorithm to compute partial fraction decomposition involves multiple uses of the extended Euclid's algorithm and in particular polynomial long division. A number of alternative procedures are available when the denominator $$q(x)$$ has a factorization with few irreducible factors, irreducible factors with small degree, and each irreducible factor raised to small powers.

Heaviside cover-up method
One such method is Heaviside cover-up method, which is applicable when the denominator $$q(x)$$ is a product of different polynomials of degree 1.
 * $$q(x)=(x-\alpha_1)(x-\alpha_2)\ldots(x-\alpha_k)$$

The partial fraction decomposition for a proper fraction $$\frac{r(x)}{q(x)}=\frac{r(x)}{(x-\alpha_1)(x-\alpha_2)\ldots(x-\alpha_k)}$$ would have the form
 * $$\frac{r(x)}{(x-\alpha_1)(x-\alpha_2)\ldots(x-\alpha_k)}=\frac{A_1}{x-\alpha_1}+\frac{A_2}{x-\alpha_2}+\ldots+\frac{A_k}{x-\alpha_k}$$

The cover-up method consists in computing $$A_i$$ by multiplying the whole equation by $$x-\alpha_i$$, cancelling this, and evaluating the resulting equation at $$x=\alpha_i$$. This yields
 * $$\frac{r(\alpha_i)}{(x-\alpha_1)(x-\alpha_2)\ldots(x-\alpha_{i-1})(x-\alpha_{i+1})\ldots(x-\alpha_k)}=A_i$$.

Example
For $$\frac{x+1}{(x-2)(x-3)}$$ covering $$x-2$$ and evaluating at $$x=2$$ yields
 * $$A_1=\frac{2+1}{2-3}=-3$$

and covering $$x-3$$ and evaluating at $$x=3$$ yields
 * $$A_2=\frac{3+1}{3-2}=4$$.

Therefore
 * $$\frac{x+1}{(x-2)(x-3)}=\frac{A_1}{x-2}+\frac{A_2}{x-3}=\frac{-3}{x-2}+\frac{4}{x-3}$$.

Application to symbolic integration
For the purpose of symbolic integration, the preceding result may be refined into

This reduces the computation of the antiderivative of a rational function to the integration of the last sum, which is called the logarithmic part, because its antiderivative is a linear combination of logarithms. In fact, we have


 * $$\frac{c_{i1}}{p_i}=\sum_{\alpha_j:p_i(\alpha_j)=0}\frac{c_{i1}(\alpha_j)}{p'_i(\alpha_j)}\frac{1}{x-\alpha_j}.$$

There are various methods to compute above decomposition. The one that is the simplest to describe is probably the so-called Hermite's method. As the degree of cij is bounded by the degree of pi, and the degree of b is the difference of the degrees of f and g (if this difference is non negative; otherwise, b=0), one may write these unknowns polynomials as polynomials with unknown coefficients. Reducing the two members of above formula to the same denominator and writing that the coefficients of each power of x are the same in the two numerators, one gets a system of linear equations which can be solved to obtain the desired values for the unknowns coefficients.

Procedure
Given two polynomials $$P(x)$$ and $$Q(x) = (x-\alpha_1)(x-\alpha_2) \cdots (x-\alpha_n)$$, where the αi are distinct constants and deg P < n, partial fractions are generally obtained by supposing that


 * $$\frac{P(x)}{Q(x)} = \frac{c_1}{x-\alpha_1} + \frac{c_2}{x-\alpha_2} + \cdots + \frac{c_n}{x-\alpha_n}$$

and solving for the ci constants, by substitution, by equating the coefficients of terms involving the powers of x, or otherwise. (This is a variant of the method of undetermined coefficients.)

A more direct computation, which is strongly related with Lagrange interpolation consists of writing


 * $$\frac{P(x)}{Q(x)} = \sum_{i=1}^n \frac{P(\alpha_i)}{Q'(\alpha_i)}\frac{1}{(x-\alpha_i)} $$

where $$Q'$$ is the derivative of the polynomial $$Q$$.

This approach does not account for several other cases, but can be modified accordingly:


 * If $$\deg P \geqslant \deg Q, $$ then it is necessary to perform the Euclidean division of P by Q, using polynomial long division, giving P(x) = E(x) Q(x) + R(x) with deg R < n. Dividing by Q(x) this gives
 * $$\frac{P(x)}{Q(x)} = E(x) + \frac{R(x)}{Q(x)},$$
 * and then seek partial fractions for the remainder fraction (which by definition satisfies deg R < deg Q).


 * If Q(x) contains factors which are irreducible over the given field, then the numerator N(x) of each partial fraction with such a factor F(x) in the denominator must be sought as a polynomial with deg N < deg F, rather than as a constant. For example, take the following decomposition over R:
 * $$\frac{x^2 + 1}{(x+2)(x-1)\color{Blue}(x^2+x+1)} = \frac{a}{x+2} + \frac{b}{x-1} + \frac{\color{OliveGreen}cx + d}{\color{Blue}x^2 + x + 1}.$$


 * Suppose Q(x) = (x − α)rS(x) and S(α) ≠ 0. Then Q(x) has a zero α of multiplicity r, and in the partial fraction decomposition, r of the partial fractions will involve the powers of (x − α). For illustration, take S(x) = 1 to get the following decomposition:
 * $$\frac{P(x)}{Q(x)} = \frac{P(x)}{(x-\alpha)^r} = \frac{c_1}{x-\alpha} + \frac{c_2}{(x-\alpha)^2} + \cdots + \frac{c_r}{(x-\alpha)^r}.$$

Illustration
In an example application of this procedure, (3x + 5)/(1 &minus; 2x)2 can be decomposed in the form


 * $$\frac{3x + 5}{(1-2x)^2} = \frac{A}{(1-2x)^2} + \frac{B}{(1-2x)}.$$

Clearing denominators shows that 3x + 5 = A + B(1 &minus; 2x). Expanding and equating the coefficients of powers of x gives


 * 5 = A + B and 3x = &minus;2Bx

Solving for A and B yields A = 13/2 and B = &minus;3/2. Hence,


 * $$\frac{3x + 5}{(1-2x)^2} = \frac{13/2}{(1-2x)^2} + \frac{-3/2}{(1-2x)}.$$

Residue method
Over the complex numbers, suppose f(x) is a rational proper fraction, and can be decomposed into


 * $$f(x) = \sum_i \left( \frac{a_{i1}}{x - x_i} + \frac{a_{i2}}{( x - x_i)^2} + \cdots + \frac{a_{i k_i}}{(x - x_i)^{k_i}} \right). $$

Let


 * $$ g_{ij}(x)=(x-x_i)^{j-1}f(x),$$

then according to the uniqueness of Laurent series, aij is the coefficient of the term (x − xi)&minus;1 in the Laurent expansion of gij(x) about the point xi, i.e., its residue


 * $$a_{ij} = \operatorname{Res}(g_{ij},x_i).$$

This is given directly by the formula


 * $$a_{ij} = \frac 1 {(k_i-j)!}\lim_{x\to x_i}\frac{d^{k_i-j}}{dx^{k_i-j}} \left((x-x_i)^{k_i} f(x)\right),$$

or in the special case when xi is a simple root,


 * $$a_{i1}=\frac{P(x_i)}{Q'(x_i)},$$

when


 * $$f(x)=\frac{P(x)}{Q(x)}.$$

Over the reals
Partial fractions are used in real-variable integral calculus to find real-valued antiderivatives of rational functions. Partial fraction decomposition of real rational functions is also used to find their Inverse Laplace transforms. For applications of partial fraction decomposition over the reals, see


 * Application to symbolic integration, above
 * Partial fractions in Laplace transforms

General result
Let f(x) be any rational function over the real numbers. In other words, suppose there exist real polynomials functions p(x) and q(x)≠ 0, such that


 * $$f(x) = \frac{p(x)}{q(x)}$$

By dividing both the numerator and the denominator by the leading coefficient of q(x), we may assume without loss of generality that q(x) is monic. By the fundamental theorem of algebra, we can write


 * $$q(x) = (x-a_1)^{j_1}\cdots(x-a_m)^{j_m}(x^2+b_1x+c_1)^{k_1}\cdots(x^2+b_nx+c_n)^{k_n}$$

where a1,..., am, b1,..., bn, c1,..., cn are real numbers with bi2 − 4ci < 0, and j1,..., jm, k1,..., kn are positive integers. The terms (x − ai) are the linear factors of q(x) which correspond to real roots of q(x), and the terms (xi2 + bix + ci) are the irreducible quadratic factors of q(x) which correspond to pairs of complex conjugate roots of q(x).

Then the partial fraction decomposition of f(x) is the following:


 * $$f(x) = \frac{p(x)}{q(x)} = P(x) + \sum_{i=1}^m\sum_{r=1}^{j_i} \frac{A_{ir}}{(x-a_i)^r} + \sum_{i=1}^n\sum_{r=1}^{k_i} \frac{B_{ir}x+C_{ir}}{(x^2+b_ix+c_i)^r}$$

Here, P(x) is a (possibly zero) polynomial, and the Air, Bir, and Cir are real constants. There are a number of ways the constants can be found.

The most straightforward method is to multiply through by the common denominator q(x). We then obtain an equation of polynomials whose left-hand side is simply p(x) and whose right-hand side has coefficients which are linear expressions of the constants Air, Bir, and Cir. Since two polynomials are equal if and only if their corresponding coefficients are equal, we can equate the coefficients of like terms. In this way, a system of linear equations is obtained which always has a unique solution. This solution can be found using any of the standard methods of linear algebra. It can also be found with limits (see Example 5).

Examples
empty

The role of the Taylor polynomial
The partial fraction decomposition of a rational function can be related to Taylor's theorem as follows. Let


 * $$P(x), Q(x), A_1(x),\ldots, A_r(x)$$

be real or complex polynomials assume that


 * $$Q=\prod_{j=1}^{r}(x-\lambda_j)^{\nu_j},$$

satisfies
 * $$\deg A_1<\nu_1, \ldots, \deg A_r<\nu_r, \quad \text{and} \quad \deg(P)<\deg(Q)=\sum_{j=1}^{r}\nu_j.$$

Also define


 * $$Q_i=\prod_{j\neq i}(x-\lambda_j)^{\nu_j}=\frac{Q}{(x-\lambda_i)^{\nu_i}}, \qquad 1 \leqslant i \leqslant r.$$

Then we have


 * $$\frac{P}{Q}=\sum_{j=1}^{r}\frac{A_j}{(x-\lambda_j)^{\nu_j}}$$

if, and only if, each polynomial $$A_i(x)$$ is the Taylor polynomial of $$\tfrac{P}{Q_i}$$ of order $$\nu_i-1$$ at the point $$\lambda_i$$:


 * $$A_i(x):=\sum_{k=0}^{\nu_i-1} \frac{1}{k!}\left(\frac{P}{Q_i}\right)^{(k)}(\lambda_i)\ (x-\lambda_i)^k. $$

Taylor's theorem (in the real or complex case) then provides a proof of the existence and uniqueness of the partial fraction decomposition, and a characterization of the coefficients.

Sketch of the proof
The above partial fraction decomposition implies, for each 1 ≤ i ≤ r, a polynomial expansion


 * $$\frac{P}{Q_i}=A_i + O((x-\lambda_i)^{\nu_i}), \qquad \text{for } x\to\lambda_i,$$

so $$A_i$$ is the Taylor polynomial of $$\tfrac{P}{Q_i}$$, because of the unicity of the polynomial expansion of order $$\nu_i-1$$, and by assumption $$\deg A_i<\nu_i$$.

Conversely, if the $$A_i$$ are the Taylor polynomials, the above expansions at each $$\lambda_i$$ hold, therefore we also have


 * $$P-Q_i A_i = O((x-\lambda_i)^{\nu_i}), \qquad \text{for } x\to\lambda_i,$$

which implies that the polynomial $$ P-Q_iA_i$$ is divisible by $$ (x-\lambda_i)^{\nu_i}.$$

For $$ j\neq i, Q_jA_j$$ is also divisible by $$(x-\lambda_i)^{\nu_i}$$, so


 * $$ P- \sum_{j=1}^{r}Q_jA_j$$

is divisible by $$Q$$. Since


 * $$ \deg\left( P- \sum_{j=1}^{r}Q_jA_j \right) < \deg(Q)$$

we then have


 * $$ P- \sum_{j=1}^{r}Q_jA_j=0,$$

and we find the partial fraction decomposition dividing by $$ Q$$.

Fractions of integers
The idea of partial fractions can be generalized to other integral domains, say the ring of integers where prime numbers take the role of irreducible denominators. For example:


 * $$\frac{1}{18} = \frac{1}{2} - \frac{1}{3} - \frac{1}{3^2}. $$