Example 3. Find the integral $\int \frac{x}{x^{3}+1} d x$.
Solution. In this case

$$
Q(x)=x^{3}+1=(x+1)\left(x^{2}-x+1\right)
$$

and the second factor does not factor further over the reals.

Based on formula (4.29), the decomposition of the given fraction is

$$
\frac{x}{x^{3}+1}=\frac{A}{x+1}+\frac{B x+C}{x^{2}-x+1}
$$

from which we have

$$
x=A\left(x^{2}-x+1\right)+(B x+C)(x+1)
$$

By setting $x=-1, x=0, x=1$ sequentially, we get

$$
\begin{gathered}
-1=A[1-(-1)+1] \text { or }-1=3 A \\
0=A(0-0+1)+(B \cdot 0+C)(0+1) \text { or } 0=A+C \\
1=A(1-1+1)+(B+C)(1+1) \text { or } 1=A+2 B+2 C
\end{gathered}
$$

From the system of equations

$$
-1=3 A ; A+C=0 ; A+2 B+2 C=1
$$

we find

$$
A=-\frac{1}{3}, C=\frac{1}{3}, B=\frac{1}{3}
$$

Thus,

$$
\frac{x}{x^{3}+1}=-\frac{1}{3(x+1)}+\frac{1}{3} \cdot \frac{x+1}{x^{2}-x+1}
$$

## Integrating

$$
\int \frac{x}{x^{3}+1} d x=-\frac{1}{3} \int \frac{d x}{x+1}+\frac{1}{3} \int \frac{x+1}{x^{2}-x+1} d x
$$

Consider the second integral on the right-hand side of equation (A):

$$
\begin{aligned}
& \frac{1}{3} \int \frac{x+1}{x^{2}-x+1} d x=\frac{1}{3} \int \frac{x+1}{\left(x^{2}-2 \cdot \frac{1}{2} x+\frac{1}{4}\right)-\frac{1}{4}+1} d x= \\
& =\frac{1}{3} \int \frac{x-\frac{1}{2}+\frac{1}{2}+1}{\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4}} d x=\frac{1}{3} \int \frac{\left(x-\frac{1}{2}\right)}{\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4}} d\left(x-\frac{1}{2}\right)+ \\
& +\frac{1}{3} \int \frac{\frac{3}{2}}{\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4}} d x=\frac{1}{3} \int \frac{\frac{1}{2} d\left[\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4}\right]}{\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4}}+ \\
& +\frac{1}{2} \int \frac{d\left(x-\frac{1}{2}\right)}{\left(x-\frac{1}{2}\right)^{2}+\left(\frac{\sqrt{3}}{2}\right)^{2}}= \\
& =\frac{1}{6} \ln \left[\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4}\right]+\frac{1}{2 \cdot \frac{\sqrt{3}}{2}} \operatorname{arctg} \frac{x-\frac{1}{2}}{\frac{\sqrt{3}}{2}}+C
\end{aligned}
$$

Thus,

$$
\frac{1}{3} \int \frac{x+1}{x^{2}-x+1} d x=\frac{1}{6} \ln \left(x^{2}-x+1\right)+\frac{1}{\sqrt{3}} \operatorname{arctg} \frac{2 x-1}{\sqrt{3}}+C
$$

Furthermore, since

$$
-\frac{1}{3} \int \frac{d x}{x+1}=-\frac{1}{3} \ln |x+1|
$$

then equation (A), taking into account (B) and (C), becomes

$$
\int \frac{x}{x^{3}+1} d x=-\frac{1}{3} \ln |x+1|+\frac{1}{6} \ln \left(x^{2}-x+1\right)+
$$

$$
+\frac{1}{\sqrt{3}} \operatorname{arctg} \frac{2 x-1}{\sqrt{3}}+C
$$