Project 1:
Analyzing Monte Carlo Integration

Steve Dunbar
Math 489/889
Fall 2010

December 1, 2010

One of the methods used extensively in mathematical finance is the Monte Carlo method. A Monte Carlo method is “Any method which solves a problem by generating suitable random numbers and observing that fraction of the numbers obeying some property or properties. The method is useful for obtaining numerical solutions to problems which are too complicated to solve analytically. It was named by S. Ulam, who in 1946 became the first mathematician to dignify this approach with a name, in honor of a relative having a propensity to gamble …” (from Weisstein, Eric W. ”Monte Carlo Method.” From MathWorld–A Wolfram Web Resource. ,

We don’t have the time or the background to thoroughly explore the huge variety of Monte Carlo methods, and the complicated problems they are used to solve, especially in mathematical finance. However, we can get some insight into basic Monte Carlo methods with some well-chosen examples. In fact, we will use the probability theory that we have developed to analyze the likely error that this probabilistic method creates.

Recall that E X =xf(x)dx where f(x) is the p.d.f. of the random variable X. Slightly generalizing, E G(X) =G(x)f(x)dx when G() is some function defined on the range of X. We have already used this idea when we defined the m.g.f.

Suppose we wish to numerically evaluate J =0π2 cos(x)dx reliably to some specified relative error. (Although we can evaluate this integral with basic calculus, pretend that this is an integral which is too complicated to solve analytically. ) We notice that we could consider

0π2 cos(x)dx = π 2 0π2 cos(x) 2 πdx

and that

E cos(X) =0π2 cos(x) 2 πdx

is the mean of cos(X), where X is a uniformly distributed random variable on [0,π2]. Therefore

J = π 2 E cos(X).

But we have another way to evaluate the mean and therefore the integral, namely

Jn = π 2 1 n i=1n cos(X i)

where the Xk are uniformly distributed random numbers on the interval [0,π2].

  1. For preliminary reference, use calculus to symbolically evaluate μ = E cos(X) and σ2 = Var cos(X). Numerically evaluate both to at least 5 places of accuracy.
  2. Express the mean and variance of Jn in terms of μ and σ2 respectively.
  3. Justify that
    Jn J Var Jn

    is approximately normally distributed, and specify the mean and variance of the distribution.

  4. Now find z so that
    | Jn J Var Jn | < z 0.99

  5. The absolute error of the estimate is |Jn J|. We desire that with probability greater than 0.99, the absolute error from our experiment be less than 0.05. Find a value of n large enough that the experiment reliably (probability > 0.99 ) generates this level of accuracy.
  6. Using some software, (A spreadsheet program such as Excel is sufficient, but other software such as Maple, Mathematica, Octave, Matlab, R, perl, and Python will also be satisfactory) actually do the Monte Carlo method to evaluate 0π2 cos(x)dx.
  7. Calculate the integral
    J =0π2 sin(x)dx

    by a Monte Carlo method so that with probability P 0.99 the absolute error will not exceed 0.05. Use only the intuition gained from the previous analysis.