Solution:
Key idea: Divide first when the degrees are equal, then split the proper fraction into partial fractions.
Step 1 — Divide, because the degrees are equal.
We write the numerator as (x2−1)+2.
x2−1x2+1=x2−1(x2−1)+2=1+x2−12
Step 2 — Split the proper fraction.
Since (x+1)−(x−1)=2, the fraction (x−1)(x+1)2 splits as a difference.
(x−1)(x+1)2=x−11−x+11
Step 3 — Integrate term by term.
The constant gives x and each fraction gives a log term.
∫x2−1x2+1dx=x+log∣x−1∣−log∣x+1∣+C=x+logx+1x−1+C
Therefore, ∫x2−1x2+1dx=x+logx+1x−1+C, for x=±1.