# How do you integrate ln(x^2-x+2)dx?

Jul 3, 2016

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

#### Explanation:

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

we use IBP

$\int u v ' = u v - \int u ' v$

and the trick here is

$u = \ln \left({x}^{2} - x + 2\right) , u ' = \frac{2 x - 1}{{x}^{2} - x + 2}$
$v ' = 1 , v = x$

so we have

$x \ln \left({x}^{2} - x + 2\right) - \int \mathrm{dx} q \quad x \frac{2 x - 1}{{x}^{2} - x + 2} q \quad \star$

for $\int \mathrm{dx} q \quad x \frac{2 x - 1}{{x}^{2} - x + 2}$ this becomes:

$\int \mathrm{dx} q \quad \frac{2 {x}^{2} - x}{{x}^{2} - x + 2}$

next bit is like long division only easier

$= \int \mathrm{dx} q \quad \frac{2 {x}^{2} - 2 x + 4 + x - 4}{{x}^{2} - x + 2}$

$= \int \mathrm{dx} q \quad 2 + \frac{x - 4}{{x}^{2} - x + 2}$

now we set it up for a log solution by setting up this pattern: $\frac{f ' \left(x\right)}{f} \left(x\right)$

$= 2 x + \int \mathrm{dx} q \quad \frac{\frac{1}{2} \left(2 x - 8\right)}{{x}^{2} - x + 2}$

$= 2 x + \int \mathrm{dx} q \quad \frac{\frac{1}{2} \left(2 x - 1\right) - \frac{7}{2}}{{x}^{2} - x + 2}$

$= 2 x + \int \mathrm{dx} q \quad \frac{\frac{1}{2} \left(2 x - 1\right)}{{x}^{2} - x + 2} - \frac{7}{2} \frac{1}{{x}^{2} - x + 2}$

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

if we plug this all into $\star$ we have

$x \ln \left({x}^{2} - x + 2\right) - \left(2 x + \frac{1}{2} \ln \left({x}^{2} - x + 2\right) - \frac{7}{2} \int \mathrm{dx} q \quad \frac{1}{{x}^{2} - x + 2}\right)$

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

for $\int \mathrm{dx} q \quad \frac{1}{{x}^{2} - x + 2}$

we complete the square, looking for a tan sub to finish it off, so

$\int \mathrm{dx} q \quad \frac{1}{{\left(x - \frac{1}{2}\right)}^{2} - \frac{1}{4} + 2}$

$= \int \mathrm{dx} q \quad \frac{1}{{\left(x - \frac{1}{2}\right)}^{2} + \frac{7}{4}}$

$= \int \mathrm{dx} q \quad \frac{1}{\frac{7}{4} {\tan}^{2} \phi + \frac{7}{4}}$ using the sub ${\left(x - \frac{1}{2}\right)}^{2} = \frac{7}{4} {\tan}^{2} \phi$ or $\left(x - \frac{1}{2}\right) = \frac{\sqrt{7}}{2} \tan \phi$

so $\mathrm{dx} = \frac{\sqrt{7}}{2} {\sec}^{2} \phi \setminus d \phi$

$= \frac{\sqrt{7}}{2} \int d \phi q \quad {\sec}^{2} \phi \setminus \frac{1}{\frac{7}{4} {\sec}^{2} \phi}$

$= \frac{2}{\sqrt{7}} \int d \phi q \quad$

$= \frac{2}{\sqrt{7}} \arctan \left(2 \frac{x - \frac{1}{2}}{\sqrt{7}}\right)$

parking this back into $\square$

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

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