Given: #int (x^2+2x+1)/((x+1)(x^2-2)) dx#
The numerator factors:
#int (x+1)^2/((x+1)(x^2-2)) dx#
Cancel the common factor:
#int (x+1)/(x^2-2) dx#
The denominator can be factored as the difference of two squares:
#int (x+1)/((x-sqrt2)(x+sqrt2) dx#
Write the partial fractions equation:
#(x+1)/((x-sqrt2)(x+sqrt2)) = A/(x-sqrt2)+B/(x+sqrt2)#
Multiply both sides by #(x-sqrt2)(x+sqrt2)#:
#x+1 = A(x+sqrt2)+B(x-sqrt2)#
Let #x = sqrt2#:
#sqrt2+1 = A(sqrt2+sqrt2)+B(sqrt2-sqrt2)#
#sqrt2+1 = A(2sqrt2)#
#A = (2+sqrt2)/4#
Let #x = -sqrt2#:
#-sqrt2+1 = A(-sqrt2+sqrt2)+B(-sqrt2-sqrt2)#
#-sqrt2+1 = B(-2sqrt2)#
#B = (2-sqrt2)/4#
Write in integral form:
#(2+sqrt2)/4 int 1/(x-sqrt2) dx + (2-sqrt2)/4 int 1/(x+sqrt2) dx#
The integrals become natural logarithms:
#(2+sqrt2)/4 ln(x-sqrt2) + (2-sqrt2)/4 ln(x+sqrt2)+ C#