How do I integrate $\frac1{x^2+x+1}$?

I have tried this:

$$\frac1{x^2+x+1} = \frac1{\left( (x+\frac12)^2+\frac34\right)}$$

Now $$u = x+\frac12$$

$$\frac1{ u^2+\frac34 }$$ Now multiply by $$\frac34$$

$$\frac1{ \frac43 u^2 + 1}$$

Now put the $$\frac43$$ outside the integral

$$\frac34 \int \frac1{u^2+1}\,du=\frac34\arctan(u)=\frac34\arctan(x+1/2)$$

But the result is not the same result calculated by computers.

What did I do wrong?

I don't know where my wrong calculation is. The way should be correct to get to the result.

Edit:

So now

$$\int \frac{1}{x^2+x+1}=\int \frac{1}{(x+\frac{1}{2})^2}= \int \frac{4}{3} \frac{1}{\frac{4}{3}(x+\frac{1}{2})^2+1}$$ u=x^2+1/2 $$\int \frac{4}{3} \frac{1}{\frac{4}{3}(u)^2+1}$$

$$\int \frac{4}{3} \frac{1}{\frac{4u^2}{3}+1}$$

$$\int \frac{4}{3} \frac{1}{\frac{2u^2}{\sqrt{3}}+1}$$

Now it is:

$$\frac{4}{3} \int \frac{1}{\frac{2u^2}{\sqrt{3}}+1}$$

$$=\frac{4}{3} * arctan(2*(x^2+1/2)/(\sqrt{3}))$$

Why is this still not the same as the computer calculated solution?

• Please use MathJax to render your math equations – Shubhrajit Bhattacharya Jul 30 '20 at 23:06
• $\dfrac1{u^2+\frac34}$ is not the same as $\dfrac1{\frac43u^2+1}$, which is not the same as $\dfrac34\dfrac1{u^2+1}$ (try $u=0$, for example) – J. W. Tanner Jul 30 '20 at 23:27
• @ShubhrajitBhattacharya how do I use mathjax here? I just know LaTex – Rapiz Jul 30 '20 at 23:58
• @Rapiz go here math.meta.stackexchange.com/questions/5020/… – Shubhrajit Bhattacharya Jul 31 '20 at 0:08
• Also MathJax is almost same as LaTeX except some differences that you will come across if you continue to use MathJax – Shubhrajit Bhattacharya Jul 31 '20 at 0:10

Note that $$\frac{1}{u^2+3/4}=\frac{1}{\frac34((2u/\sqrt 3)^2+1)}=\frac43 \frac{1}{v^2+1}$$
where $$v=2u/\sqrt 3$$. Can you finish now?
• Again we have $$\frac1{u^2+3/4}=\frac{4/3}{4/3}\frac1{u^2+3/4}=\frac{4/3}{4u^2/3+1}=\frac43 \frac1{(2u/\sqrt 3)^2+1}$$ – Mark Viola Jul 30 '20 at 23:17
• @Rapiz Multiplying top and bottom by $4/3$ gives $\frac{4}{3} \frac{1}{(4/3) u^2+1}$. You can't just multiply the bottom alone by $4/3$, that would change the result. – Ian Jul 30 '20 at 23:18
• @Rapiz No, because now you've changed the integrand, that's what I was trying to say. If you want to multiply the bottom by $4/3$ (so as to make the $3/4$ into a $1$ without factoring the way that Mark Viola did) then you have to do the same to the top. – Ian Jul 30 '20 at 23:22
• Is the ratio $\frac{a}{b}=\frac{a}{(4/3)b}$? It isn't. But we can write $$\frac ab=\frac{(4/3)a}{(4/3)b}$$ – Mark Viola Jul 30 '20 at 23:23
• You cannot simply multiply the denominator by $4/3$ and not do the same to the numerator. The integrand IS a ratio. It is $\frac1{u^2+3/4}$. So, here $a=1$ and $b=u^2+3/4$. Now how can we preserve equality? We can multiply by $1=\frac{4/3}{4/3}$. – Mark Viola Jul 30 '20 at 23:27