Question
How can we compute $\pi$ using Monte Carlo, and what is the standard deviation of the estimator?
Solution

Correct estimator.

Generate i.i.d. uniform random variables $X,Y \sim \mathrm{Uniform}(0,1)$ and check whether $$ X^2 + Y^2 < 1. $$

The probability of this event is the area of a quarter unit circle inside the unit square: $$ \mathbb{P}(X^2 + Y^2 < 1) = \frac{\pi}{4}. $$

Let $$ A_n = \sum_{i=1}^n X_i, $$ where $X_i$ is the indicator of the event ${X_i^2 + Y_i^2 < 1}$.
Then $$ \mathbb{E}[X_i] = \frac{\pi}{4}, $$ so the estimator $$ \hat{\pi}_n = \frac{4 A_n}{n} $$ is unbiased.

Solution

Standard deviation of the estimator.

Since $X_i$ is Bernoulli, $$ \mathrm{Var}(X_i) = \mathbb{E}[X_i^2] - (\mathbb{E}[X_i])^2 = \frac{\pi}{4} - \frac{\pi^2}{16}. $$

Thus, $$ \mathrm{Var}(A_n) = n \left( \frac{\pi}{4} - \frac{\pi^2}{16} \right). $$

For the estimator, $$ \hat{\pi}_n = \frac{4A_n}{n}, $$ we have $$ \mathrm{Var}(\hat{\pi}_n) = \frac{16}{n^2} \mathrm{Var}(A_n) = \frac{16}{n^2} \cdot n \left( \frac{\pi}{4} - \frac{\pi^2}{16} \right) = \frac{4\pi - \pi^2}{n}. $$

Therefore, the standard deviation is $$ \sqrt{\frac{4\pi - \pi^2}{n}}. $$