Substitute #t=sqrt(x+2)#, #x=t^2-2#, #dx=2tdt#:
#int sqrt(x+2)/(x+1)dx = 2int (t^2dt)/(t^2-1)#
Write the numerator as #t^2 = t^2-1+1# to separate the entire part:
#int sqrt(x+2)/(x+1)dx = 2int ((t^2-1+1)dt)/(t^2-1) = 2int dt + 2int (dt)/(t^2-1)#
#int sqrt(x+2)/(x+1)dx = 2int ((t^2-1+1)dt)/(t^2-1) = 2t +2 int (dt)/(t^2-1)#
Solve the resulting integral decomposing in partial fractions:
#1/(t^2-1) = 1/((t-1)(t+1)) = A/(t-1)+B/(t+1)#
#1/(t^2-1) = (A(t+1)+B(t-1))/(t^2-1)#
#1 = (A+B)t+(A-B)#
#{(A+B=0),(A-B=1):}#
#{(A=1/2),(B=-1/2):}#
#int (dt)/(t^2-1) = 1/2 int (dt)/(t-1) -1/2 int (dt)/(t+1)#
#int (dt)/(t^2-1) = 1/2 (ln abs(t-1) -ln abs(t+1)) + C #
Put the partial solutions together:
#int sqrt(x+2)/(x+1)dx = 2t +ln abs(t-1) -lnabs(t+1) + C #
and undo the substitutions:
#int sqrt(x+2)/(x+1)dx = 2sqrt(x+2) + ln abs(sqrt(x+2)-1)-ln abs(sqrt(x+2)+1)+C#
Using the properties of logarithms we can write the solution also as:
#int sqrt(x+2)/(x+1)dx = 2sqrt(x+2) + ln abs((sqrt(x+2)-1)/(sqrt(x+2)+1))+C#
and rationalizing the denominator of the argument of the logarithm:
#int sqrt(x+2)/(x+1)dx = 2sqrt(x+2) + ln abs((sqrt(x+2)-1)/(sqrt(x+2)+1) (sqrt(x+2)-1)/(sqrt(x+2)-1))+C#
#int sqrt(x+2)/(x+1)dx = 2sqrt(x+2) + ln abs((sqrt(x+2)-1)^2/(x+2-1))+C#
#int sqrt(x+2)/(x+1)dx = 2sqrt(x+2) + ln abs((sqrt(x+2)-1)^2/(x+1))+C#
#int sqrt(x+2)/(x+1)dx = 2sqrt(x+2) + 2ln abs(sqrt(x+2)-1)-ln abs(x+1)+C#