Solution:
Complete the square:
x2+4x+1=(x+2)2−(3)2
Put x+2=t, so that dx=dt.
∫x2+4x+1dx=∫t2−(3)2dt
We know that
∫x2−a2dx=2xx2−a2−2a2logx+x2−a2+C
Here a2=3, so
∫t2−3dt=2tt2−3−23logt+t2−3+C
Substituting back t=x+2,
∫x2+4x+1dx=2x+2x2+4x+1−23logx+2+x2+4x+1+C