I would like to put $\int\frac{1}{(2x^2+x+1)}dx$ into something like $\int\frac{1}{(u^2+1)}dx$. What is the quickest way to proceed? I know that previous fraction can be rewritten as $2t^2+t+1 = \frac{7}{8}\left( \left( \frac{4t+1}{\sqrt{7}} \right)^2 +1 \right)$, but I don't have any explaination from where this comes from.
Finally, the integral yields $$\int_b^a \frac{7}{8} \left( \left(\frac{4t+1}{\sqrt{7}} \right)^2+1 \right)dt = \frac{2}{\sqrt{7}}\left[\arctan \left(\frac{4t+1}{\sqrt{7}}\right)\right]^a_b $$
Note that $$(ax+b)^2=a^2x^2+2abx+b^2$$ Now we want to complete the square on $2x^2+x+1$. We then have $a^2=2, 2ab=1 $ $\implies 4a^2b^2=1 \implies b^2=\frac 1 8$. Thus, we write $$2x^2+x+1 = \left(2x^2+x+\frac 1 8\right)+\frac 7 8 = \left(\sqrt 2 x+\frac{1}{2\sqrt 2}\right)^2+\frac 7 8$$ Thus, letting $\sqrt2 x+\frac{1}{2\sqrt 2}=\sqrt{\frac 7 8}\tan\theta$, our integral becomes $$\int \frac{1}{\frac 7 8 \tan^2 \theta+\frac 7 8}\cdot \frac {\sqrt{7}} 4\sec^2\theta d\theta$$