Mathematical Finance
Pricing, Hedging, Stochastic Models, and Financial Risk
Welcome
This book is an applied mathematical introduction to modern mathematical finance. The goal is to explain the main ideas of asset pricing, hedging, stochastic modeling, fixed income, portfolio theory, and financial risk with a balance of mathematical clarity, computational intuition, and hands-on Python experiments.
The guiding principle is that financial models are not only formulas. They are mathematical languages for describing uncertainty, pricing cash flows, managing risk, and testing assumptions. Throughout the book, we move between three complementary viewpoints:
- Mathematical structure: no-arbitrage, martingales, stochastic processes, partial differential equations, optimization, and statistical estimation.
- Computational practice: simulation, numerical pricing, calibration, finite differences, regression, and risk backtesting.
- Financial interpretation: portfolios, options, bonds, yield curves, volatility smiles, hedging errors, and model risk.
The book is designed for graduate students in applied mathematics, statistics, operations research, data science, quantitative finance, and related fields.
Read the mathematical sections first, then run the companion Google Colab labs. The labs are written for independent study, so each notebook includes background explanation before programming.
Main learning goals
After working through the book and labs, students should be able to:
- compute and interpret simple returns, log returns, discount factors, and compounded rates;
- explain the no-arbitrage principle and its connection to pricing by replication;
- price derivatives using binomial trees, Monte Carlo simulation, Black–Scholes formulas, and finite difference methods;
- simulate Brownian motion, geometric Brownian motion, stochastic volatility, and short-rate models;
- understand the role of martingales and risk-neutral measures in derivative pricing;
- compute Greeks and understand dynamic hedging error;
- infer implied volatility and analyze volatility smiles;
- model yield curves and price bonds under deterministic and stochastic interest rates;
- construct mean-variance portfolios and interpret factor exposures;
- estimate and backtest Value at Risk and Expected Shortfall;
- connect mathematical finance models to practical model risk and numerical limitations.
Mathematical themes
The central mathematical objects in this book include:
Prices and returns
\[ R_t = \frac{S_t-S_{t-1}}{S_{t-1}}, \qquad r_t = \log S_t - \log S_{t-1}. \]
No-arbitrage pricing
A derivative price is determined by the cost of a self-financing portfolio that replicates its payoff.
Risk-neutral valuation
Under a risk-neutral measure \(Q\),
\[ V_0 = E^Q\left[e^{-rT}H(S_T)\right]. \]
Geometric Brownian motion
\[ dS_t = \mu S_t\,dt + \sigma S_t\,dW_t. \]
Black–Scholes pricing
\[ C(S_0,K,T,r,\sigma) = S_0N(d_1)-Ke^{-rT}N(d_2), \]
where
\[ d_1 = \frac{\log(S_0/K)+(r+\sigma^2/2)T}{\sigma\sqrt{T}}, \qquad d_2=d_1-\sigma\sqrt{T}. \]
Stochastic calculus
\[ df(t,X_t) = f_t(t,X_t)\,dt + f_x(t,X_t)\,dX_t + \frac12 f_{xx}(t,X_t)\,(dX_t)^2. \]
Portfolio optimization
\[ \min_w \; w^T\Sigma w \qquad \text{subject to} \qquad \mathbf 1^T w = 1. \]
Financial risk measurement
\[ \operatorname{VaR}_\alpha(L) = \inf\{x : P(L\le x)\ge \alpha\}, \]
and
\[ \operatorname{ES}_\alpha(L) = E[L \mid L \ge \operatorname{VaR}_\alpha(L)]. \]
Suggested book structure
The following structure supports a one-semester graduate course or an independent-study sequence.
| Part | Topics | Main mathematical tools |
|---|---|---|
| Part I | Foundations of pricing | Returns, compounding, arbitrage, replication |
| Part II | Discrete-time models | Binomial trees, backward induction, risk-neutral probabilities |
| Part III | Continuous-time equity models | Brownian motion, GBM, Black–Scholes, Greeks |
| Part IV | Numerical methods | Monte Carlo, variance reduction, finite differences |
| Part V | Stochastic calculus and measure change | Ito integrals, Ito formula, martingales, Girsanov theorem |
| Part VI | Fixed income | Bonds, duration, yield curves, short-rate models, HJM |
| Part VII | Portfolio and risk | Mean-variance optimization, factor models, VaR, ES |
| Part VIII | Advanced models and integration | Heston model, calibration, hedging, model risk |
Companion computer labs
The computer labs are designed to be opened in Google Colab from the GitHub repository:
https://github.com/wanghemath/Book-MathFinance
Each lab is self-contained and includes background knowledge before programming. Students can run the notebooks without needing market data downloads because the labs use synthetic data unless otherwise stated.
Lab roadmap
| Lab | Title | Main methods | Open in Colab |
|---|---|---|---|
| 1 | Prices, Returns, Compounding, and One-Period No-Arbitrage | Returns, portfolios, one-step replication | Colab |
| 2 | Multi-Period Binomial Trees and Risk-Neutral Pricing | Backward induction, binomial hedging | Colab |
| 3 | Brownian Motion, GBM, and Monte Carlo Pricing | Simulation, confidence intervals | Colab |
| 4 | Black–Scholes Formula, Greeks, and Delta Hedging | Greeks, finite differences, hedging error | Colab |
| 5 | Implied Volatility and the Volatility Smile | Implied volatility inversion, smile fitting | Colab |
| 6 | Monte Carlo Variance Reduction | Antithetic variables, control variates, stratification | Colab |
| 7 | Exotic Options: Asian, Barrier, and Lookback Options | Path-dependent payoffs, Monte Carlo pricing | Colab |
| 8 | Finite Difference Methods for the Black–Scholes PDE | Explicit, implicit, Crank–Nicolson schemes | Colab |
| 9 | Stochastic Calculus by Simulation | Ito integrals, quadratic variation, Ito formula | Colab |
| 10 | Martingales, Change of Measure, and Girsanov Simulation | Risk-neutral measure, likelihood-ratio reweighting | Colab |
| 11 | Interest Rates, Bonds, Duration, Convexity, and Yield Curves | Discount factors, YTM, DV01, bootstrapping | Colab |
| 12 | Short-Rate Models: Vasicek and CIR | Stochastic rates, affine bond pricing | Colab |
| 13 | HJM and Yield-Curve Simulation | Forward-rate modeling, HJM drift restriction | Colab |
| 14 | Portfolio Optimization: Mean-Variance Theory and Constraints | Efficient frontier, constraints, shrinkage | Colab |
| 15 | CAPM, Factor Models, and Risk Decomposition | Regression, beta, alpha, tracking error | Colab |
| 16 | Value at Risk, Expected Shortfall, and Risk Backtesting | Historical VaR, EWMA, Kupiec test | Colab |
| 17 | Stochastic Volatility: The Heston Model | Correlated Brownian motions, Fourier pricing, calibration | Colab |
| 18 | Integrated Pricing, Hedging, Calibration, and Risk | End-to-end quantitative finance workflow | Colab |
Recommended prerequisites
Students should have some familiarity with:
- multivariable calculus;
- linear algebra;
- probability theory;
- basic statistics;
- Python programming with arrays and plots.
Prior exposure to stochastic processes is helpful but not required. The labs introduce the needed computational background step by step.
Python environment
The labs use standard Python packages that are available in Google Colab:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.optimize import minimize, brentqSome labs also use small helper functions for simulation, pricing, regression, and numerical linear algebra. These are included directly in the notebooks so that students can read and modify the code.
Pedagogical style
Each chapter and lab follows the same learning pattern:
- Start with the financial question. What needs to be priced, hedged, optimized, or measured?
- Introduce the mathematical model. What assumptions turn the financial problem into a mathematical problem?
- Derive the key formula or algorithm. What does no-arbitrage, optimization, or probability imply?
- Implement the method in Python. What does the model produce numerically?
- Stress-test the assumptions. What changes when parameters, data, or model assumptions change?
- Reflect on model risk. What does the model explain, and what does it ignore?
Suggested course use
For a 14-week semester, one possible pacing is:
| Week | Topics |
|---|---|
| 1 | Returns, compounding, no-arbitrage |
| 2 | Binomial models and risk-neutral pricing |
| 3 | Brownian motion and GBM |
| 4 | Black–Scholes and Greeks |
| 5 | Implied volatility and volatility smiles |
| 6 | Monte Carlo and variance reduction |
| 7 | Exotic options and path dependence |
| 8 | Black–Scholes PDE and finite differences |
| 9 | Stochastic calculus and Ito formula |
| 10 | Martingales and change of measure |
| 11 | Bonds, duration, and yield curves |
| 12 | Short-rate models and HJM |
| 13 | Portfolio optimization and factor models |
| 14 | Risk measurement, Heston model, and integrated project |
Final project ideas
Students may extend the labs into final projects such as:
- comparing binomial, Monte Carlo, and finite-difference option prices;
- testing Delta hedging under volatility misspecification;
- calibrating a volatility smile and pricing exotic options under the fitted smile;
- comparing Vasicek and CIR yield curves;
- building a small factor-risk model for a synthetic portfolio;
- backtesting VaR and Expected Shortfall models;
- studying the effect of stochastic volatility on implied-volatility skew;
- designing an integrated pricing, hedging, and risk dashboard.
Repository
The source files for the book and labs are intended to be hosted at:
https://github.com/wanghemath/Book-MathFinance
A typical repository structure is:
Book-MathFinance/
├── _quarto.yml
├── index.qmd
├── chapters/
│ ├── chapter-01-foundations.qmd
│ ├── chapter-02-binomial-models.qmd
│ └── ...
├── labs/
│ ├── lab-01-foundations-returns-no-arbitrage.ipynb
│ ├── lab-02-binomial-trees-risk-neutral-pricing.ipynb
│ └── ...
├── references.bib
└── README.md