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!
 A: 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.
A: 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
