TITLE: How to calculate $\int\frac{x}{x^2-x+1}\, dx$?
QUESTION [5 upvotes]: $$\int \frac{x}{x^2-x+1}\,  dx = \int \frac{x}{(x-\frac 1 2)^{2} + \frac 3 4}\,  dx = \int \frac{x}{(x-\frac 1 2)^2 + (\frac {\sqrt{3}} {2})^2}$$
Substitute $u= \frac{2x-1}{\sqrt{3}}, du=\frac{2}{\sqrt{3}}dx$:
$$\frac {\sqrt{3}} 2 \int \frac{\frac{\sqrt{3}} {2}u + \frac 1 2}{(\frac{\sqrt{3}}{2}u)^2+(\frac {\sqrt{3}}{2})^2} = \int \frac{u}{u^2+1}du  + \frac{1}{\sqrt{3}}\int\frac 1 {u^2+1}du.$$
This gives $$\frac 1 2\log({u^2+1})+\frac{1}{\sqrt{3}}\arctan{u}.$$ 
Substituting back in x yields $$\frac 1 2\log(\frac 4 3x^2-\frac 4 3 x+ \frac 4 3)+\frac 1 {\sqrt{3}}\arctan(\frac{2x-1}{\sqrt{3}})$$
However, according to Wolfram Alpha, the integral should evaluate to $$\frac 1 2 \log(x^2-x+1)+\frac{1}{\sqrt{3}}\arctan(\frac{2x-1}{\sqrt{3}})$$After working some time on the integral, I know how to reach this solution, but I don't understand why my first attempt didn't arrive at the correct answer. Do you see where I went wrong? 
Thank you for any help!

REPLY [5 votes]: Both of the answers are correct. You have forgotten to add the integration constants in the solutions.
The first solution $\dfrac 12 \ln \left(\dfrac 43 x^2 -\dfrac 43 x +\dfrac 43\right) +\dfrac{1}{\sqrt 3}\arctan \left(\dfrac{2x-1}{\sqrt 3}\right) + C$ can be written as  $\dfrac 12 \ln \left( x^2 - x +1\right)+\dfrac{1}{2} \ln \left(\dfrac 43\right)+\dfrac{1}{\sqrt 3}\arctan \left(\dfrac{2x-1}{\sqrt 3}\right) + C$ which is equal to $\dfrac 12 \ln \left( x^2 - x +1\right)+\dfrac{1}{\sqrt 3}\arctan \left(\dfrac{2x-1}{\sqrt 3}\right) + C'$.
So, this is basically it. The both answers are correct. Only their constants of integration are different.