# How do you find the integral ln(x^2+x+1)?

Apr 10, 2018

$x \ln \left({x}^{2} + x + 1\right) - x - \left(x + \frac{1}{2}\right) - \ln \cos {\tan}^{-} 1 \left(\frac{2}{\sqrt{3}} \left(x + \frac{1}{2}\right)\right) + \sqrt{3} {\tan}^{-} 1 \left(\frac{2}{\sqrt{3}} \left(x + \frac{1}{2}\right)\right) + C$

#### Explanation:

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

apply Integration by Parts

$u = \ln \left({x}^{2} + x + 1\right)$

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

$\mathrm{dv} = \mathrm{dx}$

$v = x$

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

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

simplify

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

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

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

completing the square of the denominator :
$r = \int \frac{{x}^{2} - 1}{{\left(x + \frac{1}{2}\right)}^{2} + \frac{3}{4}} \mathrm{dx}$

$x + \frac{1}{2} = \frac{\sqrt{3}}{2} \tan \theta$
$\mathrm{dx} = \frac{\sqrt{3}}{2} {\sec}^{2} \theta \cdot d \left(\theta\right)$
${x}^{2} = \frac{3}{4} {\tan}^{2} \theta - \frac{\sqrt{3}}{2} \tan \theta + \frac{1}{4}$

substitute

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

simplify where ${\tan}^{2} \theta + 1 = {\sec}^{2} \theta$

$\frac{4}{3} \cdot \frac{\sqrt{3}}{2} \int \left(\frac{3}{4} {\tan}^{2} \theta - \frac{\sqrt{3}}{2} \tan \theta - \frac{3}{4}\right) d \left(\theta\right)$

simplify again using the relation ${\tan}^{2} \theta + 1 = {\sec}^{2} \theta$

$\frac{2}{\sqrt{3}} \int \left(\frac{3}{4} {\sec}^{2} \theta - \frac{\sqrt{3}}{2} \tan \theta - \frac{3}{2}\right) d \left(\theta\right)$=$\frac{\sqrt{3}}{2} \tan \theta + \ln \cos \theta - \sqrt{3} \theta + C$

reverse the trigonometric substitution

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

so,
$r = \int \frac{{x}^{2} - 1}{{x}^{2} + x + 1} \mathrm{dx}$=$\left(x + \frac{1}{2}\right) + \ln \cos {\tan}^{-} 1 \left(\frac{2}{\sqrt{3}} \left(x + \frac{1}{2}\right)\right) - \sqrt{3} {\tan}^{-} 1 \left(\frac{2}{\sqrt{3}} \left(x + \frac{1}{2}\right)\right) + C$

substituting in $I$:

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

and substituting with the value of I in (1)

your final integration result will be:

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