Estimate $\pi$ using the Shoelace formula.

112 Views Asked by At

$$\pi \approx \lim_{k \to \infty} \frac{5^{-k}}{2} \cdot \left|\sum_{i=1}^{4(k+1)} (x_i y_{i+1} - x_{i+1} y_i)\right|$$

Derivation

This lemma states

For any non-negative integer $k$, $x^2+y^2=5^k$ has $4(k+1)$ integer solutions.

For a circle, the area is given by

$$A = \pi r^2$$

For a polygon, the area is given by the Shoelace formula

$$A = \frac{1}{2} \left| \sum_{i=1}^n (x_i y_{i+1} - x_{i+1} y_i) \right|$$

When the lattice polygon closely approximates the circle, their areas are nearly equal

$$\pi r^2 \approx \frac{1}{2} \left| \sum_{i=1}^n (x_i y_{i+1} - x_{i+1} y_i) \right|$$

Substituting $n=4(k+1)$ and $r^2 = 5^k$, then as $k \to \infty$

$$\pi \approx \lim_{k \to \infty} \frac{5^{-k}}{2} \cdot \left|\sum_{i=1}^{4(k+1)} (x_i y_{i+1} - x_{i+1} y_i)\right|$$

Example

For $k=4$, there are $20$ polygon vertices, $\pi \approx 3.0901699$

k4

For $k=3600$, ran a C program, $\pi \approx 3.1415926$

Question

Is this a correct new method to estimate $\pi$?