# Evaluate the following integral:

Question:

Evaluate the following integral:

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

Solution:

First we simplify numerator, we get

$\frac{x^{2}+x-1}{x^{2}+x-6}$

$=\frac{x^{2}+x-6+5}{x^{2}+x-6}$

$=\frac{x^{2}+x-6}{x^{2}+x-6}+\frac{5}{x^{2}+x-6}$

$=1+\frac{5}{x^{2}+x-6}$

Now we will factorize denominator by splitting the middle term, we get

$1+\frac{5}{x^{2}+x-6}$

$=1+\frac{5}{x^{2}+3 x-2 x-6}$

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

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

Now the denominator is factorized, so let separate the fraction through partial fraction, hence let

$\frac{5}{(x+3)(x-2)}=\frac{A}{x+3}+\frac{B}{x-2} \ldots \ldots(i)$

$\Rightarrow \frac{5}{(x+3)(x-2)}=\frac{A(x-2)+B(x+3)}{(x+3)(x-2)}$

$\Rightarrow 5=A(x-2)+B(x+3) \ldots \ldots$ (ii)

We need to solve for $A$ and $B$. One way to do this is to pick values for $x$ which will cancel each variable.

Put $x=2$ in the above equation, we get

$\Rightarrow 5=A(2-2)+B(2+3)$

$\Rightarrow 5=0+5 B$

$\Rightarrow B=1$

Now put $x=-3$ in equation (ii), we get

$\Rightarrow 5=A((-3)-2)+B((-3)+3)$

$\Rightarrow 5=-5 A$

$\Rightarrow A=-1$

We put the values of $A$ and $B$ values back into our partial fractions in equation (i) and replace this as the integrand. We get

$\int\left[1+\frac{A}{x+3}+\frac{B}{x-2}\right] d x$

$\Rightarrow \int\left[1+\frac{-1}{x+3}+\frac{1}{x-2}\right] d x$

Split up the integral,

$\Rightarrow \int 1 \mathrm{dx}-\int\left[\frac{1}{\mathrm{x}+3}\right] \mathrm{dx}+\int\left[\frac{1}{\mathrm{x}-2}\right] \mathrm{dx}$

Let substitute $u=x+3 \Rightarrow d u=d x$ and $z=x-2 \Rightarrow d z=d x$, so the above equation becomes,

$\Rightarrow \int 1 \mathrm{dx}-\int\left[\frac{1}{\mathrm{u}}\right] \mathrm{du}+\int\left[\frac{1}{\mathrm{z}}\right] \mathrm{dz}$

On integrating we get

$\Rightarrow x-\log |u|+\log |z|+C$

Substituting back, we get

$\Rightarrow x-\log |x+3|+\log |x-2|+C$

Applying the logarithm rule, we can rewrite the above equation as

$\Rightarrow x+\log \left|\frac{x-2}{x+3}\right|+C$

Note: the absolute value signs account for the domain of the natural $\log$ function $(x>0)$.

Hence,

$\int \frac{x^{2}+x-1}{x^{2}+x-6} d x=x+\log \left|\frac{x-2}{x+3}\right|+C$