Long division, explain the result! I have this: $$ \frac{x^2}{x^2+1} $$ Wolfram Alpha suggests that I should do long division to get this: $$ 1- \frac{1}{x^2+1} $$ But I don't understand how it can be that, please explain.
 A: While this can be done "by inspection" it is instructive to recall the key idea of the polynomial division algorithm: $\rm\color{#c00}{scale}$ the divisor so that it has the same degree and leading coef as the dividend, then subtract it from the dividend, thereby canceling the leading term of the dividend; then recursively apply this process to the smaller degree remaining part of the dividend, viz.
$$  (a x^{k+n} + f) - \color{#c00}{a x^k} (x^n + g)\ =\ f-ax^kg$$
$$\ \Rightarrow\ \dfrac{a x^{k+n}+f}{x^n+g}\, =\ \color{#c00}{a x^k} +\!\!\! \underbrace{\dfrac{f-ax^k g}{x^n + g}}_{\large\rm recurse\ on\ this}$$
where the second equation arises from the first by dividing through by $\,x^n + g.$
In your example the dividend and divisor already have the same degree and same lead coef, therefore we cancel the leading term of the dividend by simply subtracting them
$$  x^2 -\color{#c00}{1}\cdot(x^2 +1)\ =\ \color{#0a0}{{-1}} $$
$$\Rightarrow\ \ \dfrac{x^2}{x^2+1}\ =\ \color{#c00}1+\dfrac{\color{#0a0}{-1}}{x^2+1}$$
A: This is the calculation taking place:
$$\frac{x^2}{x^2 + 1} = \overbrace{\frac{x^2 + 1 -1}{x^2 + 1}}^{Adding\,+1-1} = \underbrace{\frac{x^2 + 1}{x^2 + 1}}_{=1} - \frac{1}{x^2 + 1} = 1 - \frac{1}{x^2 + 1}$$
