Put fraction in "arctan-friendly" form 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 $$
 A: 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$$
A: Multiply numerator and denominator by $4\cdot 2=8$ (the $2$ is the coefficient of $x^2$) and “complete the square”:
$$
\frac{1}{2x^2+x+1}=
\frac{8}{16x^2+8x+8}=
\frac{8}{16x^2+8x+1+7}=
\frac{8}{(4x+1)^2+7}
$$
Now you know that you should set $4x+1=u\sqrt{7}$, so you get
$$
\frac{8}{7}\frac{1}{u^2+1}
$$
Moreover, $4\,dx=\sqrt{7}\,du$ and the integral becomes
$$
\int\frac{8}{7}\frac{1}{u^2+1}\frac{\sqrt{7}}{4}\,du=
\frac{2}{\sqrt{7}}\int\frac{1}{u^2+1}\,du=
\frac{2}{\sqrt{7}}\arctan u+c=
\frac{2}{\sqrt{7}}\arctan\left(\frac{4x+1}{\sqrt{7}}\right)+c$$
