Integral of rational function with higher degree in numerator

How do I integrate this fraction:

$$\int\frac{x^3+2x^2+x-7}{x^2+x-2} dx$$

I did try the partial fraction decomposition:

$$\frac{x^3+2x^2+x-7}{x^2+x-2} = \frac{x^3+2x^2+x-7}{(x-1)(x+2)}$$

And:

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

Then:

$$\ A(x+2) + B(x-1)= x^3+2x^2+x-7$$

When I do this I gets a wrong answer, so I figured out that this may only work when the degree of the denominator is greater than the degree of the numerator...

So how do I integrate such a fraction?


Solution 1:

You need to use polynomial long division, first, so the degree in the numerator is less than that of the denominator to get

$$I = \int \left(x+1 + \dfrac{2x-5}{x^2 + x-2}\right)\,dx$$

THEN you can use partial fraction decomposition given the factors you found for the denominator.

$$I = \frac {x^2}{2} + x + \left( I_2 = \int \frac{(2x-5)\,dx}{(x+2)(x-1)}\right)$$

$$I_2 = \int \left(\dfrac A{x+2} + \frac B{x-1}\right) \,dx$$


So we want to solve for the coefficients $A, B$, given the fact that

$$A(x-1) + B(x+2) = 2x - 5$$

At $x = 1,\quad A(0) + B(3) = 2-5=-3 \implies B = -1$

At $x = -2, \quad -3A = -9 \implies A = 3$.

Can you take it from here?

Solution 2:

You can do the partial fraction expansion in a more efficient and less error prone way than the standard high school method, which also helps to safe effort in cases where the degree of the numerator is larger than that of the denominator. For a given rational function Q(x) you consider the behavior near its singular points $x_1$, $x_2$, etc.

$$Q(x) = \frac{A_r}{\left(x-x_1\right)^r} + \frac{A_{r-1}}{\left(x-x_1\right)^{r-1}}+\cdots$$

$$Q(x) = \frac{B_s}{\left(x-x_2\right)^s} + \frac{B_{s-1}}{\left(x-x_2\right)^{s-1}}+\cdots$$

Then consider the rational function P(x) defined as:

$$P(x)= Q(x) - \left[\frac{A_r}{\left(x-x_1\right)^r} + \frac{A_{r-1}}{\left(x-x_1\right)^{r-1}}+\cdots\right] - \left[\frac{B_s}{\left(x-x_2\right)^s} + \frac{B_{s-1}}{\left(x-x_2\right)^{s-1}}\right]-\cdots$$

where we have subtracted from Q(x) the singular terms of each expansion. Then P(x) only has removable singularities at the singular points of Q(x), so we can define P(x) at those points by taking the appropriate limits. P(x) is then a rational function without any singularities, which is therefore a polynomial.

To find P(x), we only need to compute its behavior at infinity, which requires less computations that a fully fledged long division. If the degree of the numeator of Q(x) were less than that of the denominator, then P(x) must be zero. If not then one needs to compute P(x). One can interpret that case as there being a singularity at infinity. Expanding Q(x) around infinity involves expanding in powers of 1/x, negative powers of this expansion parameter are positive powers of x. So, the singular terms of the expansion around infinity is the polynomial P(x).

This means that one can state that, in general, the partial fraction expansion of a rational function Q(x) is given by the sum of all the singular parts of all the expansions around all the singular points.

In this case you have that around x = 1 the singular behavior is given as A/(x-1), and to compute A you only need to substitute x = 1 in the numerator and the 1/(x+2) factor of the denominator. So, you don't need to do the long division first before you do this computation (obviously the outcome of that long division, when expanded in powers of x-1 cannot yield singular terms). This eliminates a potential source of errors, if you do the long expansion wrong, that error would also affect the result you get for A.

So, we see that A = -1

Then the singular behavior near x = -2 is easily found to be 3/(x+2).

We then need to find the behavior around infinity. You can compute this by doing long division, but unlike doing partial fractions in the "high school way" we don't need the remainder, so all the powers less than 2 in the numerator can be ignored. We can see that the leading behavior for large x is x, and if you subtract x times the denominator from the numerator, you are left with a term that starts with x^2, which yields that large x behavior of 1, and we're not interested in anything that comes after that. Therefore, the partial fraction expansion is given by

$$x+1 + \frac{3}{x+2} - \frac{1}{x-1}$$