# What is int (x^3-2x^2+6x+9 ) / (-x^2- x +3 )?

Feb 17, 2018

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

#### Explanation:

First, we must decide what we want to do. Whenever you see a rational function (i.e. a polynomial divided by a polynomial), you want to use partial fraction decomposition (PFD).

We're going to take out a negative sign from the denominator and bring it back after the integral. Therefore, we want to be able to integrate

$\frac{{x}^{3} - 2 {x}^{2} + 6 x + 9}{{x}^{2} + x - 3}$

The first step in PFD is always to have the upper degree (currently 3) be lower than the lower degree (2). Therefore, we can start long dividing our polynomials:

${x}^{3} - 2 {x}^{2} + 6 x + 9 = x \left({x}^{2} + x - 3\right) - 3 {x}^{2} + 9 x + 9$
$- 3 {x}^{2} + 9 x + 9 = - 3 \left({x}^{2} + x - 3\right) + 12 x$
Therefore,

$\frac{{x}^{3} - 2 {x}^{2} + 6 x + 9}{{x}^{2} + x - 3} = x + \frac{- 3 {x}^{2} + 9 x + 9}{{x}^{2} + x - 3}$
$= \left(x - 3\right) + \frac{12 x}{{x}^{2} + x - 3}$
This is a lot easier to manage!

Now we can use PFD. First, we need to factor the bottom. Using the quadratic formula, we find the denominator has roots at
$x = - \frac{1}{2} \pm \frac{1}{2} \sqrt{1 + 4 \cdot 3} = \frac{- 1 \pm \sqrt{13}}{2}$

We will call these ${x}_{1}$ and ${x}_{2}$ for simplicity. We now want to expand the fraction into first order rational functions, i.e.
$\frac{A}{x - {x}_{1}} + \frac{B}{x - {x}_{2}} = \frac{12 x}{{x}^{2} + x - 3}$

$A \left(x - {x}_{2}\right) + B \left(x - {x}_{1}\right) = 12 x$
i.e.
$A + B = 12 , A {x}_{2} + B {x}_{1} = 0$

Using a little bit of algebra, we solve
$B = \frac{12 {x}_{2}}{{x}_{2} - {x}_{1}} = 6 + \frac{6}{\sqrt{13}}$
$A = 12 - B = 6 - \frac{6}{\sqrt{13}}$

Therefore, we have taken the original and made it much more manageable (well at least when it uses a bunch of variables to make it clear)

$\frac{{x}^{3} - 2 {x}^{2} + 6 x + 9}{{x}^{2} + x - 3} = \left(x - 3\right) + \frac{A}{x - {x}_{1}} + \frac{B}{x - {x}_{2}}$

Now we can finally solve!
$- \int \frac{{x}^{3} - 2 {x}^{2} + 6 x + 9}{{x}^{2} + x - 3} \mathrm{dx}$
$= \int \left(3 - x\right) \mathrm{dx} - A \int \frac{\mathrm{dx}}{x - {x}_{1}} - B \int \frac{\mathrm{dx}}{x - {x}_{2}}$
$= 3 x - \frac{1}{2} {x}^{2} - A \ln \left(x - {x}_{1}\right) - B \ln \left(x - {x}_{2}\right) + C$

Or writing it out,
$= 3 x - \frac{1}{2} {x}^{2} - \left(6 - \frac{6}{\sqrt{13}}\right) \ln \left(x + \frac{1 - \sqrt{13}}{2}\right) - \left(6 + \frac{6}{\sqrt{13}}\right) \ln \left(x + \frac{1 + \sqrt{13}}{2}\right) + C$