(1) Complete the square:

x2+4x+13x2+4x+(42)2(42)2+13(x+2)2+9

(2) Substitute x+2=3tanθ and thus dx=3sec2θdθ:

dx(x+2)2+93sec2θdθ9tan2θ+9secθdθln|tanθ+secθ|+C

(3) Convert back to terms of x:

First draw a triangle expressing tanθ=x+23:

center

It follows that secθ=(x+2)2+93. Then:

ln|tanθ+secθ|+Cln|x+23+(x+2)2+93|+Cln|x+2+(x+2)2+9|+C(Note A)

Note A: Using log rules, the denominator 3 can be brought out as ln3 which can be “absorbed” into the constant C.