Nick logo Credibly Curious

Nick Tierney's (mostly) rstats blog


Monte Carlo Approximiation

Categories: Statistics

3 minute read

There are a lot of explanations of Monte Carlo approximation out there.

Here is one that worked for me.

A famous mathematician named Stan Ulam liked solitaire.

He wanted to work out the probability of getting a perfect solitaire hand.

Being a mathematician, he also wanted to work this out analytically.

What does analytical mean? It’s a fair question, as it’s wikipedia page shows that there are many definitions

Wikipedia definition:

"Analytic Solution"

- A solution to a problem that can be written in"closed form" in terms of known functions, constants, etc.

I find that such a definition relies on the reader knowing what the words 'closed form', 'known functions' and 'constants' are.

So here's my definition:

"Analytic Solution"

A solution where everything needed to solve a particular question is presented clearly and logically, with all assumptions defined.

So, getting back on track...

When Stan Ulam said that he wanted to find the probability of getting a perfect solitaire hand, he was going to do some really complex probability equations using:

The analytic solution ends up looking really complicated, and is quite complex.

So instead of finding an analytical solution, he wanted to approximate a solution.

Basically you follow these steps,

  1. Shuffle and deal a hand of solitaire
  2. Is it a perfect hand?
  3. If no, add one to the total number of hands dealt, go back to step 1.
  4. If yes, add one to the number of successful hands AND total number of hands dealt, go back step 1
  5. Repeat steps 1-4 1000s of times.
  6. Divide the # successful hands / total # hands.
  7. You have now arrived at an approximate probability of getting a perfect hand in solitaire.
Crazy as it sounds, this probability gets closer to the 'true' probability you would have found, had you worked it out analytically.

The more trial simulations (iterations) you run, the better the answer.

Now imagine that instead of wanting to know the probability of getting a perfect hand, but

Monte Carlo provides a simpler solution than the analytic method.I shall write another post extending on this one soon.

Let me know if what I wrote makes sense for you!

Reference: MathematicalMonk’s Youtube channel.