Given int(2x-5)/(x^2+2x+2)dx
You can manipulate the expression* into
color(red)(int((2x+2)/(x^2+2x+2))dx) - int(7/(x^2+2x+2))dx
For the first integral,
let color(red)(u= x^2 +2x+2) ; du = (2x+2) dx
int(du)/u = ln|u| +C
int((2x+2)/(x^2+2x+2))dx =color(red)( ln(x^2 + 2x+2) +C
For the second integral
- int(7/(x^2+2x+2))dx , let's complete the square for the denominator
color(blue)(-int7/((x^2+2x+1)+2-1)dx
=> int( -7)/((x+1)^2 + 1)dx
Let v= (x+1) ; dv= 1dx " " ; a^2 = 1 ; a= 1
int1/(u^2+a^2)du = arctan (u/a) +C
=>-7int1/((x+1)^2 + 1)dx =>color(blue)( -7 arctan (x+1) + C
When we put it together we have
int(2x-5)/(x^2+2x+2)dx = color(red)( ln(x^2 + 2x+2) color(blue)( -7 arctan (x+1) + C
*Why? Because if we differentiate the denominator, we ALMOST have the derivative on the numerator...
(If you don't like this method you can also use partial fraction decomposition but it will take longer)