How to calculate $\int_0^1\frac{\ln^2x\ln^2(1-x^2)}{1-x^2}\ dx$?

All the following Mathematica commands calculate your limit, in decreasing order of time (the more naive one uses more time):

Limit[D[Gamma[a]*Gamma[b]/Gamma[a + b], {a, 2}, {b, 2}] /. {a -> 
  1/2 + x, b -> x}, x -> 0] // FunctionExpand // Expand

the above command directly calculates the limit, by choosing a path approaching $(a,b)=(1/2,0)$. It takes $32$ seconds on my machine.

D[Normal[Series[
        Gamma[a]*Gamma[b]/Gamma[a + b], {a, 1/2, 4}, {b, 0, 4}]], {a, 
       2}, {b, 2}] /. a -> 1/2 /. b -> 0 // FullSimplify // 
  Expand 

rather than calculating the limit, this one uses series expansion up to constant term. It takes $12$ seconds.

Normal[Series[
     D[Gamma[a]*Gamma[b]/Gamma[a + b], {a, 2}, {b, 2}], {a, 1/2, 
      0}, {b, 0, 0}]] // FullSimplify // Expand

this one does not even calculate derivatives, instead uses series expansion up to 4th order. It takes $3.5$ seconds.

D[Exp[Series[
        LogGamma[a] + LogGamma[b] - LogGamma[a + b], {a, 1/2, 4}, {b, 
         0, 4}]], {a, 2}, {b, 2}] /. a -> 1/2 /. b -> 0 // 
   FullSimplify // Expand

This use the well-known simple series of log gamma function, it takes only $0.5$ seconds.


It's easy to guess why the fourth one is most efficient. To see how much is used for each computation, execute ClearSystemCache[];(your command)//Timing.

Such beta limit arising from logarithm integrals is well-known, it's also not difficult to write down an recursion for it.


A magnificent solution by Cornel without using the derivative of beta function.


We have the identity

$$\frac{\ln^2(1-x)}{1-x}=\sum_{n=1}^\infty (H_n^2-H_n^{(2)})x^n$$

replace $x$ with $x^2$, then multiply both sides by $\ln^2x$ and integrate from $x=0$ to $1$ we get

$$\int_0^1\frac{\ln^2x\ln^2(1-x^2)}{1-x^2}\ dx=2\sum_{n=1}^\infty\frac{H_n^2-H_n^{(2)}}{(2n+1)^3}\tag1$$


By the master theorem, we have

$$3n\sum_{k=1}^\infty \frac{H_k^2-H_k^{(2)}}{(k+1)(k+n+1)}=H_n^3+3H_nH_n^{(2)}+2H_n^{(3)}$$

differentiate both sides with respect to $n$ to get

$$3\sum_{k=1}^\infty \frac{H_k^2-H_k^{(2)}}{(k+n+1)^2}=\frac{d}{dn}\left(H_n^3+3H_nH_n^{(2)}+2H_n^{(3)}\right)$$

differentiate again and let $n\mapsto -1/2$ we get

$$-6\sum_{k=1}^\infty \frac{H_k^2-H_k^{(2)}}{(k+1/2)^3}=\frac{d^2}{dn^2}\left(H_n^3+3H_nH_n^{(2)}+2H_n^{(3)}\right)_{n\mapsto-1/2}$$

or

$$\sum_{k=1}^\infty \frac{H_k^2-H_k^{(2)}}{(2k+1)^3}=\frac{31}{2}\zeta(5)-\frac{45}{8}\ln2\zeta(4)+\frac72\ln^22\zeta(3)-7\zeta(2)\zeta(3)\tag2$$


From (1) and (2) we get

$$\int_0^1\frac{\ln^2x\ln^2(1-x^2)}{1-x^2}\ dx=31\zeta(5)-\frac{45}{4}\ln2\zeta(4)+7\ln^22\zeta(3)-14\zeta(2)\zeta(3)$$