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 information about a deck of cards
- 52 cards
- Number of red cards
- Number of black cards
- Number of different numbers...etc.
- And a pen and paper
- (and maybe a calculator, but this was the 1940s so it is less likely. But then, he was a famous mathematician - it is more likely he would have had access to a computer) to arrive at a 'perfect solution'.
So instead of finding an analytical solution, he wanted to approximate a solution.
Basically you follow these steps,
- Shuffle and deal a hand of solitaire
- Is it a perfect hand?
- If no, add one to the total number of hands dealt, go back to step 1.
- If yes, add one to the number of successful hands AND total number of hands dealt, go back step 1
- Repeat steps 1-4 1000s of times.
- Divide the # successful hands / total # hands.
- You have now arrived at an approximate probability of getting a perfect hand in solitaire.
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
- Getting a red card first draw
- The ace of spades first draw
- TWO black cards...
Let me know if what I wrote makes sense for you!
Reference: MathematicalMonk’s Youtube channel.