# Find the Integral of (x² + x + 3) / (x² – x – 2)

Find the indefinite integral of (x² + x + 3) / (x² – x – 2)

\int{\dfrac{x^2+x+3}{x^2-x-2}\ \ dx} = ?

## Solution

We want to simplify the expression. We want the numerator to be a polynomial with a lower degree than the denominator. By dividing the numerator by the denominator, we get

\begin{aligned} Let \ \ I&=\int{\dfrac{x^2+x+3}{x^2-x-2}\ \ dx} \\ \\ &= \int{\dfrac{x^2-x-2+2x+5}{x^2-x-2}\ \ dx} \\ \\ &= \int{1+\dfrac{2x+5}{x^2-x-2}\ \ dx} \\ \\ &= \int{1} \ dx+\int{\dfrac{2x+5}{x^2-x-2}\ \ dx} \\ \\ \Rightarrow \int&{\dfrac{x^2+x+3}{x^2-x-2}\ \ dx} = x+c_1 +I_a \\ \end{aligned}

To find the integral of I, we need to arrange I as two functions and find the integral by applying integration by partial fraction and integration by substitution

\begin{aligned} I_a&= \int{\dfrac{2x+5}{x^2-x-2}\ \ dx} \\ \\ &= \int{\dfrac{2x-1+6}{x^2-x-2}\ \ dx} \\ \\ &= \int{\dfrac{2x-1}{x^2-x-2}\ \ dx} +\int{\dfrac{6}{x^2-x-2}\ \ dx}\\ \\ \Rightarrow I_a&= I_1+I_2\\ \end{aligned}

## Apply integration by substitution in integral* I*_{1}

Let *u* = *x*² – *x* – 2, then *u* = 2*x* – 1

\begin{aligned} I_2&=\int{\dfrac{2x-1}{x^2-x-2}} \ dx\\ \\ &= \int{\dfrac{du}{u}} \\ \\ &= \ln|u|+c_2 \\ \\ \Rightarrow I_2&= \ln|x^2-x-2|+c_2 \\ \end{aligned}

## Applying integration by partial fraction *I*_{2}

_{2}

Factorise *x*² – *x* – 2

*x*² – *x* – 2 = *x*² – 2*x* + *x* – 2 = *x*(*x* – 2) + (*x* – 2)

⇒ *x*² – *x* – 2 = (*x* +1)(*x* – 2)

\begin{aligned} I_2&=\int{\dfrac{6}{x^2-x-2}\ \ dx}\\ \\ &=6\int{\dfrac{1}{x^2-x-2}\ \ dx}\\ \\ &=6\int{\dfrac{1}{(x+1)(x-2)}\ \ dx}\\ \\ \dfrac{1}{(x+1)(x-2)}&=\dfrac{A}{x+1}+\dfrac{B}{x-2}\\ \\ &=\dfrac{A(x+1)+B(x-2)}{(x+1)(x-2)}\\ \\ 1&=Ax+A+Bx-2B\\ \\ 1&=(A+B)x+A-2B\\ \end{aligned}

From above equation we can clearly see that A + B = 0 and A – 2B = 1

A = -B

so -B – 2B = 1

⇒ -3B = 1

⇒ **B = -1/3**

Now, **A = 1/3**

Then we get

\begin{aligned} I_2&=6\int \bigg(\dfrac{A}{x+1}+\dfrac{B}{x-2} \bigg) \ dx\\ \\ &=6\int \dfrac{\dfrac{1}{3}}{x+1} \ dx +6 \int \dfrac{\dfrac{-1}{3}}{x-2} \ dx\\ \\ &=2\times \ln |x+1|-2\times \ln |x-2| + c_3\\ \\ \Rightarrow I_2&=2 \ln \bigg|\frac{x+1}{x-2}\bigg|+c_3\\ \end{aligned}

So

\begin{aligned} I &=x+c_1+ \ln|x^2-x-2|+c_2\\ \\ & \ \ \ \ +2\times \ln \bigg|\frac{x+1}{x-2}\bigg|+c_3 \\ \\ \\ I &=x+ \ln|x^2-x-2|+2\ln \bigg|\frac{x+1}{x-2}\bigg|+C \end{aligned}

That is solution to this calculus math problem is *x* + ln |*x*² – x – 2| + 2ln |*x*+1| – 2ln |*x* – 2| + C