# Integrating: $\;\int \frac{1}{x^2+3x+2} dx$

How can I solve the following integral:

$$\int \frac{1}{x^2+3x+2} dx$$

Should I proceed by changing the variable (substitution)? or should I use integration by parts? Or another method altogether?

Thank you!

## 2 Answers

This integral is "screaming": Use partial fraction decomposition!, especially after we note that the denominator factors nicely $$x^2 + 3x + 2 = (x + 2)(x+1)$$

So our integral will take the form:

$$\int \frac 1{x^2 + 3x + 2} \,dx = \int \left(\frac A{x+2} + \frac B{x+1}\right)\,dx$$

Now, we solve for $A, B$ knowing that $$A(x+1) + B(x+2) = 0\cdot x + 1$$

If $x= -2$, then we have $A(-1) + 0\cdot B = 1\implies A = -1$.

If $x = -1,$ then we have $0\cdot A+ B = 1 \implies B = 1$.

So, the integral becomes $$\int \frac 1{x^2 + 3x + 2} \,dx = \int \left(\frac {-1}{x+2} + \frac 1{x+1}\right)\,dx =\int \left(\frac 1{x+1} - \frac 1{x+2}\right)\,dx$$

I trust you can take it from here.

• This is the best way, presumably the one intended by the problem poser. Another way: complete the square in the denominator, the integral is an inverse hyperbolic tangent. – GEdgar Jan 26 '15 at 15:10

Just for fun, I tried it another way.

Complete the square $$\frac{1}{x^2+3x+2} = \frac{1}{(x+\frac{3}{2})^2-\frac{1}{4}}$$ Change variables $y=x+\frac{3}{2}$ $$\int\frac{dx}{x^2+3x+2} = \int\frac{4}{4y^2-1} = {-2\;\mathrm{atanh}(2y)+C}$$ Substitute back $$\int\frac{dx}{x^2+3x+2}=-2\;\mathrm{atanh}(2x+3) + C$$ Check by differentiating $$\frac{d}{dx}\;\big(-2\;\mathrm{atanh}(2x+3)\big) =\frac{-4}{1-(2x+3)^2} = \frac{1}{x^2+3x+2}$$ OK

• This is correct, but note that this only works for $-2 < x < -1$. – GFauxPas Jan 26 '15 at 16:16
• Or, seen another way, it works for all complex $x$ except the two poles $-1$ and $-2$. – GEdgar Jan 26 '15 at 16:19
• Sure, but then you lose bijectivity, and things get tricky. – GFauxPas Jan 26 '15 at 16:21