#(x^2-3x-40)/(x^2+2x-35)-:(x^2+2x-48)/(x^2+3x-18)#
= #(x^2-3x-40)/(x^2+2x-35)xx(x^2+3x-18)/(x^2+2x-48)#
Factorizing each of the quadratic polynomial
#x^2-3x-40=x^2-8x+5x-48=x(x-8)+5(x-8)=(x+5)(x-8)#
#x^2+2x-35=x^2+7x-5x-35=x(x+7)-5(x+7)=(x-5)(x+7)#
#x^2+3x-18=x^2+6x-3x-18=x(x+6)-3(x+6)=(x-3)(x+6)#
#x^2+2x-48=x^2+8x-6x-48=x(x+8)-6(x+8)=(x-6)(x+8)#
Hence #(x^2-3x-40)/(x^2+2x-35)xx(x^2+3x-18)/(x^2+2x-48)#
= #((x+5)(x-8))/((x-5)(x+7))xx((x-3)(x+6))/((x-6)(x+8))#
Observe that there is no binomial common between numerator and denominator and hence you cannot simplify it further and
#(x^2-3x-40)/(x^2+2x-35)xx(x^2+3x-18)/(x^2+2x-48)=((x+5)(x-8)(x-3)(x+6))/((x-5)(x+7)(x-6)(x+8))#