CONTENTS

Numerical Integration

Motivation: why this matters in quant finance

Most integrals in quantitative finance do not have closed-form solutions. The Black-Scholes formula is a celebrated exception — the log-normal assumption produces an integral that can be evaluated analytically. But the moment you move beyond vanilla European options on a single log-normal underlying, closed forms disappear: stochastic volatility models (Heston), local volatility models, path-dependent options (Asian, lookback, barrier), multi-asset options (baskets, rainbows), and American options all require numerical integration.
Numerical integration — also called quadrature — approximates abf(x)dx\int_a^b f(x)\,dx by a weighted sum of function evaluations. The choice of method depends on the dimension of the integral, the smoothness of the integrand, and the accuracy required:
  • Low-dimensional, smooth integrands (1D–3D): deterministic quadrature (trapezoidal, Simpson's, Gaussian) is fast and accurate.
  • High-dimensional integrands (5D+): Monte Carlo simulation scales gracefully with dimension and is the workhorse of derivatives pricing.
  • Special structures (oscillatory integrands, semi-infinite domains): Fourier-based methods (FFT) exploit the characteristic function directly.

This page covers the main methods, their error properties, and when to use each.

Deterministic quadrature

General framework

A quadrature rule approximates abf(x)dx\int_a^b f(x)\,dx by:

Qn[f]=i=0nwif(xi)Q_n[f] = \sum_{i=0}^{n} w_i\,f(x_i)
where x0,,xnx_0, \ldots, x_n are nodes (the points where ff is evaluated) and w0,,wnw_0, \ldots, w_n are weights. Different choices of nodes and weights give different methods with different accuracy.

Trapezoidal rule

Approximate ff by a piecewise linear function on each subinterval. For nn equal subintervals of width h=(ba)/nh = (b-a)/n:

Tn=h[f(a)2+i=1n1f(a+ih)+f(b)2]T_n = h\left[\frac{f(a)}{2} + \sum_{i=1}^{n-1} f(a + ih) + \frac{f(b)}{2}\right]
Error: TnI=O(h2)=O(1/n2)|T_n - I| = O(h^2) = O(1/n^2). Doubling the number of points quadruples the accuracy.
When to use: Simple to implement, good for smooth functions, and surprisingly effective for periodic functions on a full period (where the error drops to O(ecn)O(e^{-cn}) — exponential convergence).

Simpson's rule

Approximate ff by a piecewise quadratic (parabola) on each pair of subintervals. For nn subintervals (nn even):

Sn=h3[f(a)+4i oddf(a+ih)+2i even,i0,nf(a+ih)+f(b)]S_n = \frac{h}{3}\left[f(a) + 4\sum_{i \text{ odd}} f(a + ih) + 2\sum_{i \text{ even}, i \neq 0, n} f(a + ih) + f(b)\right]
Error: SnI=O(h4)=O(1/n4)|S_n - I| = O(h^4) = O(1/n^4). Much faster convergence than the trapezoidal rule for smooth functions.
When to use: The default choice for low-dimensional smooth integrals. Most implementations of numerical CDF evaluation (e.g., computing Φ(z)\Phi(z) for the normal distribution) use Simpson's rule or a variant internally.

Gaussian quadrature

Choose both the nodes xix_i and the weights wiw_i optimally. Gauss-Legendre quadrature uses n+1n+1 nodes to integrate polynomials of degree up to 2n+12n+1 exactly:
11f(x)dxi=0nwif(xi)\int_{-1}^{1} f(x)\,dx \approx \sum_{i=0}^{n} w_i\,f(x_i)

where xix_i are the roots of the Legendre polynomial Pn+1(x)P_{n+1}(x) and the weights are computed from these roots.

Error: O(1/n2n+2)O(1/n^{2n+2}) for smooth functions — much faster than Simpson's rule.
Variants for specific domains and weight functions:
VariantDomainWeight functionUse case
Gauss-Legendre[1,1][-1, 1]1Standard bounded integrals
Gauss-Hermite(,)(-\infty, \infty)ex2e^{-x^2}Expectations under the normal distribution
Gauss-Laguerre[0,)[0, \infty)exe^{-x}Discounted payoff integrals
Gauss-Hermite is particularly relevant in quant finance: it is tailor-made for computing E[f(Z)]\mathbb{E}[f(Z)] where ZN(0,1)Z \sim \mathcal{N}(0,1), because the weight function matches the Gaussian density. With only 10–20 nodes, it can achieve machine precision for smooth payoffs.
When to use: When high accuracy is needed for low-dimensional integrals and the integrand is smooth. Gauss-Hermite is the method of choice for semi-analytical pricing formulas that reduce to 1D or 2D integrals over normal variables.

Monte Carlo integration

The basic idea

Monte Carlo integration estimates abf(x)dx\int_a^b f(x)\,dx by random sampling. If XUniform(a,b)X \sim \text{Uniform}(a, b), then:

abf(x)dx=(ba)E[f(X)](ba)1Ni=1Nf(Xi)\int_a^b f(x)\,dx = (b-a)\,\mathbb{E}[f(X)] \approx (b-a) \cdot \frac{1}{N}\sum_{i=1}^{N} f(X_i)

where X1,,XNX_1, \ldots, X_N are i.i.d. draws. The law of large numbers guarantees convergence as NN \to \infty.

More generally, for any probability density p(x)p(x):

E[f(X)]=f(x)p(x)dx1Ni=1Nf(Xi),Xip\mathbb{E}[f(X)] = \int f(x)\,p(x)\,dx \approx \frac{1}{N}\sum_{i=1}^{N} f(X_i), \qquad X_i \sim p

Error and convergence

The Monte Carlo estimator has standard error:

SE=σfN\text{SE} = \frac{\sigma_f}{\sqrt{N}}

where σf2=Var(f(X))\sigma_f^2 = \text{Var}(f(X)). The convergence rate is O(1/N)O(1/\sqrt{N}) — independent of the dimension of the integral.

This is the key advantage: For a 1D integral, deterministic quadrature converges at O(1/n4)O(1/n^4) (Simpson's) or better, vastly outperforming Monte Carlo. But for a 100-dimensional integral (e.g., pricing a basket option on 100 assets), the convergence of deterministic methods degrades exponentially with dimension (the "curse of dimensionality"), while Monte Carlo remains at O(1/N)O(1/\sqrt{N}). In high dimensions, Monte Carlo wins.
The cost: O(1/N)O(1/\sqrt{N}) convergence is slow. To halve the error, you need four times as many samples. For 2 digits of accuracy you need ~10410^4 samples; for 4 digits, ~10810^8.

Pricing options by Monte Carlo

The risk-neutral pricing formula V0=erTEQ[payoff(ST)]V_0 = e^{-rT}\mathbb{E}^{\mathbb{Q}}[\text{payoff}(S_T)] is directly amenable to Monte Carlo:

  1. Simulate NN independent paths of STS_T under Q\mathbb{Q}:
ST(i)=S0exp((rσ22)T+σTZi),ZiN(0,1)S_T^{(i)} = S_0\exp\left(\left(r - \frac{\sigma^2}{2}\right)T + \sigma\sqrt{T}\,Z_i\right), \qquad Z_i \sim \mathcal{N}(0,1)
  1. Compute the average discounted payoff:
V^0=erT1Ni=1Npayoff(ST(i))\hat{V}_0 = e^{-rT}\frac{1}{N}\sum_{i=1}^{N}\text{payoff}(S_T^{(i)})

For a European call: payoff(ST(i))=(ST(i)K)+\text{payoff}(S_T^{(i)}) = (S_T^{(i)} - K)^+.

The standard error provides a confidence interval: V^0±1.96SE\hat{V}_0 \pm 1.96 \cdot \text{SE} is a 95% CI.

Variance reduction techniques

Since Monte Carlo convergence is O(1/N)O(1/\sqrt{N}), reducing the variance σf2\sigma_f^2 is as effective as increasing NN. The main techniques are:

Antithetic variates. For each sample ZiZ_i, also use Zi-Z_i. Since ZZ and Z-Z have the same distribution, both are valid samples, but they are negatively correlated, which reduces the variance of the average. For a call option on GBM, antithetic variates typically reduce variance by 50–80%.
Control variates. Use a correlated variable with known expectation to adjust the estimate. For example, the stock price itself has known expectation EQ[ST]=S0erT\mathbb{E}^{\mathbb{Q}}[S_T] = S_0 e^{rT}, so:
V^CV=V^0β(1NST(i)S0erT)\hat{V}_{\text{CV}} = \hat{V}_0 - \beta\left(\frac{1}{N}\sum S_T^{(i)} - S_0 e^{rT}\right)

where β\beta is chosen to minimise variance. This exploits the correlation between the payoff and the control to cancel out noise.

Importance sampling. Sample from a distribution q(x)q(x) that concentrates probability where the integrand is large, and reweight by p(x)/q(x)p(x)/q(x). This is closely related to the change of measure framework: importance sampling is a numerical change of measure, and the optimal importance distribution is the one that minimises variance.
Stratified sampling. Divide the sampling space into strata and sample from each stratum separately, ensuring uniform coverage. Reduces variance by eliminating "clumping" of random samples.

Quasi-Monte Carlo

Replace the pseudo-random samples with low-discrepancy sequences (Sobol, Halton, Niederreiter) that fill the sample space more uniformly than random points. The convergence rate improves to approximately O(1/N)O(1/N) (up from O(1/N)O(1/\sqrt{N})) for sufficiently smooth integrands in moderate dimensions.

In practice, quasi-Monte Carlo with Sobol sequences is widely used in derivatives pricing desks, often providing 10–100x speedup over standard Monte Carlo for the same accuracy.

Fourier-based methods

The Carr-Madan FFT approach

For European options under models where the characteristic function of lnST\ln S_T is known analytically (GBM, Heston, variance gamma, etc.), the option price can be written as:
C(K)=eαlnKπ0eivlnKψ(v)dvC(K) = \frac{e^{-\alpha \ln K}}{\pi}\int_0^{\infty} e^{-iv\ln K}\,\psi(v)\,dv
where ψ(v)\psi(v) involves the characteristic function and α\alpha is a damping parameter. This integral is a Fourier transform evaluated at lnK\ln K, and it can be computed for many strikes simultaneously using the Fast Fourier Transform (FFT) in O(NlogN)O(N\log N) operations.
Advantages: Extremely fast (prices at hundreds of strikes in milliseconds), exact up to discretisation error, and works for any model with a known characteristic function — including stochastic volatility and jump-diffusion models where the density itself has no closed form.
When to use: Calibrating models to the implied volatility surface, where you need option prices at many strikes and maturities. The FFT approach is the industry standard for Heston model calibration.

COS method

An alternative Fourier method that expands the density in a cosine series. Often faster and more accurate than FFT for individual option prices, with error control that is easier to analyse.

Choosing the right method

ScenarioRecommended methodReason
1D smooth integralGaussian quadratureExponential convergence, machine precision with few nodes
Φ(z)\Phi(z) evaluationSimpson's or series expansionStandard, fast, well-implemented in libraries
European option, known char. functionFFT / COSO(NlogN)O(N\log N), many strikes simultaneously
European option, no char. functionMonte Carlo with variance reductionFlexible, dimension-independent
Path-dependent option (Asian, barrier)Monte CarloMust simulate paths; no analytical shortcuts
High-dimensional (basket, multi-asset)Monte Carlo / quasi-MCCurse of dimensionality kills deterministic methods
American optionLeast-squares Monte Carlo (Longstaff-Schwartz) or tree/PDEEarly exercise requires backward induction

Examples and applications

Example 1: computing Φ(z)\Phi(z) by Simpson's rule

The standard normal CDF Φ(z)=zϕ(t)dt\Phi(z) = \int_{-\infty}^{z} \phi(t)\,dt has no elementary antiderivative. In practice, it is computed by transforming to a finite interval and applying quadrature. For z>0z > 0, use the symmetry Φ(z)=0.5+0zϕ(t)dt\Phi(z) = 0.5 + \int_0^z \phi(t)\,dt and apply Simpson's rule to the finite integral 0zϕ(t)dt\int_0^z \phi(t)\,dt with n=20n = 20 subintervals. Since ϕ\phi is smooth and rapidly decaying, the error is negligible for all practical zz values.

Example 2: Monte Carlo pricing of an Asian call

An Asian call has payoff (SˉK)+(\bar{S} - K)^+ where Sˉ=1mj=1mStj\bar{S} = \frac{1}{m}\sum_{j=1}^{m} S_{t_j} is the average price over mm observation dates. There is no closed-form price because the sum of log-normal random variables is not log-normal.

Monte Carlo approach:

  1. For each path i=1,,Ni = 1, \ldots, N: simulate St1(i),,Stm(i)S_{t_1}^{(i)}, \ldots, S_{t_m}^{(i)} under Q\mathbb{Q} using the GBM recursion Stj+1=Stjexp((rσ2/2)Δt+σΔtZij)S_{t_{j+1}} = S_{t_j}\exp((r - \sigma^2/2)\Delta t + \sigma\sqrt{\Delta t}\,Z_{ij}).
  2. Compute the average Sˉ(i)=1mjStj(i)\bar{S}^{(i)} = \frac{1}{m}\sum_j S_{t_j}^{(i)}.
  3. Compute the payoff (Sˉ(i)K)+(\bar{S}^{(i)} - K)^+.
  4. Estimate price =erT1Ni(Sˉ(i)K)+= e^{-rT}\frac{1}{N}\sum_i (\bar{S}^{(i)} - K)^+.

With N=100,000N = 100{,}000 paths and m=252m = 252 (daily observations), the standard error is typically a few cents on a $100 option — sufficient for trading purposes.

Example 3: Gauss-Hermite for a 1D Heston-style integral

After Fourier inversion, many stochastic volatility models reduce the option price to a 1D integral of the form:

C=h(v)ev2/2dvC = \int_{-\infty}^{\infty} h(v)\,e^{-v^2/2}\,dv

where h(v)h(v) involves the characteristic function. Gauss-Hermite quadrature with n=32n = 32 nodes evaluates this to 12+ digits of accuracy, vastly outperforming Monte Carlo for this particular structure.

Common confusions and pitfalls

"Monte Carlo is always the best method." For low-dimensional smooth integrals, deterministic quadrature is faster by orders of magnitude. Monte Carlo's advantage is in high dimensions and for non-smooth or path-dependent integrands. Use the right tool for the problem.
"More random samples always improves accuracy." The standard error decreases as 1/N1/\sqrt{N}, so going from 10410^4 to 10510^5 samples only improves accuracy by a factor of 103.2\sqrt{10} \approx 3.2. Variance reduction (antithetic variates, control variates) is often more effective than brute-force sampling.
"Numerical integration is exact." All numerical methods have error. The question is whether the error is acceptable for the application. For trading decisions, a few cents of error in a Monte Carlo estimate may be fine. For model calibration, you may need the precision of Gaussian quadrature or FFT.
"The FFT works for all models." The FFT/COS methods require a known characteristic function. Models defined only by their SDE (e.g., local volatility with a general surface) do not have analytical characteristic functions and must use Monte Carlo or PDE methods instead.

Where this goes next

Numerical integration is the computational engine that makes the analytical framework practical:

  • The Riemann Integral: Numerical integration approximates the Riemann integral when no antiderivative exists.
  • Normal Distribution: The CDF Φ(z)\Phi(z) is computed by numerical integration, typically Simpson's rule or a rational approximation.
  • Log-Normal Distribution: Option pricing integrals under the log-normal model are solved analytically (Black-Scholes) or numerically (Monte Carlo for exotics).
  • Change of Variables: The change-of-measure framework connects importance sampling (a Monte Carlo technique) to the Radon-Nikodym derivative and risk-neutral pricing.
  • Brownian Motion and GBM: Monte Carlo pricing simulates paths of these processes and averages discounted payoffs.

References

  • Stewart, J. (2008). Single Variable Calculus: Early Transcendentals (6th ed.). Thomson Brooks/Cole. Ch. 7 Section 7.7 (Approximate Integration) for midpoint, trapezoidal, Simpson, and error-estimate ideas.