Why doesn't this proof of the Basel problem violate the geometric series convergence constraints?

In a proof of the Basel problem, the excellent YouTuber "blackpenredpen" relies on a manipulation which I assume is valid, but I don't know why it is valid.

They split the following integral: $$\int_0^{\pi/2}\ln(2\cos x)\space dx=\int_0^{\pi/2}\ln(e^{ix}+e^{-ix})\space dx=$$ $$\int_0^{\pi/2}\ln(e^{ix}(1+e^{-2ix}))\space dx=\int_0^{\pi/2}\ln(e^{ix})\space dx + \int_0^{\pi/2}\ln(1+e^{-2ix}))\space dx$$

And in the calculation of the second part of the integral on the right hand side, they use the series expansion:

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

to represent $$\ln(1+e^{-2ix})$$ and note that this is only valid for $$|x|\leq1, x\neq-1$$. Although $$|e^{-2ix}|=1,\forall x$$, I noticed that the integral runs up to $$\frac{\pi}{2}$$, and $$e^{-2i\cdot\pi/2}=-1$$, which means that the series expansion does not converge (the logarithm goes to $$\ln(0)$$ which is very undefined!) at the upper bound of the integral. I imagine this is valid due to integrals being limits, and perhaps we "approach" $$\frac{\pi}{2}$$ without reaching it, but I'd like a formal explanation for why this expansion is valid here - I would like to learn when we can and cannot do this sort of thing!

• The remainder term in the Taylor series is relevant here. The Taylor series to $n$ terms involves the first $n$ derivatives, then the remainder term involves the $n+1$th. Then you try to show the remainder approaches zero. Jun 6 at 12:55
• The original integral is improper, since the integrand has a singularity at $x=\pi/2$. So the integral is defined to be $\lim_{t\nearrow \pi/2}\int_0^t \ln(2\cos x)\,dx$. (I'm assuming these are Riemann integrals, improper integrals are treated differently in e.g. Lebesgue integration) Separately, it might be a little risky to assume a manipulation is valid just because it arrives at the correct answer. Jun 7 at 20:05
• this logic is flawed: "relies on a manipulation which is clearly valid, since their proof produces the correct answer" Jul 7 at 19:09
• Arriving at the right answer does not mean that one's technique is valid. For example, in $16/64,$ if one cancels the $6$ from the numerator and the denominator, one gets $1/4.$ And it is correct that $16/64$ reduced to lowest terms is $1/4. \qquad$ Jul 7 at 19:19
• @jimjim Wolfram Alpha would seem to disagree with you and labels it as undefined. The polar form argument hasn’t led me anywhere: $0^i=(re^{i\theta})^i=(r^i)(e^{-\theta})=0^i\cdot e^{-\theta}$ where $\theta$ could be anything and we are still left with $0^i$. Jul 13 at 8:47

For $$\epsilon>0$$, we wish to evaluate $$\int_0^{\pi/2-\epsilon}\ln(1+e^{-2ix})dx$$. Let $$\delta>0$$ be small, so that
\begin{align} \int_0^{\pi/2-\epsilon}\ln(1+e^{-2ix})dx=\int_0^{\pi/2-\epsilon}\ln(1+(1-\delta)e^{-2ix})dx+\int_0^{\pi/2-\epsilon}\ln\left(\frac{1+e^{-2ix}}{1+(1-\delta)e^{-2ix}}\right)dx. \end{align} Here, \begin{align} \left|\ln\left(\frac{1+e^{-2ix}}{1+(1-\delta)e^{-2ix}}\right)\right|&=\left|\ln\left(1-\frac\delta{1+e^{2ix}}\right)\right|\\ &\le\frac32\frac\delta{|1+e^{2ix}|}\\ &=\frac32\frac\delta{\sqrt{(1+\cos(2x))^2+\sin^2(2x)}}\\ &=\frac32\frac\delta{\sqrt{2+2\cos(2x)}},\\ \end{align} (here, I used this bound), so for $$\delta$$ small enough, the second term disappears, since $$2+2\cos x\ge 2-2\cos(2\epsilon)>0$$. Now, one can safely trade the limit and the integral because of uniform convergence:
\begin{align} \int_0^{\pi/2-\epsilon}\ln(1+(1-\delta)e^{-2ix})dx&=\int_0^{\pi/2-\epsilon}\lim_{N\to\infty}\sum_{n=1}^N(-1)^{n-1}\frac1n(1-\delta)^ne^{-2nix}dx\\ &=\lim_{N\to\infty}\sum_{n=1}^N(-1)^{n-1}\frac1n(1-\delta)^n\int_0^{\pi/2-\epsilon}e^{-2nix}dx\\ &=\sum_{n=1}^\infty(-1)^{n-1}\frac1{2n^2i}(1-\delta)^n(1-(-1)^ne^{2ni\epsilon}). \end{align} Since $$\epsilon,\delta>0$$ were arbitrary, we can take the limit as they approach $$0$$.
• Also, your placement of $\delta$ in the original integral didn’t affect the integral at all, so I’m not sure what purpose $\delta$ has; surely one could just take the limit as $\epsilon$ approaches zero... as delta varies the integral expression never varied, is what I mean to say Jul 12 at 11:04
• The point of $\delta$ was to be able to exchange the limit and the integral. Uniform convergence requires the terms in the series to decrease quickly, and $\frac1ne^{-2nix}$ doesn't (but $\frac1n(1-\delta)^ne^{-2nix}$ does). Jul 12 at 12:00
• @IdioticShrike it is an easy exercise in $\epsilon-\delta$. Jul 12 at 15:00