<s>[INST] Integrate $\int\frac{x+1}{(x^2-x-5)^3} dx$ can you help with this math problem? I dont know how to start? There is any good method? $$\int\frac{x+1}{(x^2-x-5)^3} dx$$
Thank you
 [/INST] As in my other answer,
$$\int \frac{x+1}{\left(x^2-x-5\right)^3}\, dx=\frac{1}{2}\left(\int \frac{d\left(x^2-x-5\right)}{\left(x^2-x-5\right)^3}+\int\frac{3}{\left(x^2-x-5\right)^3}\, dx\right)$$
$$=\frac{1}{2}\left(\frac{1}{-2\left(x^2-x-5\right)^2}+3\cdot 2^5\int \frac{d(2x-1)}{\left((2x-1)^2-21\right)^3}\right)$$
Let $2x-1=\sqrt{21}\sin u$. Then $d(2x-1)=\sqrt{21}\cos u\, du$.
$$\int \frac{d(2x-1)}{\left((2x-1)^2-21\right)^3}=\frac{1}{21^2\sqrt{21}}\int \frac{1}{-\cos^5 u}\, du$$
Now integrate by parts. Here are some hints:
$$\int \sec^5 u\, du=\int \sec^3 u\, d\left(\tan u\right)=\sec^3 u\tan u-\int \left(3\sec^2 u\cdot \sec u\tan u\right)\tan u\, du$$
$$\int \sec^3 u\tan^2 u\, du=\int \sec^3 u\left(\sec^2 u-1\right)\, du=\int \sec^5 u\, du-\int \sec^3 u\, du$$
$$\int \sec^3 u\, du=\int \sec u\, d(\tan u)=\sec u\tan u-\int (\sec u\tan u)(\tan u)\, du$$
$$\int \sec u\tan^2 u\, du=\int \sec\left(\sec^2 u-1\right)\, du=\int \sec^3 u\, du-\int \sec u\, du$$
Now, there are many ways to solve $\int \sec u\, du$. See Ways to evaluate $\int \sec \theta \, \mathrm d \theta$ (including the question body). You can always use the Tangent Half-Angle substitution on rational $\sin x,\cos x$ integrals, including $\int \sec u\, du$.
</s>