Find $\int \frac{x^2 - x}{x^2 +x + 1}dx$ I know the answer is $x - \ln|x^2 + x + 1|$ but I don't understand how to get it. Its in the partial fraction decomposition section of homework. The way the homework worked it is like this...
$$
\int \frac{2x+1}{x^2 + x + 1} \, dx
$$
I see they split it up and got the derivative of $x^2 + x + 1$ in the numerator, but I don't understand how they did that or where the other interal dx came from.

Note that $(x^2 + x + 1) - (2x + 1) = x^2 - x$. So we can rewrite as 
$$\int dx \left(1 - \frac{2x + 1}{x^2 + x + 1}\right)$$
Using $u = x^2 + x + 1$
$$x - \ln |x^2 + x + 1| + C$$
