Let's factorise the denominator
x(x^2-1)=x(x+1)(x-1)x(x2−1)=x(x+1)(x−1)
So, let's do the decomposition into partial fractions
(x^2+1)/(x(x^2-1))=(x^2+1)/(x(x+1)(x-1))x2+1x(x2−1)=x2+1x(x+1)(x−1)
=A/x+B/(x+1)+C/(x-1)=Ax+Bx+1+Cx−1
=(A(x+1)(x-1)+B(x)(x-1)+C(x)(x+1))/(x(x+1)(x-1))=A(x+1)(x−1)+B(x)(x−1)+C(x)(x+1)x(x+1)(x−1)
The denominators are the same, so, we can equalise the numerators
x^2+1=A(x+1)(x-1)+B(x)(x-1)+C(x)(x+1)x2+1=A(x+1)(x−1)+B(x)(x−1)+C(x)(x+1)
Let x=0x=0, =>⇒, 1=-A1=−A, =>⇒, A=-1A=−1
Let x=-1x=−1, =>⇒, 2=2B2=2B, =>⇒, B=1B=1
Let x=1x=1, =>⇒, 2=2C2=2C, =>⇒, C=1C=1
Therefore,
(x^2+1)/(x(x^2-1))=-1/x+1/(x+1)+1/(x-1)x2+1x(x2−1)=−1x+1x+1+1x−1
So, we can do the integration
int((x^2+1)dx)/(x(x^2-1))=-intdx/x+intdx/(x+1)+intdx/(x-1)∫(x2+1)dxx(x2−1)=−∫dxx+∫dxx+1+∫dxx−1
=-ln(|x|)+ln(|x+1|)+ln(|x-1|)+C=−ln(|x|)+ln(|x+1|)+ln(|x−1|)+C