This $\pi$ estimate is derived from Pick's theorem and the approximation of a circle with a lattice polygon
$$
\begin{equation*}
\pi \approx \lim_{r\to\infty} \frac{i + \frac{b}{2} – 1}{r^2}
\end{equation*}
$$
To derive it, Pick's theorem states
$$ A = i + \frac{b}{2} – 1 $$
where $A$ is the area of the lattice polygon.
For a circle with radius $r$, the area is given by:
$$ A = \pi r^2 $$
When the lattice polygon closely approximates the circle, their areas $A$ are nearly equal:
$$ \pi r^2 \approx i + \frac{b}{2} – 1 $$
$$ \pi \approx \frac{i + \frac{b}{2} – 1}{r^2} $$
As $ r \to \infty $, the lattice polygon becomes an increasingly accurate representation of the circle, and the area ratio converges to the value of pi:
$$
\begin{equation*}
\pi \approx \lim_{r\to\infty} \frac{i + \frac{b}{2} – 1}{r^2}
\end{equation*}
$$
Examples
For $r=10$, the estimated value of $\pi$ is $4.645000$
For $r=100$, the estimated value of $\pi$ is $3.156050$
For $r=10000$, the estimated value of $\pi$ is $3.141592$ (C Code)
Is this a valid method to estimate $\pi$?
Best Answer
Sure, it's a nice idea.
The main thing you need to prove to establish that your technique works is that the relative error in area converges to $0$ as $r\to \infty$. You didn't say exactly how you compute the lattice polygon, and depending on the details this error may be somewhat tricky to bound.
Another approach is to compute two estimates: one that's an upper bound (by ensuring the lattice polygon strictly contains the circle) and one a lower bound (by building a lattice polygon strictly inside the circle). For each $r$ this will give you both an estimate for $\pi$ and a bound on the error of the estimate.