# Would like to solve this integral but it kind of messy especially when it comes to end?

## $\int \frac{x}{{x}^{2} + x + 1} \mathrm{dx}$ please include explanations on where you do the substitutions and all factoring

Jun 5, 2018

$\int \frac{x}{{x}^{2} + x + 1} \mathrm{dx} = \frac{1}{2} \ln \left({x}^{2} + x + 1\right) - \frac{1}{\sqrt{3}} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$

#### Explanation:

First we examine the denominator: as the determinant:

$\Delta = 1 - 4 = - 3 < 0$

is negative, the denominator cannot be factorized.

So, we split the integrand, by obtaining at the numerator the derivative of the denominator, and compensating:

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

Using the linearity of the integral:

$\int \frac{x}{{x}^{2} + x + 1} \mathrm{dx} = \frac{1}{2} \int \frac{2 x + 1}{{x}^{2} + x + 1} \mathrm{dx} - \frac{1}{2} \int \frac{\mathrm{dx}}{{x}^{2} + x + 1}$

Now the first integral can be solved directly:

$\int \frac{2 x + 1}{{x}^{2} + x + 1} \mathrm{dx} = \int \frac{d \left({x}^{2} + x + 1\right)}{{x}^{2} + x + 1} = \ln \left({x}^{2} + x + 1\right) + C$

while for the second we complete the square at the denominator:

$\int \frac{\mathrm{dx}}{{x}^{2} + x + 1} = \int \frac{\mathrm{dx}}{{\left(x + \frac{1}{2}\right)}^{2} + \frac{3}{4}}$

$\int \frac{\mathrm{dx}}{{x}^{2} + x + 1} = 4 \int \frac{\mathrm{dx}}{{\left(2 x + 1\right)}^{2} + 3}$

$\int \frac{\mathrm{dx}}{{x}^{2} + x + 1} = \frac{4}{3} \int \frac{\mathrm{dx}}{{\left(\frac{2 x + 1}{\sqrt{3}}\right)}^{2} + 1}$

$\int \frac{\mathrm{dx}}{{x}^{2} + x + 1} = \frac{2}{\sqrt{3}} \int \frac{d \left(\frac{2 x + 1}{\sqrt{3}}\right)}{{\left(\frac{2 x + 1}{\sqrt{3}}\right)}^{2} + 1}$

$\int \frac{\mathrm{dx}}{{x}^{2} + x + 1} = \frac{2}{\sqrt{3}} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$

Putting the partial results together:

$\int \frac{x}{{x}^{2} + x + 1} \mathrm{dx} = \frac{1}{2} \ln \left({x}^{2} + x + 1\right) - \frac{1}{\sqrt{3}} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$

Jun 5, 2018

$\int \setminus \frac{x}{{x}^{2} + x + 1} \setminus \mathrm{dx} = \frac{1}{2} \ln \left({x}^{2} + x + 1\right) - \frac{\sqrt{3}}{3} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$

#### Explanation:

We seek:

$I = \int \setminus \frac{x}{{x}^{2} + x + 1} \setminus \mathrm{dx}$

We first manipulate the numerator such that we have the derivative of the denominator:

$I = \int \setminus \frac{\frac{1}{2} \left(2 x + 1\right) - \frac{1}{2}}{{x}^{2} + x + 1} \setminus \mathrm{dx}$

$\setminus \setminus = \frac{1}{2} \setminus \int \setminus \frac{2 x + 1}{{x}^{2} + x + 1} \setminus \mathrm{dx} - \frac{1}{2} \setminus \int \setminus \frac{1}{{x}^{2} + x + 1} \setminus \mathrm{dx}$

$\setminus \setminus = \frac{1}{2} \setminus {I}_{1} - \frac{1}{2} {I}_{2}$, say,

Where:

${I}_{1} = \int \setminus \frac{2 x + 1}{{x}^{2} + x + 1} \setminus \mathrm{dx}$, ${I}_{2} = \int \setminus \frac{1}{{x}^{2} + x + 1} \setminus \mathrm{dx}$

For the first integral, ${I}_{1}$, we can perform a substitution. Let:

$u = {x}^{2} + x + 1 \implies \frac{\mathrm{du}}{\mathrm{dx}} = 2 x + 1$

And if we substitute into the integral, we get:

${I}_{1} = \int \setminus \frac{q}{u} \setminus \mathrm{du}$

$\setminus \setminus \setminus = \ln | u | + C$

$\setminus \setminus \setminus = \ln | {x}^{2} + x + 1 | + C$

Amd, for the first integral, ${I}_{3}$, we can complete the square on the denominator:

${I}_{2} = \int \setminus \frac{1}{{\left(x + \frac{1}{2}\right)}^{2} - {\left(\frac{1}{2}\right)}^{2} + 1} \setminus \mathrm{dx}$

$\setminus \setminus \setminus = \int \setminus \frac{1}{{\left(x + \frac{1}{2}\right)}^{2} + \frac{3}{4}} \setminus \mathrm{dx}$

And, we can perform a substitution. Let:

$x + \frac{1}{2} = \frac{\sqrt{3}}{2} u \iff u = \frac{2 x + 1}{\sqrt{3}} \implies \frac{\mathrm{dx}}{\mathrm{du}} = \frac{\sqrt{3}}{2}$

And if we substitute into the integral, we get:

${I}_{2} = \int \setminus \frac{1}{\frac{3}{4} {u}^{2} + \frac{3}{4}} \setminus \frac{\sqrt{3}}{2} \setminus \mathrm{du}$

$\setminus \setminus \setminus = \frac{4}{3} \setminus \frac{\sqrt{3}}{2} \setminus \int \setminus \frac{1}{{u}^{2} + 1} \setminus \mathrm{du}$

$\setminus \setminus \setminus = \frac{2}{3} \setminus \sqrt{3} \arctan u + C$

$\setminus \setminus \setminus = \frac{2}{3} \setminus \sqrt{3} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$

And, combining these results we have:

$I = \frac{1}{2} \setminus {I}_{1} - \frac{1}{2} {I}_{2}$

$\setminus \setminus = \frac{1}{2} \left\{\ln | {x}^{2} + x + 1 |\right\} - \frac{1}{2} \left\{\frac{2}{3} \setminus \sqrt{3} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right)\right\} + C$

$\setminus \setminus = \frac{1}{2} \ln | {x}^{2} + x + 1 | - \frac{\sqrt{3}}{3} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$

Finally, noting that ${x}^{2} + x + 1 > \forall x I n \mathbb{R}$

$I = \frac{1}{2} \ln \left({x}^{2} + x + 1\right) - \frac{\sqrt{3}}{3} \arctan \left(\frac{2 x + 1}{\sqrt{3}}\right) + C$