Your goal is to "break" the fraction (x^2 + 1)/(x*(x^2 - 1))x2+1x⋅(x2−1) into several fractions.
First, do a complete factorization of the denominator: x(x^2-1) = x(x+1)(x-1)x(x2−1)=x(x+1)(x−1).
This means that you would like to find AA, BB and CC so that the following holds:
(x^2 + 1)/(x*(x+1)(x-1)) = A/x + B/(x+1) + C/(x-1)x2+1x⋅(x+1)(x−1)=Ax+Bx+1+Cx−1
First, multiply the whole equation with x*(x+1)(x-1)x⋅(x+1)(x−1) in order to get rid of the denominator. You will get:
x^2 + 1 = A(x+1)(x-1) + B(x-1)*x + C(x+1)*xx2+1=A(x+1)(x−1)+B(x−1)⋅x+C(x+1)⋅x
<=> x^2 + 1 = A (x^2 - 1) + B(x^2 - x) + C(x^2 + x)⇔x2+1=A(x2−1)+B(x2−x)+C(x2+x)
Now, the easiest way to go is to "gather" all color(red)(x^2)x2 terms, all color(blue)(x)x terms and all color(green)("terms without "x)terms without x.
Just so it's clear, your equation currently looks like this:
color(red)(x^2) + color(blue)(0 * x) + color(green)(1) = A (color(red)(x^2) + color(blue)(0 *x) color(green)( - 1)) + B(color(red)(x^2) color(blue)(- x) + color(green)(0)) + C(color(red)(x^2) + color(blue)(x) + color(green)(0))x2+0⋅x+1=A(x2+0⋅x−1)+B(x2−x+0)+C(x2+x+0)
This leads us to the following linear equation system:
the equation for x^2x2: 1 = A + B + C1=A+B+C
the equation for xx: 0 = 0 - B + C0=0−B+C
the equation for 11: 1 = -A1=−A
{ (1 = A + B + C), (0 = - B + C), (1 = -A):}
Here, we can see immediately that A = -1. Pluging the value in the first equation leads us to the following system:
{ (2 = B + C), (0 = - B + C), (-1 = A):}
Now, you can add the first and the second equation which would lead you to 2 = 2C => C = 1. Last but not least, it's easy to plug this value in a fitting equation to find out that B= 1.
This means that we have managed to compute the partial fractions:
(x^2 + 1)/(x*(x+1)(x-1)) = -1/x + 1/(x+1) + 1/(x-1)
This makes it easy to integrate:
int (x^2 + 1)/(x*(x+1)(x-1)) "d"x = - int 1/x "d"x + int 1/(x+1) "d" x + int 1/(x-1) "d" x
= - ln | x | + ln | x + 1 | + ln | x - 1 | + c.
Hope that this helped!