# Integral question - $\int\frac{(4-x)\,dx}{x^2+4x+8}$

Integral question - $$\int\frac{(4-x)\,dx}{x^2+4x+8}$$

To solve it I need to bring the numerator to be the derivative of the dominator right?

I need to do the trick that not change the integral any ideas? $$\frac{1}{2}\int\frac{(2x+4) \, dx}{x^2+4x+8}$$ Thanks

-

You will sooner or later have to complete the square in the denominator, getting $(x+2)^2+4$. Then the usual substitution is $x+2=2u$.
Remark: Note that $4-x= 6-(x+2)$. So we can rewrite our integrand as $\frac{6-(x+2)}{x^2+4x+8}=\frac{6}{x^2+4x+8}-\frac{x+2}{x^2+4x+8}$. In the expression $\frac{x+2}{x^2+4x+8}$, the numerator is a constant times the derivative of the denominator, so the substitution $v=x^2+4x+8$ works well. But we still need to integrate $\frac{6}{x^2+4x+8}$. And for that we need to work as in the answer above. I suggest instead the immediate substitution $x+2=2u$.
Added: So $dx=2\,du$ and $4-x=6-2u$. We end up with $$\int \frac{3-u}{1+u^2}\,du=\int\frac{3}{1+u^2}du-\int\frac{u}{1+u^2}\,du.$$ The first integral is immediate. For the second, let $t=1+u^2$.
We have $$4-x=-\frac{1}{2}(2x+4)+6$$ and $$x^2+4x+8=(x+2)^2+4=4((\frac{1}{2}(x+2))^2+1)=4(u^2+1)$$ hence $$\int\frac{(4-x)\,dx}{x^2+4x+8}=-\frac{1}{2}\int\frac{(2x+4)}{x^2+4x+8}dx+6\int\frac{dx}{x^2+4x+8}\\=-\frac{1}{2}\log|2x^2+4x+8|+{3}\int\frac{du}{u^2+1}=-\frac{1}{2}\log|2x^2+4x+8|+3\arctan(\frac{x+2}{2})+C$$