1. Home
  2. Explore
  3. Mathematics
  4. Monte Carlo Simulation Intro

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Monte Carlo Simulation Intro

Introduction to Monte Carlo Simulation

Definition and Purpose

Monte Carlo simulation is a technique used when simulation through other approaches becomes very complex or difficult. It uses random numbers to model processes by taking random samples from the distribution of a variable to supply a series of values for use in the model. The method is stochastic (involving randomness), simple to implement, and often used to solve stochastic problems by mimicking the randomness of physical behavior. Even some deterministic problems can be solved by using probability for estimation through the Monte Carlo method.

Prerequisites

To use Monte Carlo simulation, one must have knowledge of:

  • Relevant probability distributions – both theoretical and empirical

  • How distributions behave – to predict quantities and match distributions

  • The system under study – its characteristics and parameters

Key Concepts

Random Numbers and Uniform Distribution

Random numbers used in Monte Carlo simulation are uniformly distributed. They can be generated between ranges such as 1–100, 0–99, or 0–1. The probability of selecting any number within that domain is equal. Methods for generating these random numbers include:

  • Linear congruential generator

  • Mixed congruential generator

  • Random variate generation – generating random numbers according to a specific distribution function using the cumulative distribution function and the inverse transform method.

Accuracy Through Iteration

The accuracy of Monte Carlo simulation increases with the number of trials. As more iterations are performed, the results converge toward the actual value. This is a fundamental principle: larger sample sizes yield greater precision.

Process: Assigning Random Numbers to Outcomes

When dealing with empirical data that does not follow a typical distribution (e.g., arrival rates with given probabilities), we use a process based on cumulative frequency.

Steps:

  1. Identify possible outcomes and their observed frequencies (probabilities).

  2. Calculate cumulative frequencies (running total of probabilities).

  3. Assign ranges of random numbers to each outcome based on the cumulative frequencies. Since random numbers are uniformly distributed, the proportion of numbers assigned to each outcome matches its probability.

  4. Generate random numbers sequentially and map them to outcomes based on which range they fall into.

Example: Arrival Rate Assignment

Suppose arrival rates (per 5 minutes) and their probabilities are:

  • 3 arrivals: 15% probability

  • 4 arrivals: 30% probability

  • 5 arrivals: 20% probability

  • 6 arrivals: 35% probability

Cumulative frequencies:

  • 3 arrivals: 0–14 (15 numbers)

  • 4 arrivals: 15–44 (30 numbers)

  • 5 arrivals: 45–64 (20 numbers)

  • 6 arrivals: 65–99 (35 numbers)

When a random number between 0 and 99 is generated, the corresponding arrival rate is determined by which range it falls into. For example, random number 78 maps to 6 arrivals; 47 maps to 5 arrivals; 13 maps to 3 arrivals. This process is repeated sequentially to generate a stream of values.

The same method applies to service rates or any other parameter with known probabilities.

Example: Estimating the Value of Pi (π) Using Monte Carlo

Setup

Consider a circle of radius 1 inscribed in a square of side 2. The square extends from -1 to +1 on both axes.

  • Area of square = 4 square units

  • Area of circle = πππ square units (since πr2=ππr^2 = ππr2=π)

If we randomly select points uniformly within the square, the probability that a point falls inside the circle is:

P(inside)=Area of circleArea of square=π4P(\text{inside}) = \frac{\text{Area of circle}}{\text{Area of square}} = \frac{π}{4}P(inside)=Area of squareArea of circle​=4π​

Therefore, π=4×P(inside)π = 4 \times P(\text{inside})π=4×P(inside).

Procedure

  1. Generate a large number of random points (x, y) where x and y are uniformly distributed between -1 and 1.

  2. For each point, check if x2+y2≤1x^2 + y^2 ≤ 1x2+y2≤1 (point lies inside the circle).

  3. Count the number of points inside the circle.

  4. Estimate πππ as: $$π \approx 4 \times \frac{\text{points inside circle}}{\text{total points}}$$

Convergence

  • With only 500 points, the estimate may be approximate (e.g., 403 points inside gives 4×403/500=3.2244 \times 403/500 = 3.2244×403/500=3.224).

  • With 10,000 points, the estimate becomes much closer to the true value (e.g., 7,857 points inside gives 4×7857/10000=3.14284 \times 7857/10000 = 3.14284×7857/10000=3.1428).

  • As the number of iterations increases, the estimate converges to 3.14159...

Implementation Using Excel (Summary)

Excel provides a RAND() function that generates uniformly distributed random numbers between 0 and 1. To generate numbers between -1 and 1, use the formula =1-2*RAND(). Two columns of such numbers provide (x, y) coordinate pairs. For each pair, a condition =IF((x^2+y^2)<=1,1,0) determines whether the point is inside the circle. Summing these results and dividing by the total count gives the proportion inside. Multiplying by 4 yields the estimate of π. To avoid changes with every recalculation, the random numbers can be copied and pasted as values.

Applications

The Monte Carlo method is widely used in fields such as:

  • Inventory control – simulating demand and lead times

  • Queuing problems – modeling arrival and service processes

  • Risk analysis – in finance and engineering

  • Physical simulations – modeling random walks, particle behavior, etc.

Summary

  • Monte Carlo simulation uses random numbers to model processes with uncertainty.

  • It relies on uniformly distributed random numbers and the mapping of random numbers to outcomes based on cumulative probabilities.

  • Accuracy improves with more iterations – the law of large numbers ensures convergence.

  • The technique is simple, stochastic, and applicable to both stochastic and deterministic problems (e.g., estimating π).

  • Proper knowledge of probability distributions and the system being modeled is essential.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent