How would I integrate the following:
$$\int \frac{x^2}{x^2-4}\ dx$$
We have covered three techniques for integration: substitution, integration by parts and partial fractions. I have tried partial fractions by writing:
\begin{align} \frac{x^2}{x^2-4}&=\frac{A}{x-2}+\frac{B}{x+2} \\[6pt] x^2&=A(x+2)+B(x-2) \end{align}
And solving for $A$ and $B$, but I don't know how to deal with the $x^2$. Substitution doesn't seem to work either as I would be left with an $x$ if I substituted $u=x^2-4$.
This came up on an old exam paper that I was doing to prepare for my upcoming exam.

By division, $$\dfrac{x^2}{x^2 - 4} = 1 + \frac{4}{x^2 - 4}$$
You can do partial fractions on the latter, or else use the substitution $$x = 2 \sec \theta \implies dx = 2\sec \theta \tan \theta \,d\theta$$ in the second integral, and recall that $\sec^2\theta - 1 = \tan^2 \theta$