Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself

Building a Geometric Brownian Motion (GBM) Price Model

  • From Analytic Formula to Quantum Circuit

Motivation

Pricing path-dependent derivatives such as Asian options often requires evaluating a Geometric Brownian Motion (GBM) over many time steps.
  • Classical approach: Monte Carlo simulation over many paths and timesteps.
  • Quantum approach:
  • Compress the representation of randomness (load distributions into amplitudes).
  • Achieve a quadratic speed-up for expectation estimation via Quantum Amplitude Estimation (QAE).
In this notebook we will:
  1. Derive a Chebyshev-truncated Karhunen-Loève (KL) expansion.
  2. Convert that expansion to Classiq quantum arithmetic.
  3. Synthesize hardware-aware circuits for multiple targets with a single command.
Reference: Prakash, Anupam, et al., “Quantum option pricing via the Karhunen-Loève expansion.” (2024) - https://arxiv.org/pdf/2402.10132.pdf

  1. Chebyshev Polynomials in the KL Expansion
We implement the mathematical expression (as appears in the reference article) using Chebyshev polynomials via a recurrence relation. The recursive form maps neatly onto quantum add/mul blocks that Classiq can optimize.

KL Expansion (Chebyshev-Truncated Form)

The KL expansion expresses B(t)B(t) as an orthogonal sine series with i.i.d. Gaussian coefficients aka_k. In truncated form: BL(t)=pL(a,cos(t))=a0t+2πsin(πt)∑k=0L−1akkUk(cost(πt))B_L(t) = p_L(a,cos(t)) = a_0t+\frac{\sqrt{2}}\pi sin(\pi t)\sum_{k=0}^{L-1}\frac{a_k}k U_k(cost(\pi t)) where UkU_k are Chebyshev polynomials of the second kind.

Gaussian Discretization (Classical Preprocessing)

Goal: build a discrete approximation of a Gaussian distribution so that its probabilities can be loaded into amplitudes. Typical steps:
  • Select range [μ−kσ, μ+kσ][\mu - k\sigma,\, \mu + k\sigma] (e.g., k=3k=3 standard deviations).
  • Use 2n2^n bins for nn qubits.
  • Compute bin probabilities using the Gaussian CDF:
pi=Φ(x{i+1})−Φ(xi) p_i = \Phi(x_\{i+1\}) - \Phi(x_i)
  • Normalize the probability vector so ∑ipi=1\sum_i p_i = 1.
Result:
  • A list of grid points (bin edges or centers)
  • A probability vector suitable for amplitude loading.
output

Quantum Function Approximation for sin⁡(πx)\sin(\pi x) and 2cos⁡(πx)2\cos(\pi x)

For simplicity in the demo:
  • Implement sin⁡\sin and cos⁡\cos via low-order Taylor-like polynomials (around x=0.5x=0.5).
  • This keeps the arithmetic shallow and highlights the modeling flow.
Interpretation:
  • After preparing a superposition over xx, the computed value register becomes entangled with xx, representing a function evaluation “in parallel worlds.”
Output:
Let’s execute and see that x values are entangled with values of y that are a Taylor approximation of sin around x=0.5
Output:

Chebyshev Polynomials

The Chebyshev polynomials are a sequence of orthogonal polynomials that are related to de Moivre’s formula and the trigonometric functions. They are defined by the recurrence relation: U0(x)=1,U_0(x) = 1, U1(x)=2xU_1(x) = 2x Uk+1(x)=2xUk(x)−Uk−1(x)U_{k+1}(x) = 2xU_k(x) - U_{k-1}(x)
Circuit scaling intuition:
  • Loop depth grows as O(L)O(L).
  • Doubling truncation order increases gate count only linearly (hardware-friendly).
Output:

Brownian Motion

The Brownian motion is a stochastic process that models the random movement of particles in a fluid. The approximate solution in this context is the truncated Wiener series. BL(t)=pL(a,cos(t))=a0t+2πsin(πt)∑k=0L−1akkUk(cost(πt))B_L(t) = p_L(a,cos(t)) = a_0t+\frac{\sqrt{2}}\pi sin(\pi t)\sum_{k=0}^{L-1}\frac{a_k}k U_k(cost(\pi t)) Key ingredients in the quantum model:
  • Prepare registers for coefficients a0,…,aL−1a_0,\dots,a_{L-1} from the discretized Gaussian distribution (amplitude loading).
  • Prepare a time register tt in superposition (e.g., Hadamards over a time index).
  • Compute:
    • 2cos⁡(πt)2\cos(\pi t) (or a stand-in approximation)
    • sin⁡(πt)\sin(\pi t) (or a stand-in approximation)
    • Uk(cos⁡(πt))U_k(\cos(\pi t)) via recurrence
  • Accumulate the weighted sum to form BL(t)B_L(t).

Return-To-Price Space (GBM Mapping)

Convert (log-)returns to price using the GBM form: S(t)=S0exp⁡(σ BL(t)+(μ−σ22)t)S(t) = S_0 \exp\left(\sigma\,B_L(t) + \left(\mu - \frac{\sigma^2}{2}\right)t\right) In the demo notebook :
  • Exponentiation may be implemented via a simple approximation for exp⁡(⋅)\exp(\cdot).
  • More accurate quantum exponentiation methods exist in the literature (see referenced suggestions in https://arxiv.org/pdf/2001.00807.pdf for example).

Putting It All Together

Output:

Final Reflection and Quantum Roadmap

This notebook illustrates that a mathematically heavy model (KL-truncated GBM + Chebyshev recursion) becomes circuit-light once randomness is moved into amplitudes. Next steps toward pricing (expected payoff):
  1. Amplitude loading: put Gaussian coefficients into superposition with O ⁣(n polylog(1/ϵ))O\!\left(n\,\mathrm{polylog}(1/\epsilon)\right) gates (matching the power-of-two grid).
  2. Nested QAE (conceptually):
  • First QAE estimates time-averaged price along the path.
  • Second QAE wraps the payoff.
  • Query complexity can still beat classical Monte Carlo scaling.
  1. Potential shortcut (as hinted in the reference):
  • Drop one QAE via smart time subsampling to reduce depth without extra qubits (constants and practical tradeoffs depend on implementation details).
Takeaway:
  • The classical formula is algebraically dense, but the quantum program is highly structured, enabling modeling-focused development with automated circuit synthesis.