Solving an integral: $\int \frac{x}{x^3-1}\,\mathrm dx$ I'm trying to solve this integral:
$$\int \frac{x}{x^3-1}\,\mathrm dx$$
What I did was:
$$\int \frac{x}{(x-1)(x^2+x+1)}\,\mathrm dx.$$
$$\frac{x}{(x-1)(x^2+x+1)} = \frac{a}{x-1}+ \frac{bx+c}{x^2+x+1}$$
Then I got this in the numerator:
$$ax^2+ax+a+bx^2-bx+cx-c $$
$$a+b=0;a-b+c=1; a-c=0 $$
$$a=c=\frac{1}3 \qquad b=-\frac{1}3$$
Then I wrote:
$$\frac{1}3\int \frac{1}{x-1}\,\mathrm dx-\frac{1}3\int\frac{x-1}{x^2+x+1} \, \mathrm dx$$
so the first one is just $\frac{1}{3}\ln|x-1|$. Which makes my calculations already wrong, most likely.
With the second one I tried a few different things ( involving u-substitution mostly) and got stuck.
I know I'm supposed to get this:
$$\frac{1}6\ln \frac{(x-1)^3}{x^2+x+1}+\frac{1}{\sqrt{3}} \arctan\frac{2x+1}{\sqrt{3}}$$
What have I already done wrong? What am I supposed to do?
 A: Hint:
$$\int\dfrac{x - 1}{x^2 + x + 1}\,\mathrm dx\equiv\int\dfrac{2x + 1}{2(x^2 + x + 1)} - \dfrac{3}{2(x^2 + x + 1)}\,\mathrm dx$$
Then, let $u = x^2 + x + 1\implies\mathrm du = 2x + 1\,\mathrm dx$. So,
$$\int\dfrac{2x + 1}{x^2 + x+ 1}\,\mathrm dx\equiv\int\dfrac1u\,\mathrm du.$$
Notice that $$\int\dfrac1{x^2 + x + 1}\,\mathrm dx\equiv\int\dfrac1{\left(x + \frac12\right)^2 + \frac34}\,\mathrm dx$$
Let $v = \dfrac{2x + 1}{\sqrt3}\implies\mathrm dx=\dfrac{\sqrt3}2\,\mathrm dv$. So,
$$\int\dfrac1{\left(x + \frac12\right)^2 + \frac34}\,\mathrm dx\equiv\dfrac2{\sqrt3}\int\dfrac1{v^2 + 1}\,\mathrm dv.$$
Edit:
$$\begin{align}\left(x + \dfrac12\right)^2 + \dfrac34 = \left(\dfrac{2x + 1}2\right)^2 + \dfrac34 &= \dfrac14\left(3\left(\dfrac{2x + 1}{\sqrt 3}\right)^2 + 3\right) \\ &= \dfrac34\left(\left(\dfrac{2x + 1}{\sqrt 3}\right)^2 + 1\right)\end{align}$$
A: You did right, but gave up soon. For
$$\int\frac{x-1}{x^2+x+1}$$
write
$$\frac{x-1}{x^2+x+1}=\frac{1}{2}\frac{2x-2}{x^2+x+1}=\frac{1}{2}\frac{2x+1}{x^2+x+1}
+\frac{1}{2}\frac{-3}{x^2+x+1}$$
then the integral becomes
$$\int\frac{x-1}{x^2+x+1}dx=\frac{1}{2}\ln(x^2+x+1)+\frac{3}{2}\int\frac{dx}{x^2+x+1}$$
and then...
A: You can write that
$$
x^2+x+1=\left(x+\frac{1}{2}\right)^2+\frac{3}{4}=\frac{3}{4}\left(1+\left(\frac{2}{\sqrt{3}}\left(x+\frac{1}{2}\right)\right)^2\right)
$$
and you can then put your fraction under the form
$$
\frac{u'}{1+u^2}
$$
that integrated to an arctan.
A: The second integral can be carried as follows,
$$\int\frac{1-x}{x^2+x+1}dx=\int\frac{-(x+\frac12)+\frac32}{(x+\frac12)^2+\frac34}dx$$
$$=-\frac12\int\frac{d[(x+\frac12)^2]}{(x+\frac12)^2+\frac34}
+\frac32\int\frac{dx}{(x+\frac12)^2+\frac34}$$
$$=-\frac12\ln\left[(x+\frac12)^2+\frac34\right]+\frac{1}{\sqrt{3}}\arctan\frac{2x+1}{\sqrt{3}}$$
