I am trying to evaluate the following integral: $$I=\int \frac{dx}{x^2+x+1}$$
I am not supposed to do it with complex numbers so it's kind of hard. I checked the answer on WolframAlpha.
It gives $$I=\frac{\sqrt{3}}{2}\arctan{\left(\frac{\sqrt{3}}{2}x+\frac{1}{2}\right)}+C $$
Having this information I found that I need to set
$$t=\frac{\sqrt{3}}{2}x+\frac{1}{2}$$
consequently: $x^2+x+1=\frac{3}{4}(t^2+1)$ and $dx=\frac{\sqrt{3}}{2}dt$
therefore: $$I=\frac{2}{\sqrt{3}} \int \frac{dt}{t^2+1}$$ which can be found easily by setting $t=\tan{\theta}$ giving the same answer stated above.
Practically, I cheated: if I had not known the final answer I would have not guessed what I needed to set as $t$.
My question is: how should I think in order to find this integral?
Is there a method to find integrals of the form $$\int \frac{dx}{ax^2+bx+c}$$
Without knowing the answer, how can I solve such integral?
Thanks
It's not that hard: \begin{align*}\int\frac1{x^2+x+1}dx&=\int\frac1{(x+1/2)^2+3/4}dx=\frac43\int\frac1{(ax+b)^2+1}dx\\&=\frac43\int\frac1{y^2+1}\cdot\frac1ady=\frac4{3a}\arctan y,\end{align*} where $y= ax+b$. Now compute $a,b$ and substitute back to get the result.
The general method is $\int\frac1{(ax+b)^2}=-\frac1a\frac1{ax+b}$ if it the denominator is a square, partial fractions if it has two real roots and completing the square and using $\arctan$ otherwise.