Integrating $\int \frac{x^2+1}{x(x^2-1)}$ How would I integrate the following.
$$\int \frac{x^2+1}{x(x^2-1)}$$
I have done the following.
$$\frac{x^2}{(x)(x+1)(x-1)}$$
$$\frac{A}{x}+\frac{B}{x+1}+\frac{C}{x-1}$$
I then did $\quad \displaystyle A(x^2-1)+B(x-1)+C(x+1)=x^2+1$
Then $\quad Ax^2-1A+Bx-1B+Cx+C=x^2+1$
Grouping I get  $$Ax^2=x^2,\quad A=1, \quad C=1,\quad Bx+Cx=0, \quad B=-1$$
Then plug back in
$$\int\frac{1}{x}-\frac{1}{x+1}+\frac{1}{x-1}$$
But I am not sure if I did it correctly.
 A: $$\frac{x^2}{(x)(x+1)(x-1)} = \frac{A}{x}+\frac{B}{x+1}+\frac{C}{x-1}$$
$$A(x^ - 1) + Bx(x-1) + Cx(x+ 1) = (A + B + C)x^2 + (-B+ C)x + -A = x^2 + 1$$
$$A + B + C = 1$$
$$C - B = 0\iff B = C$$
$$-A = 1\iff A = -1$$
Now, we have $$A = -1,\;B = C, \implies A + B + C = -1 + 2B = 1 \iff 2B = 2 \iff B = C = 1$$
Can you take it from here?
A: Indeed, you have $$\int\frac{x^2+1}{x(x^2-1)}dx=\int\frac{x^2}{x(x^2-1)}dx+\int\frac{1}{x(x^2-1)}dx$$ $$=\int\frac{x}{(x^2-1)}dx+\int\frac{1}{x(x^2-1)}dx=\int\frac{x}{(x^2-1)}dx+\int\left(\frac{1/2}{x+1}+\frac{1/2}{x-1}-\frac{1}x\right)dx$$ $$=\int\frac{du}{2u}+\int\left(\frac{1/2}{x+1}+\frac{1/2}{x-1}-\frac{1}x\right)dx$$
A: $$\frac{x^2+1}{x(x^2-1)} = \frac{(x+1)^2-2x}{x(x-1)(x+1)} = \frac{x+1}{x(x-1)} - \frac{2}{(x-1)(x+1)} = \frac{1}{x-1} + \frac{1}{x(x-1)} - \frac{(x+1)-(x-1)}{(x-1)(x+1)} = \frac{1}{x-1} + \frac{1}{x-1} - \frac{1}{x}  + \frac{1}{x+1} - \frac{1}{x-1} = \frac{1}{x-1} - \frac{1}{x}  + \frac{1}{x+1}$$
A: A simpler solution is to note that you can calculate 
$$\int \frac{x^2-1}{x(x^2-1)} \mbox{and} \int \frac{3x^2-1}{x(x^2-1)}$$
Now 
$$x^2+1=(3x^2-1)-2(x^2-1)$$
Thus, your integral is
$$\int \frac{3x^2-1}{x^3-x}- 2\int \frac{x^2-1}{x(x^2-1)}$$
