How to evaluate $\int \frac{x^6}{x^4-1} \, \mathrm{d}x.$ Evaluate the integral:
$$\int \frac{x^6}{x^4-1} \, \mathrm{d}x$$
After a lot of help I have reached this point:
$x^2 = Ax^3 - Ax + Bx^2 - B + Cx^3 + Cx^2 + Cx + C + Dx^3 - Dx^2 + Dx - D$
But now I don't really know how to solve for $A, B, C$, and $D$. Please help!
 A: First: Divide! Use polynomial division to get $$\frac{x^6}{x^4 - 1} = 1 + \frac{x^2}{x^4 - 1}$$ $\int 1\,dx = x + C$
For the second term:
Now factor the denominator, and decompose: $$x^4 - 1 = (x^2 + 1)(x^2-1) = (x^2 + 1)(x-1)(x+1)$$
So the set up we want for the second term is:
$$\frac{x^2}{x^4 - 1} = \dfrac{Ax + B}{x^2 + 1} +\frac{C}{x-1} + \frac D{x+1}$$
Now solve for A, B, C, D.
A: Integrand can be transformed without long divison
$$\begin{gathered}\frac{x^6}{x^4 - 1}=\frac{x^6-1+1}{x^4 - 1}=\frac{(x^2-1)(x^4+x^2+1)}{x^4 - 1}+\frac{1}{x^4 - 1}=\\
=\frac{x^4+x^2+1}{x^2 + 1} + \frac{1}{x^4 - 1}=\\
=x^2+\frac{1}{x^2 + 1}+\frac{1}{2}\left(\frac{1}{x^2-1} - \frac{1}{x^2+1} \right)=\\
=x^2 + \frac{1}{2}\left(\frac{1}{x^2-1} + \frac{1}{x^2+1} \right).
\end{gathered}$$
A: Rewrite the integrand as
\begin{align}
\frac{x^6}{x^4-1}&\stackrel{\color{red}{[1]}}=\color{darkgreen}{x^2}+\color{blue}{\frac{x^2}{x^4-1}}\\
&=\color{darkgreen}{x^2}+\color{blue}{\frac{x^2}{(x^2-1)(x^2+1)}}\\
&\stackrel{\color{red}{[2]}}=\color{darkgreen}{x^2}+\color{blue}{\frac{1}{2}\left(\color{black}{\frac{1}{x^2+1}}+\color{red}{\frac{1}{x^2-1}}\right)}\\
&=\color{darkgreen}{x^2}+\color{blue}{\frac{1}{2}\left(\color{black}{\frac{1}{x^2+1}}+\color{red}{\frac{1}{(x-1)(x+1)}}\right)}\\
&\stackrel{\color{red}{[3]}}=\color{darkgreen}{x^2}+\color{blue}{\frac{1}{2}\left(\color{black}{\frac{1}{x^2+1}}+\color{red}{\frac12\left[\frac1{x-1}-\frac1{x+1}\right]}\right)}\\
&=x^2+\color{red}{\underbrace{\color{black}{\frac{1}{2(x^2+1)}}}_{\color{blue}{\large \color{black}{\text{set}}\ x=\tan\theta}}}+\color{red}{\underbrace{\color{black}{\frac1{4(x-1)}}}_{\color{blue}{\large \color{black}{\text{set}}\ u=x-1}}}-\color{red}{\underbrace{\color{black}{\frac1{4(x+1)}}}_{\color{blue}{\large \color{black}{\text{set}}\ v=x+1}}}
\end{align}

Notes :
$\color{red}{[1]}\;\;\;$Polynomial long division
$\color{red}{[2]}\text{ and }\color{red}{[3]}\;\;\;$Partial fractions decomposition
