A Note: Estimating pi
In high school, I learned the inequality:
$$ \sin(x) < x < \tan(x),\ \hbox{for}\ 0 < x < \frac{\pi}{2}. $$
(Its proof is nice and easy: we can simply draw $x$, $\sin(x)$ and $\tan(x)$ on a unit circle.) According to the above inequality, we have
$$ \frac{\pi}{n} < \tan(\frac{\pi}{n}). $$
Now, obviously, we can “estimate” the value of $\pi$ using
$$ \pi < n \tan(\frac{\pi}{n}),\ \hbox{for}\ n=1, 2, 3, \ldots . $$
For example,
`\begin{align} \pi &<& 4 \tan(\pi/4)=4,\\ \pi &<& 6 \tan(\pi/6)=2\sqrt{3}\approx 3.464102\\ \pi &<& 8 \tan(\pi/8)=8(\sqrt{2}-1)\approx 3.313708\\ \pi &<& 12 \tan(\pi/12)=12(2-\sqrt{3})\approx 3.21539 \end{align}`
Remark: If $\tan(\alpha)=a$, then
$$ \tan(\frac{\alpha}{2}) = -\frac{1}{a} + \sqrt{\frac{1}{a^2}+1}=\frac{a}{1+\sqrt{1+a^2}}. $$
In fact,
$$ \lim_{n\rightarrow \infty} n\tan(\frac{\pi}{n}) = \pi. $$
Next question: what is the convergence speed that $n\tan(\frac{\pi}{n})$ converges to $\pi$? I have done the calculation (but omit the details here) and found
$$ \lim_{n\rightarrow \infty}\frac{n\tan(\pi/n)-\pi}{1/n}=0, $$
and
$$ \lim_{n\rightarrow \infty}\frac{n\tan(\pi/n)-\pi}{1/n^2}=\frac{\pi^3}{3}. $$
Therefore,
$$ n\tan(\frac{\pi}{n}) - \pi = O(\frac{1}{n^2}). $$
We can define
$$ a_n := 2^n \tan(\frac{\pi}{2^n}) := 2^n b_n, $$
where $n$ is integer and $n\ge 2$. Using the Remark, we can establish that
$$ b_{n+1} = \frac{b_n}{1+\sqrt{1 +b_n^2}}, $$
where $n\ge 2$ and $b_2=1$. We can now use the following R code to calculate a few $a_n$ and observe how they are close to $\pi$.
# find_b_n <- function(n)
# {if (n == 2) return(1)
# b_prev <- find_b_n(n - 1)
# return(b_prev / (1 + sqrt(1 + b_prev^2)))
# }
find_b_n <- function(n)
{if (n == 2) return(1)
u <- 1
for(i in 3:n) {
u <- u / (1 + sqrt(1 + u^2))
}
return(u)
}
find_a_n <- function(n) {
return(2^n * find_b_n(n))
}
vapply(2:15, find_a_n, numeric(1))
## [1] 4.000000 3.313708 3.182598 3.151725 3.144118 3.142224 3.141750 3.141632
## [9] 3.141603 3.141595 3.141593 3.141593 3.141593 3.141593
Interesting!