Transform $\int \frac{x^2}{x - 2}$ to $ \int x +\frac{4}{x-2} + 2 $ I was trying to solve the following integral and I failed so I went to wolframalpha to see the step by step solution, but the following transformation is confusing me.
$\int \frac{x^2}{x - 2} = \int x +\frac{4}{x-2} + 2  $
I am unable to do the transformation by myself. Could you please explain the steps  to get from $\int \frac{x^2}{x - 2} $ to $\int x +\frac{4}{x-2} + 2  $ ? The step is labeled as a "long division", but I have no idea what that means.
 A: You'd need to do polynomial division.

Therefore your answer would be 
$$x^2 \div (x-2)=x+2+\frac{4}{x-2}$$
Note: polynomial division uses the same principle as regular division when you have a remainder. 
A: First you want to reduce the rational function by polynomial division to get
$$
\frac{x^2}{x - 2} = \frac{x^2 - 2x + 2x}{x - 2} = x + \frac{2x}{x - 2}
$$
Then you want to perform partial fractions to reduce the resulting rational function to get
$$
\frac{2x}{x - 2} = \frac{ 2x - 4 + 4 }{ x - 2 } = 2 + \frac{4}{x - 2}
$$
Now I did some tricks to avoid longer calculations, but these steps are the steps you want to follow.
A: You can rewrite the expression in exactly the same way you normally complete the square: $x^2 = (x^2 - 4x + 4) + 4x - 4 = (x-2)^2 + 4x-4$.
Then work with the linear terms in the same way: $4x - 4 = 4(x-2) + 8 - 4 = 4(x-2) + 4$.
Put it together to get $x^2 = (x-2)^2 + 4(x-2) + 4$.
Then you can throw in your denominator of $x-2$ and simplify:
$$\boxed{\frac{x^2}{x-2}} = \frac{(x-2)^2 + 4(x-2) + 4}{x-2} = (x-2 ) + 4 + \frac{4}{x-2} = \boxed{x + \frac{4}{x-2} + 2}$$
as desired.
A: I think it is easy and clear that:
$$\dfrac{x^2}{x-2}=\dfrac{x^2-4+4}{x-2}=\dfrac{(x-2)\cdot(x+2)}{x-2}+\dfrac{4}{x-2}=x+2+\dfrac{4}{x-2}$$ 
You can divide the polynomials or make the division by shape Horner, etc. Then, it is easy to calculate the integral.
