# Integrate reciprocal of a quadratic when the quadratic cannot be factorised

How do you go about integrating the reciprocal of a quadratic when it cannot be factorised (ruling out the use of partial fractions)?

E.g.

$$\int \frac{1}{x^2-x+1} dx$$

-
Of course every quadratic can be factored --- over the complex numbers. Then you can use partial fractions. Unfortunately, the answer you get will involve nonreal numbers, too, but some of us don't mind that. – Gerry Myerson Oct 25 '12 at 21:57

Complete the square. We get $\left(x-\dfrac{1}{2}\right)^2 +\dfrac{3}{4}$. Then make the substitution $x-\dfrac{1}{2}=\dfrac{u\sqrt{3}}{2}$.
Remark: Completing the square is often a good idea, but not always. If the quadratic factorizes nicely, factorize it and use partial fractions. Here after completing the square we got something that kind of looks like $\dfrac{1}{1+t^2}$. The substitution is meant to bring out the resemblance.
To finish the integration, we need to carry out the substitution correctly, by first observing that $dx=\dfrac{\sqrt{3}}{2}\,du$. And we need to remember that $\displaystyle\int\frac{du}{1+u^2}=\arctan u+C$.
We are, of course, assuming OP knows an antiderivative for $1/(1+t^2)$. – Gerry Myerson Oct 25 '12 at 21:55