ArticleslgStudy

science

Monte Carlo integration

Monte Carlo integration is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Monte Carlo integration rather than just read about it. In short: In mathematics, Monte Carlo integration is a technique for numerical integration using random numbers. It is a particular Monte Carlo method that numerically computes a definite integral.

Monte Carlo integration — main illustration
Monte Carlo integration — illustration

Key takeaways

  • Monte Carlo integration belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Monte Carlo integration to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Monte Carlo integration from memory before moving on to harder problems.

Reference excerpt

In mathematics, Monte Carlo integration is a technique for numerical integration using random numbers. It is a particular Monte Carlo method that numerically computes a definite integral. While other algorithms usually evaluate the integrand at a regular grid, Monte Carlo randomly chooses points at which the integrand is evaluated. This method is particularly useful for higher-dimensional integrals. There are different methods to perform a Monte Carlo integration, such as uniform sampling, stratified sampling, importance sampling, sequential Monte Carlo (also known as a particle filter), and mean-field particle methods.

Overview In numerical integration, methods such as the trapezoidal rule use a deterministic approach. Monte Carlo integration, on the other hand, employs a non-deterministic approach: each realization provides a different outcome. In Monte Carlo, the final outcome is an approximation of the correct value with respective error bars, and the correct value is likely to be within those error bars. The problem Monte Carlo integration addresses is the computation of a multidimensional definite integral

I = ∫ Ω f ( x ¯ ) d x ¯ {\displaystyle I=\int _{\Omega }f({\overline {\mathbf {x} }})\,d{\overline {\mathbf {x} }}}

where Ω, a subset of R m {\displaystyle \mathbb {R} ^{m}} , has volume

V = ∫ Ω d x ¯ {\displaystyle V=\int _{\Omega }d{\overline {\mathbf {x} }}}

The naive Monte Carlo approach is to sample points uniformly on Ω: given N uniform samples,

x ¯ 1 , ⋯ , x ¯ N ∈ Ω , {\displaystyle {\overline {\mathbf {x} }}_{1},\cdots ,{\overline {\mathbf {x} }}_{N}\in \Omega ,}

I can be approximated by

I ≈ Q N ≡ V 1 N ∑ i = 1 N f ( x ¯ i ) = V ⟨ f ⟩ . {\displaystyle I\approx Q_{N}\equiv V{\frac {1}{N}}\sum _{i=1}^{N}f({\overline {\mathbf {x} }}_{i})=V\langle f\rangle .}

This is because the law of large numbers ensures that

lim N → ∞ Q N = I . {\displaystyle \lim _{N\to \infty }Q_{N}=I.}

Given the estimation of I from QN, the error bars of QN can be estimated by the sample variance using the unbiased estimate of the variance.

V a r ( f ) = E ( σ N 2 ) ≡ 1 N − 1 ∑ i = 1 N E [ ( f ( x ¯ i ) − ⟨ f ⟩ ) 2 ] . {\displaystyle \mathrm {Var} (f)=\mathrm {E} (\sigma _{N}^{2})\equiv {\frac {1}{N-1}}\sum _{i=1}^{N}\mathrm {E} \left[\left(f({\overline {\mathbf {x} }}_{i})-\langle f\rangle \right)^{2}\right].}

which leads to

… excerpt ends here. Continue reading the full article.

Illustrations

Monte Carlo integration: An illustration of Monte Carlo integration. In this example, the domain D is the inner circle and the domain E is the square. Because the square's area (4) can be easily calculated, the area of the circle (π*1.02) can be estimated by the ratio (0.8) of the points inside the circle (40) to the total number of points (50), yielding an approximation for the circle's area of 4*0.8 = 3.2 ≈ π.
An illustration of Monte Carlo integration. In this example, the domain D is the inner circle and the domain E is the square. Because the square's area (4) can be easily calculated, the area of the circle (π*1.02) can be estimated by the ratio (0.8) of the points inside the circle (40) to the total number of points (50), yielding an approximation for the circle's area of 4*0.8 = 3.2 ≈ π.
Monte Carlo integration: Relative error as a function of the number of samples, showing the scaling 
  
    
      
        
          
            
              1
              
                N
              
            
          
        
      
    
    {\displaystyle {\tfrac {1}{\sqrt {N}}}}
Relative error as a function of the number of samples, showing the scaling 1 N {\displaystyle {\tfrac {1}{\sqrt {N}}}}
Monte Carlo integration: An illustration of Recursive Stratified Sampling. In this example, the function:

  
    
      
        f
        (
        x
        ,
        y
        )
        =
        
          
            {
            
              
                
                  1
                
                
                  
                    x
                    
                      2
                    
                  
                  +
                  
                    y
                    
                      2
                    
                  
                  <
                  1
                
              
              
                
                  0
                
                
                  
                    x
                    
                      2
                    
                  
                  +
                  
                    y
                    
                      2
                    
                  
                  ≥
                  1
                
              
            
            
          
        
      
    
    {\displaystyle f(x,y)={\begin{cases}1&x^{2}+y^{2}<1\\0&x^{2}+y^{2}\geq 1\end{cases}}}
  
 
from the above illustration was integrated within a unit square using the suggested algorithm. The sampled points were recorded and plotted. Clearly stratified sampling algorithm concentrates the points in the regions where the variation of the function is largest.
An illustration of Recursive Stratified Sampling. In this example, the function: f ( x , y ) = { 1 x 2 + y 2 < 1 0 x 2 + y 2 ≥ 1 {\displaystyle f(x,y)={\begin{cases}1&x^{2}+y^{2}<1\\0&x^{2}+y^{2}\geq 1\end{cases}}} from the above illustration was integrated within a unit square using the suggested algorithm. The sampled points were recorded and plotted. Clearly stratified sampling algorithm concentrates the points in the regions where the variation of the function is largest.

Worked examples

Example 1 — a first encounter with Monte Carlo integration

Start with the simplest possible case. Write down what Monte Carlo integration claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Monte Carlo integration before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Monte Carlo integration ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Monte Carlo integration

In research
Monte Carlo integration appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Monte Carlo integration in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Monte Carlo integration is common in secondary-school and first-year university syllabi. It links to neighbouring topics Monte Carlo methods, so understanding it makes those chapters shorter.
In everyday life
Look for Monte Carlo integration outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Monte Carlo integration in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Monte Carlo integration means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Monte Carlo integration out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Monte Carlo integration in simple terms?

In mathematics, Monte Carlo integration is a technique for numerical integration using random numbers. It is a particular Monte Carlo method that numerically computes a definite integral.

Why does Monte Carlo integration matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Monte Carlo integration?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Monte Carlo integration.

Tags

  • Monte Carlo methods

Keep exploring