<s>[INST] 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.
 [/INST] $$\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?
</s>