On calculating $\int_0^1\ln(1-x^2)\;{\mathrm dx}$ -- where is the mistake?

I've seen the integral $\displaystyle \int_0^1\ln(1-x^2)\;{dx}$ on a thread in this forum and I tried to calculate it by using power series. I wrote the integral as a sum then again as an integral. Here is my calculation:

$$\displaystyle \begin{aligned} \int_0^1 \ln\left(1-x^2\right)\;{\mathrm dx} & = -\int_0^1\sum_{k \ge 0}\frac{x^{2k+2}}{k+1}\;{\mathrm dx} = -\sum_{k \ge 0}\int_{0}^{1}\frac{x^{2k+2}}{k+1}\;{\mathrm dx} \\& = -\sum_{k \ge 0}\bigg[\frac{x^{2k+3}}{(k+1)(2k+3)}\bigg]_0^1 = -\sum_{k \ge 0}\frac{1}{(k+1)(2k+3)} \\& = -\sum_{k \ge 0}\frac{(2k+3)-2(k+1)}{(k+1)(2k+3)} = -\sum_{k\ge 0}\bigg(\frac{1}{k+1}-\frac{2}{2k+3}\bigg) \\& \color{blue}{= -\sum_{k\ge 0}\int_0^1\bigg(x^{k}-2x^{2k+2}\bigg)\;{\mathrm dx} = -\int_0^1\sum_{k\ge 0}\bigg( x^{k}-2x^{2k+2}\bigg)\;{\mathrm dx}} \\&= \int_0^1\frac{1}{1+x}-2\;{\mathrm dx} = \bigg[\ln(1+x)-2x\bigg]_0^1 = \ln{2}-2.\end{aligned} $$

I should have got $2\ln{2}-2$, not $\ln{2}-2$. I'm thinking that either I made a very silly mistake, or the blue step is wrong (probably the order cannot be switched, although I don't know why)!


Solution 1:

This is quite interesting. I think the problem does lie in the blue line. The sum over $\frac{1}{k+1}-\frac{2}{2k+3}$ converges absolutely, but the sums over the two terms individually diverge. What you're doing when you combine the two series as you do is effectively to move the terms $\frac{2}{2k+3}$ back to twice the $k$ value from where they belong, and that's a different series; you can only do that when the two terms absolutely converge individually.

What you're effectively calculating by "slowing down" $k$ in the second term is

$$-\sum_{k\ge0}\left(\frac{1}{2k+1}+\frac{1}{2k+2}-\frac{2}{2k+3}\right)\;,$$

and that is indeed $\ln 2 - 2$.

[Update]

The above explanation refers to the series above the blue line to show that exchanging the sum and integral in the blue line can't be valid. But of course that should also be decidable from just the blue line itself.

First off, note that actually the first step after the blue line isn't quite right, either: At $x=1$, the sum in the integrand actually diverges to $-\infty$, so the value $-3/2$ of the integrand in the last line for $x=1$ is obtained by rearranging a divergent series. But that problem only occurs at $x=1$; for all other values of $x$, the series converges absolutely and may validly be arranged to obtain the integrand in the last line. But this discontinuity at $x=1$ already shows that the partial sums don't converge uniformly. Indeed

$$-\sum_{k=0}^{n-1}\left(x^k-2x^{2k+2}\right)=-\frac{1-x^n}{1-x}+2x^2\frac{1-x^{2n}}{1-x^2}=\frac{1-x^n}{1-x}\left(-1+2x^2\frac{1+x^n}{1+x}\right)\;,$$

which for large $n$ is close to the integrand in the last line for most $x$ but close to $x=1$ suddenly becomes positive and ends up at $n$ for $x=1$, as it must. Here's a plot for $n=100$.

Here's a very nice general treatment of the interchange of limits based on uniform convergence, which can be applied to integrals, derivatives and sums alike. Since the series in the integrand diverges at $x=1$, we have to treat the integral as a limit taking the upper integration limit to $1$, and this limiting operation and the one in the series can only be interchanged if the uniform convergence criterion is fulfilled.

(Here's another example where an integral and a function limit can't be interchanged due to lack of uniform convergence; this one is a bit simpler because there's no sum involved.)