# Improving the Wallis product

The Wallis product for ${\pi}$, as seen on Wikipedia, is

${\displaystyle 2\prod_{k=1}^\infty \frac{4k^2}{4k^2-1} = \pi \qquad \qquad (1)}$

Historical significance of this formula nonwithstanding, one has to admit that this is not a good way to approximate ${\pi}$. For example, the product up to ${k=10}$ is

${\displaystyle 2\,\frac{2\cdot 2\cdot 4\cdot 4\cdot 6\cdot 6\cdot 8\cdot 8 \cdot 10 \cdot 10\cdot 12\cdot 12\cdot 14\cdot 14\cdot 16\cdot 16\cdot 18 \cdot 18\cdot 20\cdot 20}{1\cdot 3\cdot 3\cdot 5 \cdot 5\cdot 7\cdot 7\cdot 9\cdot 9\cdot 11\cdot 11\cdot 13\cdot 13\cdot 15\cdot 15\cdot 17\cdot 17\cdot 19\cdot 19\cdot 21} =\frac{137438953472}{44801898141} }$

And all we get for this effort is the lousy approximation ${\pi\approx \mathbf{3.0677}}$.

But it turns out that (1) can be dramatically improved with a little tweak. First, let us rewrite partial products in (1) in terms of double factorials. This can be done in two ways: either

${\displaystyle 2\prod_{k=1}^n \frac{4k^2}{4k^2-1} = (4n+2) \left(\frac{(2n)!!}{(2n+1)!!}\right)^2 \qquad \qquad (2)}$

or

${\displaystyle 2\prod_{k=1}^n \frac{4k^2}{4k^2-1} = \frac{2}{2n+1} \left(\frac{(2n)!!}{(2n-1)!!}\right)^2 \qquad \qquad (3)}$

Seeing how badly (2) underestimates ${\pi}$, it is natural to bump it up: replace ${4n+2}$ with ${4n+3}$:

${\displaystyle \pi \approx b_n= (4n+3) \left(\frac{(2n)!!}{(2n+1)!!}\right)^2 \qquad \qquad (4)}$

Now with ${n=10}$ we get ${\mathbf{3.1407}}$ instead of ${\mathbf{3.0677}}$. The error is down by two orders of magnitude, and all we had to do was to replace the factor of ${4n+2=42}$ with ${4n+3=43}$. In particular, the size of numerator and denominator hardly changed:

${\displaystyle b_{10}=43\, \frac{2\cdot 2\cdot 4\cdot 4\cdot 6\cdot 6\cdot 8\cdot 8 \cdot 10 \cdot 10\cdot 12\cdot 12\cdot 14\cdot 14\cdot 16\cdot 16\cdot 18 \cdot 18\cdot 20\cdot 20}{3\cdot 3\cdot 5 \cdot 5\cdot 7\cdot 7\cdot 9\cdot 9\cdot 11\cdot 11\cdot 13\cdot 13\cdot 15\cdot 15\cdot 17\cdot 17\cdot 19\cdot 19\cdot 21\cdot 21} }$

Approximation (4) differs from (2) by additional term ${\left(\frac{(2n)!!}{(2n+1)!!}\right)^2}$, which decreases to zero. Therefore, it is not obvious whether the sequence ${b_n}$ is increasing. To prove that it is, observe that the ratio ${b_{n+1}/b_n}$ is

${\displaystyle \frac{4n+7}{4n+3}\left(\frac{2n+2}{2n+3}\right)^2}$

which is greater than 1 because

${\displaystyle (4n+7)(2n+2)^2 - (4n+3)(2n+3)^2 = 1 >0 }$

Sweet cancellation here. Incidentally, it shows that if we used ${4n+3+\epsilon}$ instead of ${4n+3}$, the sequence would overshoot ${\pi}$ and no longer be increasing.

The formula (3) can be similarly improved. The fraction ${2/(2n+1)}$ is secretly ${4/(4n+2)}$, which should be replaced with ${4/(4n+1)}$. The resulting approximation for ${\pi}$

${\displaystyle c_n = \frac{4}{4n+1} \left(\frac{(2n)!!}{(2n-1)!!}\right)^2 \qquad \qquad (5)}$

is about as good as ${b_n}$, but it approaches ${\pi}$ from above. For example, ${c_{10}\approx \mathbf{3.1425}}$.

The proof that ${c_n}$ is decreasing is familiar: the ratio ${c_{n+1}/c_n}$ is

${\displaystyle \frac{4n+1}{4n+5}\left(\frac{2n+2}{2n+1}\right)^2}$

which is less than 1 because

${\displaystyle (4n+1)(2n+2)^2 - (4n+5)(2n+1)^2 = -1 <0 }$

Sweet cancellation once again.

Thus, ${b_n<\pi for all ${n}$. The midpoint of this containing interval provides an even better approximation: for example, ${(b_{10}+c_{10})/2 \approx \mathbf{3.1416}}$. The plot below displays the quality of approximation as logarithm of the absolute error:

• yellow dots show the error of Wallis partial products (2)-(3)
• blue is the error of ${b_n}$
• red is for ${c_n}$
• black is for ${(b_n+c_n)/2}$

And all we had to do was to replace ${4n+2}$ with ${4n+3}$ or ${4n+1}$ in the right places.