<s>[INST] 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?
 [/INST] 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}$$
</s>