<s>[INST] Calculate the following integral $ \int\frac{2x+1}{x^{n+2}(x+1)^{n+2}}\ln\left(\frac{2x^2+2x+1}{x^2(x+1)^2}+\frac7{16}\right)dx$ Hello I am trying to solve a pretty complicated integral. It is a from a set of problems, published in a monthly journal for high school students and they are exercises in preparation for a competition.
So the problem is the following: Calculate the integral $ \int \frac {2x+1}{x^{n+2}(x+1)^{n+2}} \ln\left(\frac {2x^2+2x+1}{x^2(x+1)^2} + \frac{7}{16}\right)dx$
I first tried partial integration, integrating $\frac {2x+1}{x^{n+2}(x+1)^{n+2}}$, it is happily easy to do it and we will end up with $\int \frac {2x+1}{x^{n+2}(x+1)^{n+2}} = \frac {-1}{x^{n+1}(x+1)^{n+1}}$.
I also differentiated $\ln\left(\frac {2x^2+2x+1}{x^2(x+1)^2} + \frac{7}{16}\right)$, ending up with $\frac {-64x^3-96x^2-96x-32}{7x^6+21x^5+71x^3+48x^2+16x}$
Now when I try to solve the integral of the product of these two, I am stuck.
I also thought about some kind of recursive relationship in terms of $n$ but I am not sure about it.
I would happily accept any help in solving this problem. Thanks in advance.
 [/INST] As said in comments, using $u=x(x+1)$  as @David Quinn suggested the problem reduces to
$$I=\int\frac 1 {u^{n+2}} \log \left(\frac{7 u^2+32 u+16}{16 u^2}\right)\,du$$ which is
$$I=-\frac{2+(n+1) \log \left(16 u^2\right)}{(n+1)^2\, u^{n+1}}+\int \frac 1 {u^{n+2}}\log(7 u^2+32 u+16)\,du $$
$$J=\int \frac 1 {u^{n+2}}\log(7 u^2+32 u+16)\,du $$
$$J=\log(7)\int \frac {du}{u^{n+2}}+\int \frac{\log(u+4)}{u^{n+2}}\,du+\int \frac{\log \left(u+\frac{4}{7}\right)}{u^{n+2}}\,du$$
$$J=-\frac{\log(7)}{(n+1) u^{n+1} }+\int \frac{\log(u+4)}{u^{n+2}}\,du+\int \frac{\log \left(u+\frac{4}{7}\right)}{u^{n+2}}\,du$$
$$K_a=\int \frac{\log \left(u+a\right)}{u^{n+2}}\,du$$
$$K_a=-\frac{u \,\, _2F_1\left(1,-n;1-n;-\frac{u}{a}\right)+a n \log (u+a) } {a n (n+1) u^{n+1} }$$
</s>