<s>[INST] How to integrate $\int\frac{x}{(x^2-2x+5)^2} \, dx$? $$\int\frac{x}{(x^2-2x+5)^2} \, dx$$
I tried to complete the square of the bottom like this $\int\frac{x}{((x-1)^2+4)^2} \, dx$ but I'm still not sure what to do.
Any help would be appreciated.
Thanks
 [/INST] A good strategy, now that you've completed the square is to also "complete the differential":
$$\int\frac{x}{((x-1)^2+4)^2} \, dx=$$
$$\frac 1 2\int\frac{2(x-1)}{((x-1)^2+4)^2} \, dx+\int\frac{1}{((x-1)^2+4)^2} \, dx=$$
$$\frac 1 2\int\frac{du}{u^2} +\int\frac{1}{(u^2+4)^2} \, du=$$
$$-\frac 1 2\frac{1}{u} +\int\frac{1}{(u^2+4)^2} \, du=$$
Now, to solve $$\int\frac{1}{(u^2+4)^2} \, du$$
take $2\tan \rho =u$
It will follow
$$\int\frac{1}{(u^2+4)^2} \, du$$
$$\int\frac{2\sec^2\rho }{16\sec^4 \rho } \,d\rho$$
$$\int\frac{1}{8\sec^2 \rho } \,d\rho=\frac 1 8\int{\cos^2\rho}  \,d\rho$$
Now use the fact that $\dfrac{1+\cos(2x)}{2}=\cos^2 x$ to finish it off.
</s>