# Integration of a rational function

stripes

## Homework Statement

find
$$\int\frac{x^{2}-2x-1}{(x-1)^{2}(x^{2}+1)}dx$$

None

## The Attempt at a Solution

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

$$x^{2}-2x-1 = A(x-1)(x^{2}+1) + B(x^{2}+1) + (Cx + D)(x-1)^{2}$$

$$x^{2}-2x-1 = Ax^{3}-Ax^{2}+Ax-A+Bx^{2}+B+Cx^{3}-2Cx^{2}+Cx+Dx^{2}-2Dx+D$$

$$x^{2}-2x-1 = x^{3}(A+B+C) + x^{2}(-A+B-2C+D) + x(A+C-2D) - A + B +D$$

so A+B+C = 0, -A+B-2C+D = 1, A+C-2D=-2 and -A+B+D=-1

solving for coefficients, we get
A = 5/3
B = -2/3
C = -1
D = 4/3

so $$\frac{x^{2}-2x-1}{(x-1)^{2}(x^{2}+1)} = \frac{5/3}{x-1} - \frac{2/3}{(x-1)^{2}} - \frac{x-(4/3)}{x^{2}+1}$$

but apparently, the last statement is not correct. Did I break down the rational function incorrectly?

Tedjn
Check A+B+C=0.

Homework Helper
i think that's ok? but -A+B-2C+D = (-5 -2 +6-4)/3 = -5/3?

Last edited:
stripes
so did I get all my coefficients messed up? Arghhh...

The Chaz
Count Iblis

Cheating to the third power

1) Obviously the Prof. doesn't want students to use Wolfram alpha.

2) The "show steps" feature adds insult to injury. Just knowing the correct answer is going to give away nontrivial information to the student.

3) And Wolfram alpha is lying to you when it shows the steps. Not that there is anything wrong in these steps, but these are not the steps Wolfram alpha uses itself when it computed the answer. If you ask Wolfram alpha to show the steps, what it does is crank up the high school algorithm that gives the same answer, as it is most likely that this will yield the desired steps (I mean, who else other than students having difficulties with their assignments would want to see this?).

Wolfram alpha uses series expansion methods to compute the answer, which is way more efficient than the usual high school method. The general rule of thumb is that methods that involve solving equations for variables are less efficient compared to methods that don't involve solving equations.

Mentor
so $$\frac{x^{2}-2x-1}{(x-1)^{2}(x^{2}+1)} = \frac{5/3}{x-1} - \frac{2/3}{(x-1)^{2}} - \frac{x-(4/3)}{x^{2}+1}$$

but apparently, the last statement is not correct. Did I break down the rational function incorrectly?
Finding the constants is tedious and error-prone, but checking them is relatively simple, and you should do this. If you get a common denominator for what you have on the right, you should end up with what you have on the left. If you do, then you have the right constants.

stripes
I ended up finding the right constants, they were 1, -1, 1, and -1 I think. Did the question again and got it right!

And as for the Wolfram Alpha thing...I use it when I am completely stumped. It gives me hints and guides me in the right direction. And this "high school method" you speak of makes me sound like a high-schooler, which I am most definitely not lolll.

Staff Emeritus
Homework Helper
One technique I like to use when solving for the coefficients is the Heaviside coverup method. When you get to this point

$$x^{2}-2x-1 = A(x-1)(x^{2}+1) + B(x^{2}+1) + (Cx + D)(x-1)^{2}$$

Substitute a value for x to eliminate some terms. In this case, x=1 works. This leaves you with $-2 = 2B$, and you can immediately see that B=-1. Ideally, you can use different values to solve to isolate different coefficients quickly. Alas, that's not the case in this problem. If you plug in the value you found for B, you get

$$2x^{2}-2x = A(x-1)(x^{2}+1) + (Cx + D)(x-1)^{2}$$

so you only have three equations and three unknowns to solve.

Count Iblis
I see! Well, this is how I would do this problem. I would start by writing:

x^2 - 2 x - 1 = x^2 - 2 x + 1 - 2 = (x-1)^2 - 2

So, we have:

(x^2 - 2 x - 1)/[(x-1)^2 (x^2 + 1)] =

1/(x^2+1) - 2/[(x-1)^2 (x^2 + 1)]

Expanding the last term about the point x = 1 and keeping only the singular terms yields:

- 2/[(x-1)^2 (x^2 + 1)] = -2/(x-1)^2 [expansion of 1/(x^2+1) around x = 1]

Put x = 1 + t:

1/(x^2+1) = 1/[(1+t)^2 + 1] = 1/(2 + 2 t + t^2) =

1/2 1/[1+t+t^2/2] = 1/2 [1-t +t^2/2 + ...]

So, we have the expansion:

- 2/[(x-1)^2 (x^2 + 1)] =

-1/(x-1)^2 + 1/(x-1) + nonsingular terms

If we now do the same at the singularities of 1/(x^2+1) and keep the singular terms, then the sum of all the singular terms from all the expansions, S(x), is the partial fraction expansion. This is because the difference between the rational function R(x) and S(x) will be a function that has no singularities, therefore it is a polynomial. But since both R(x) and S(x) tend to zero at infinity, we have that
R(x) = S(x).

So, we could now proceed to find the singular terms in the expansion around the singularities of 1/(x^2+1) at x = ±i. However, we can skip that as the partial fraction expansion is already determined by the above terms. This is because the large x behavior of

- 2/[(x-1)^2 (x^2 + 1)]

is -2/x^4, while the part of the partial fracton expansion we have so far is

-1/(x-1)^2 + 1/(x-1)

So, clearly the partial fraction expansion due to the singular terms coming from 1/(x^2+1) must cancel the asymptotic 1/x and 1/x^2 behavior of the above two terms. We know that the the remaining terms of the partial fraction expansion will be of the form:

(A x + B)/(x^2 +1)

Expanding around x = infinity gives:

(A x + B) 1/x^2 1/(1+1/x^2) =

A/x + B/x^2 + O(1/x^3)

Expanding the two terms we got so far about infinity gives:

-1/(x-1)^2 + 1/(x-1) =

-1/x^2 + 1/x 1/(1 - 1/x) + O(1/x^3) =

-1/x^2 + 1/x + 1/x^2 + O(1/x^3) =

1/x + O(1/x^3)

So, A = -1 and B = 0 and we have:

(x^2 - 2 x - 1)/[(x-1)^2 (x^2 + 1)] =

(1-x)/(x^2+1) -1/(x-1)^2 + 1/(x-1)

stripes
count iblis, B ≠ 0, B = -1

Count Iblis
count iblis, B ≠ 0, B = -1

Your B is my 1/(x-1)^2 coefficient.

Staff Emeritus
Homework Helper
I see! Well, this is how I would do this problem.
I wonder what the grader would think if stripes were to turn in his homework using that solution.

Count Iblis
I wonder what the grader would think if stripes were to turn in his homework using that solution.

It's not that different from the Heaviside coverup method you mentioned. If we have a rational function R(x) which has a linear factor in the denominator 1/(x-a)^n, then we can take that factor out and write:

R(x) = P(x) 1/(x-a)^n

So, we see that P(a) is the coefficient of 1/(x-a)^n (to do this "by the book", you would write out the equations as you did and then put x = a). To find the coeficient of 1/(x-a)^(n-1), using the Heaviside coverup method, one would subtract p(a)/(x-a)^n from R(x), simplify the rational function; you know that the numerator will contain a factor x-a that cancels against the denominator (you can use synthetic division to divide the numerator by x - a), so we can write:

R2(x) = R(x) - p(a)/(x-a)^n = P2(x)/(x-a)^(n-1)

And then we can repeat this by subtracting P2(a)/(x-a)^(n-1) from R2(x), simplify the rational function, divide numerator and denominator by x-a to obtain:

R3(x) = R2(x) - p2(a)/(x-a)^(n-1) = P3(x)/(x-a)^(n-2)

etc. etc.

But this whole process is equivalent to finding the first part of the Laurent expansion of R(x) around x = a, so you could just as well do that using any method that is most convenient, not necessarily using the above iterative process...

Count Iblis
So, in the way you wrote it down the next step would be to factor the left hand side of the last equation

2x^2 - 2x = 2x(x-1)

and cancel (x-1) on both sides:

2x = A(x^2+1) + (Cx+D) (x-1)