Understanding the central limit theorem
The Monte Carlo method is essentially a numerical method for calculating the expected value of random variables; that is, an expected value that cannot be easily obtained through direct calculation. To obtain this result, the Monte Carlo method is based on two fundamental theorems of statistics: the law of large numbers and the central limit theorem.
Law of large numbers
This theorem states the following: considering a very large number of variables, , the integral that defines the average value is approximate to the estimate of the expected value. Let's try to give an example so that you understand this. We flip a coin 10 times, 100 times, and 1,000 times and check how many times we get heads. We can put the results we obtained into a table, as follows:
![4.4 – Table showing the results for coin toss](https://static.packt-cdn.com/products/9781838985097/graphics/image/Figure_4.4_Table_showing_the_results_for_coin_toss.jpg)
Figure 4.4 – Table showing the results for coin toss
Analyzing the last column of the previous table, we can see that the value of the frequency...