It's well known that if you draw a square of 2x2 units side, and inside you draw a circle with a radius 1, and then randomly throw darts/count raindrops/etc. etc. that fall within the square, you can estimate pi as ~3.66 times as many darts/raindrops/etc. will fall inside the circle, as opposed to outside the circle but within the square (pi / (4-pi) to be exact).

For an explanation see this video

However, if I throw darts at a dartboard, I probably am (or at the very least can be thought of as) better modelled as a gaussian darts thrower, where both the x and y coordinates have a mean of 1 and a standard deviation of x.

Is there a way of intuiting what 'shape' should 'fit' inside the 2x2 square so that my dart throws can be used as a Monte Carlo method to estimate pi, given that for any throw the x and y coordinates are normally distributed around a mean of 1?

I'm not entirely sure such a shape should necessarily exist, but the question was raised to me and I had no answer.

Some basic R code below if it helps describe the problem

#do a lot of draws
n <- 10000000

#create data frame of dart/raindrop coordinates
df <- data.frame(
    x = runif(n),
    y = runif(n)
#find which fall inside/outside the circle
df$inside_circle <- ifelse(sqrt(df$x^2 + df$y^2) <= 1, 1, 0)

#estimate pi
length(which(df$inside_circle == 1)) / length(which(df$inside_circle == 0)) / (pi / (4 - pi))

#what if darts are thrown with a mean one and a sd of x?
df <- data.frame(
    x = rnorm(n, 0.5, 0.12),
    y = rnorm(n, 0.5, 0.12)

#how to estimate pi given these throws?

2 Answers 2


A straightforward version of the dart experiment when using a Gaussian distribution is when the covariance matrix fits the circle, which corresponds to a $\mathcal N_2(0,\sigma^2 I)$ distribution since $$\mathbb P(||X||^2\le 1)=\mathbb P(\sigma^{-2}||X||^2\le \sigma^{-2})=\overbrace{\mathbb P(Z\le \sigma^{-2})}^{Z\sim\chi^2_2}=1-e^{-\sigma^{-2}/2}$$ Therefore the proportion of realisations inside the unit circle $\mathcal C$ does not involve $\pi$.

To estimate $\pi$ an importance sampling version could be used instead $$\pi = \int_{\mathcal C} 1\,\text{d}x=\int_{\mathcal C} \frac{\varphi(x)}{\varphi(x)}\,\text{d}x=\mathbb E[\varphi(X)^{-1}\mathbb I_{\mathcal C}(X)]$$ hence $$\pi\approx \frac{1}{n}\sum_{i=1}^n \varphi(X_i)^{-1}\mathbb I_{\mathcal C}(X_i)\qquad X_i\stackrel{\text{iid}}{\sim}\mathcal N_2(0,\Sigma)$$


The key to calculating $\pi$ this way is being able to calculate $P[\text{dart in shape}]$ both by counting darts $(\frac{\text{total darts in shape}}{\text{total darts thrown}})$, and also with an analytical expression that somehow involves $\pi$. That lets you substitute one into the other to solve for $\pi$.

When the darts are thrown with equal likelihood of landing anywhere in the 2x2 area, you have the analytical expression:

$$ P_{\text{uniform}}[\text{dart in unit circle}] = \frac{\text{area of circle}}{\text{area of 2x2 square}} = \frac{\pi r^2}{4} = \frac{\pi}{4} $$

So you can calculate $\pi$ as:

$$ \pi = 4 \cdot \frac{\text{total darts in circle}}{\text{total darts thrown}} $$

But in general, the analytical expression is of the form:

$$ P[\text{dart in unit circle}] = \frac{\text{probability mass in shape}}{\text{probability mass in 2x2 square}}. $$

If your darts land according to a Gaussian distribution, then that expression is just the integral of the Gaussian distribution's PDF (which conveniently involves $\pi$) over the shape you choose, divided by its integral over the 2x2 square.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.