help me to evaluate these integrals Find the value of $$\int\frac{x}{x^2-x+1} dx$$ and $$\int\frac{1}{x^2-x+1} dx$$ This was not the original question. Original question was tougher and I have simplified that to these two integrals. I am having a hard time evaluating these two integrals but what I know is that, in these two integrals there is arctan occurring in a term of both integrals. Maybe we have to do some operations in the numerators?
Any help will be greatly appreciated.
EDIT: The original question was: $$\int\frac{3x}{x^3+1}dx$$
EDIT: $$\begin{align}\int\frac{3x}{x^3+1}dx&=3\int\frac{x}{x^3+1}dx\\&=3\int\frac{x+1}{3x^2-3x+3}dx - 3\int\frac{1}{3x+3}dx\\&=\int\frac{x+1}{x^2-x+1}dx - \int\frac{1}{x+1}dx\end{align}$$
The value of last integral is $\ln|x+1|$ so we will consider it later. We will only consider the first integral now and we can write that as:
$$\int\frac{x}{x^2-x+1}dx + \int\frac{1}{x^2-x+1}dx$$ after this I am stuck.
 A: For the second one: A common method would be: complete the square in the denominator...
$$
x^2-x+1 = x^2 - x + \frac14+\frac34
=\left(x-\frac12\right)^2+\frac34
$$
Substitute $x-\frac12 = y$.
$$
\int\frac{1}{x^2-x+1}\;dx = \int\frac{1}{y^2+(\sqrt{3}/2)^2}\;dy
$$
recognize an arctangent integral
$$
=\frac{2}{\sqrt{3}}\arctan\left(\frac{2}{\sqrt{3}}y\right)+C
=\frac{2}{\sqrt{3}}\arctan\left(\frac{2x-1}{\sqrt{3}}\right)+C
$$
A: Integral No. 1
$$\int \frac{dx}{x^2-x+1}= \int \frac{dx}{(x-\frac12)^2+\frac34}$$ Substitute $x-\frac12=t$ so $du = dt$. The integral becomes $$\int \frac{dt}{(t^2+\frac34)}=\frac{2}{\sqrt3}\arctan\frac{t}{\frac{\sqrt3}{2}}+c= \frac{2}{\sqrt3}\arctan\frac{2(x-\frac12)}{\sqrt3}+c = \frac{2}{\sqrt3}\arctan\frac{2x-1}{\sqrt3}+c .$$
Integral No. 2
$$\int \frac{xdx}{x^2-x+1}= \int \frac{x-\frac12+\frac12}{x^2-x+1}dx= \int \frac{x-\frac12+\frac12}{(x-\frac12)^2+\frac34}dx$$$$= \int \frac{x-\frac12}{(x-\frac12)^2+\frac34}dx+ \int \frac{\frac12}{(x-\frac12)^2+\frac34} dx $$ Now the second part is half of the first integral itself. For the first part, substitute $(x-\frac12)^2+\frac34=m$ and you should be able to finish it.
EDIT: After the m substitution, $2(x-\frac12)dx=dm$ so $(x-\frac12)dx=\frac{dm}{2}$. So the integral now is : $$\int \frac{dm}{2m}=\frac 12 \ln m + c=\frac12\ln(x^2-x+1)+c.$$
A: The real problem is the second integral since the first one has the form
\begin{align}
\int{{x \over x^2-x+1}dx} & = \int{{x-{1 \over 2} \over x^2-x+1}dx}+{1 \over 2}\int{{1 \over x^2-x+1}dx} \\
& = {1 \over 2}\int{{1 \over x^2-x+1}d(x^2-x+1)}+{1 \over 2}\int{{1 \over x^2-x+1}dx} \\
& = {1 \over 2}\bigg(\log{(x^2-x+1)}+\int{{1 \over x^2-x+1}dx}\bigg)
\end{align}
To solve the second one, we notice $\int{{1 \over y^2+1}dy}=\int{{1 \over \tan^2{\theta}+1}d\tan{\theta}}=\int{{1 \over \sec^2{\theta}}\sec^2{\theta}d\theta}=\theta=\arctan{y}$. Therefore, it is easy with
\begin{align}
\int{{1 \over x^2-x+1}dx} & = \int{{1 \over (x-{1 \over 2})^2+{3 \over 4}}d(x-{1 \over 2})} \\
& = \sqrt{4 \over 3}\int{{1 \over \bigg(\sqrt{4 \over 3}(x-{1 \over 2})\bigg)^2+1}d\bigg(\sqrt{4 \over 3}(x-{1 \over 2})}\bigg) \\
& = \sqrt{4 \over 3}\arctan{\bigg(\sqrt{4 \over 3}(x-{1 \over 2})\bigg)}
\end{align}
A: Response transferred from the comments, per the request of the original poster.

Your 2nd question broaches an underlying issue.  My Calculus book specifies that for rational functions :
$$\int \mathbf{R}\left[x, \sqrt{a^2 + (cx + d)^2}\right] ~dx,$$
you use the substitution
$$~(cx + d) = a\tan(t).~$$
$$x^2 - x + 1 = \left(\frac{\sqrt{3}}{2}\right)^2 + \left(x - \frac{1}{2}\right)^2.$$
The point of this response is that your Calculus teacher/book/class should never ask you to re-invent the wheel.  This type of formula should be handed to you in advance of your trying to attack such a problem.  If that is not the case, you are using/in the wrong book/class/teacher.
