CONTENTS

Exercise: Simulating a GBM Path and Checking Closed-Form Moments

Problem

Fix S0=100S_0 = 100, μ=0.10\mu = 0.10, σ=0.25\sigma = 0.25, T=2T = 2 years.

  1. Using the exact log-space scheme (Example 2 in the lesson), simulate N=50,000N = 50{,}000 independent GBM paths with n=504n = 504 time steps each (two years at 252 trading days per year). Record only the terminal values STS_T.
  2. Compute the sample mean, sample median, and sample standard deviation of STS_T. Compare each to the closed-form values E[ST]\mathbb{E}[S_T], Median(ST)\text{Median}(S_T), and Var(ST)\sqrt{\operatorname{Var}(S_T)} from the lesson.
  3. Verify empirically that lnST\ln S_T is approximately Gaussian. Compute the sample mean and standard deviation of lnST\ln S_T and compare to lnS0+(μ12σ2)T\ln S_0 + (\mu - \tfrac{1}{2}\sigma^2)T and σT\sigma\sqrt{T}.
  4. Estimate P(ST<S0)\mathbb{P}(S_T < S_0) — the probability that the stock has fallen after two years. Compare to the closed-form value Φ ⁣((μ12σ2)TσT)\Phi\!\left(-\frac{(\mu - \tfrac{1}{2}\sigma^2)T}{\sigma\sqrt{T}}\right).

Hint

Use rng = np.random.default_rng(2026) for reproducibility. Since only terminal values are needed, simulate with a single step per path: ST=S0exp((μ12σ2)T+σTZ)S_T = S_0 \exp((\mu - \tfrac{1}{2}\sigma^2)T + \sigma\sqrt{T}\,Z) with ZN(0,1)Z \sim \mathcal{N}(0, 1). For part 4, use from scipy.stats import norm and compare (S_T < S0).mean() to norm.cdf(-((mu - 0.5*sigma**2)*T) / (sigma*np.sqrt(T))).
Jump to the solution when you're ready.