TITLE: Proof verification: $\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}=\frac{\pi}{4}$
QUESTION [12 upvotes]: While exploring the various applications of integral reduction formulae, I stumbled into what I believe to be a beautiful elementary proof of the equality
$$\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}=\frac{\pi}{4}$$
I'd greatly appreciate it if someone took the time to review it!
To arrive at the desired result, we'll need to establish the following:

Lemma: For all $n\geq 1$,$$\int_{0}^{\frac{\pi}{4}}\tan^{2n}(x)dx=(-1)^n\left(\frac{\pi}{4}-\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}\right)$$

We use mathematical induction to do this. The base case $n=1$ can be proven as follows:
\begin{align*}
\int_{0}^{\frac{\pi}{4}}\tan^2(x)\text{ }dx &= \int_{0}^{\frac{\pi}{4}}\left[\sec^2(x)-1\right]dx\\
&= \left[\tan(x)-x\right]_{0}^{\frac{\pi}{4}}\\
&= 1-\frac{\pi}{4}\\
&= -\left(\frac{\pi}{4}-1\right)\\
&= (-1)^1\left(\frac{\pi}{4}-\sum_{k=0}^{0}\frac{(-1)^k}{2k+1}\right)\\
&= (-1)^1\left(\frac{\pi}{4}-\sum_{k=0}^{1-1}\frac{(-1)^k}{2k+1}\right)
\end{align*}
Thus, the equality holds for $n=1$. If it holds for some $m\in\mathbb{N}$, then it follows that
\begin{align*}
\int_{0}^{\frac{\pi}{4}}\tan^{2(m+1)}(x)\text{ }dx &= \int_{0}^{\frac{\pi}{4}}\tan^{2m+2}(x)\text{ }dx\\
&= \int_{0}^{\frac{\pi}{4}}\tan^{2m}(x)\tan^2(x)\text{ }dx\\
&= \int_{0}^{\frac{\pi}{4}}\tan^{2m}(x)\left[\sec^2(x)-1\right]dx\\
&= \int_{0}^{\frac{\pi}{4}}\left[\tan^{2m}(x)\sec^2(x)-\tan^{2m}(x)\right]dx\\
&= \int_{0}^{\frac{\pi}{4}}\tan^{2m}(x)\sec^2(x)\text{ }dx-(-1)^m\left(\frac{\pi}{4}-\sum_{k=0}^{m-1}\frac{(-1)^k}{2k+1}\right)
\end{align*}
Here, we make the substitution $u=\tan(x)$. This gives
\begin{align*}
\int_{0}^{\frac{\pi}{4}}\tan^{2m}(x)\sec^2(x)\text{ }dx-(-1)^m\left(\frac{\pi}{4}-\sum_{k=0}^{m-1}\frac{(-1)^k}{2k+1}\right) &= \int_{0}^{1}u^{2m}\text{ }du-(-1)^m\left(\frac{\pi}{4}-\sum_{k=0}^{m-1}\frac{(-1)^k}{2k+1}\right)\\
&= \frac{1}{2m+1}-(-1)^m\left(\frac{\pi}{4}-\sum_{k=0}^{m-1}\frac{(-1)^k}{2k+1}\right)\\
&= \frac{(-1)^m(-1)^m}{2m+1}-(-1)^m\left(\frac{\pi}{4}-\sum_{k=0}^{m-1}\frac{(-1)^k}{2k+1}\right)\\
&= (-1)^m\left(\frac{(-1)^m}{2m+1}-\frac{\pi}{4}+\sum_{k=0}^{m-1}\frac{(-1)^k}{2k+1}\right)\\
&= (-1)^m\left(-\frac{\pi}{4}+\sum_{k=0}^{m}\frac{(-1)^k}{2k+1}\right)\\
&= (-1)^{m+1}\left(\frac{\pi}{4}-\sum_{k=0}^{(m+1)-1}\frac{(-1)^k}{2k+1}\right)
\end{align*}
This shows that the equality is true for $n=m+1$. Thus, mathematical induction implies that it is true for all $n\geq 1$.
With that settled, notice that
\begin{align*}
\left|\frac{\pi}{4}-\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}\right| &= \left|(-1)^n\left(\frac{\pi}{4}-\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}\right)\right|\\
&= \left|\int_{0}^{\frac{\pi}{4}}\tan^{2n}(x)\text{ }dx\right|\\
&= \int_{0}^{\frac{\pi}{4}}\tan^{2n}(x)\text{ }dx
\end{align*}
because $\tan^{2n}(x)\geq 0$. We now obtain an upper bound for the integral $\int_{0}^{\pi/4}\tan^{2n}(x)dx$. Making the substitution $x=\tan^{-1}(u)$ gives
$$\int_{0}^{\frac{\pi}{4}}\tan^{2n}(x)\text{ }dx=\int_{0}^{1}\frac{u^{2n}}{1+u^2}du$$
It's clear that $u^{2n}/(1+u^2)< u^{2n}$ except when $u=0$, so
$$\int_{0}^{1}\frac{u^{2n}}{1+u^2}du< \int_{0}^{1}u^{2n}\text{ }du=\frac{1}{2n+1}$$
Thus, we have that
$$\left|\frac{\pi}{4}-\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}\right|<\frac{1}{2n+1}$$
and since $1/(2n+1)\to 0$ as $n\to\infty$, it immediately follows from the squeeze theorem that
$$\lim_{n\to\infty}\left(\frac{\pi}{4}-\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}\right)=0$$
which is equivalent to $\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}=\frac{\pi}{4}$. $\blacksquare$
Let me know what you think!
Edit: This is harmless, but should still be addressed: the inequality $u^{2n}/(1+u^2)<u^{2n}$ should have been $u^{2n}/(1+u^2)\leq u^{2n}$, since $u^{2n}/(1+u^2)$ and $u^{2n}$ are equal if and only if $u=0$. The inequality of integrals is still strict, though.

REPLY [3 votes]: This is not an answer - just writen for your curiosity
In this question, was given for
$$I_n=\int_0^{\frac \pi 4} \tan^n (x)\, dx$$ the result
$$I_{n+1}-I_{n-1}=-\frac 1 n+\frac{1}{2} \left(\psi \left(\frac{n}{4}+1\right)-\psi   \left(\frac{n}{4}+\frac{1}{2}\right)\right)$$ and using the same approach, it is simple to show that
$$I_{n+1}+I_{n-1}=\frac 1 n$$ Adding them gives
$$I_{n+1}=\frac{1}{4} \left(\psi \left(\frac{n}{4}+1\right)-\psi   \left(\frac{n}{4}+\frac{1}{2}\right)\right)$$
So
$$J_n=\int_0^{\frac \pi 4} \tan^{2n} (x)\, dx=\frac{1}{4} \left(\psi \left(\frac{n}{2}+\frac{3}{4}\right)-\psi
   \left(\frac{n}{2}+\frac{1}{4}\right)\right)$$