The Black–Scholes model provides a closed‑form solution for pricing European call and put options. Before writing R code, it is essential to understand the economic logic and mathematical derivation behind the formula.
For more derivatives posts, visit the Finance Blog Hub. For tutoring support, see Financial Math Tutoring.
1. Price Dynamics and Assumptions
The model assumes the underlying asset follows geometric Brownian motion:
dSₜ = μ·Sₜ·dt + σ·Sₜ·dWₜ
Where:
- Sₜ = asset price
- μ = drift
- σ = volatility
- Wₜ = standard Brownian motion
Additional assumptions:
- no arbitrage
- constant volatility σ
- constant interest rate r
- European exercise only
- no dividends (basic version)
2. Derivation Step 1: Constructing a Risk‑Free Portfolio
Let V(Sₜ, t) be the option price. Using Itô’s Lemma:
dV = (∂V/∂t)·dt + (∂V/∂S)·dSₜ + 0.5·σ²·Sₜ²·(∂²V/∂S²)·dt
Substitute dSₜ:
dV = (∂V/∂t + μ·Sₜ·∂V/∂S + 0.5·σ²·Sₜ²·∂²V/∂S²)·dt
+ σ·Sₜ·∂V/∂S·dWₜ
Form a hedged portfolio:
Π = V − Δ·Sₜ
Choose Δ = ∂V/∂S so the dWₜ term disappears. The portfolio becomes risk‑free:
dΠ = (∂V/∂t + 0.5·σ²·Sₜ²·∂²V/∂S²)·dt
By no‑arbitrage, a risk‑free portfolio must earn r:
dΠ = r·Π·dt
3. Derivation Step 2: The Black–Scholes PDE
Substitute Π = V − Sₜ·∂V/∂S:
∂V/∂t + 0.5·σ²·Sₜ²·∂²V/∂S² + r·Sₜ·∂V/∂S − r·V = 0
This is the Black–Scholes partial differential equation.
4. Derivation Step 3: Solving the PDE
Solving the PDE with the terminal payoff conditions:
- Call: V(Sₜ, T) = max(Sₜ − K, 0)
- Put: V(Sₜ, T) = max(K − Sₜ, 0)
yields the closed‑form solutions.
Key quantities:
d₁ = [ln(S₀/K) + (r + 0.5·σ²)·T] / (σ·√T)
d₂ = d₁ − σ·√T
European call:
C = S₀·N(d₁) − K·e^(−rT)·N(d₂)
European put:
P = K·e^(−rT)·N(−d₂) − S₀·N(−d₁)
5. R Code for Black–Scholes Pricing
Call Option Function
bs_call <- function(S0, K, r, sigma, T) {
d1 <- (log(S0/K) + (r + 0.5*sigma^2)*T) / (sigma*sqrt(T))
d2 <- d1 - sigma*sqrt(T)
C <- S0*pnorm(d1) - K*exp(-r*T)*pnorm(d2)
return(C)
}
Put Option Function
bs_put <- function(S0, K, r, sigma, T) {
d1 <- (log(S0/K) + (r + 0.5*sigma^2)*T) / (sigma*sqrt(T))
d2 <- d1 - sigma*sqrt(T)
P <- K*exp(-r*T)*pnorm(-d2) - S0*pnorm(-d1)
return(P)
}
6. Example: Pricing a Call and Put in R
Example parameters:
- S₀ = 100
- K = 100
- r = 0.05
- σ = 0.20
- T = 1 year
bs_call(100, 100, 0.05, 0.20, 1)
bs_put(100, 100, 0.05, 0.20, 1)
This produces the theoretical fair values under the Black–Scholes model.
Need Help With Options or R Programming?
For more support, visit the Financial Math Tutoring page or reach out through the Contact Page. Troubleshooting steps are available in the Troubleshooting Hub.

Leave a Reply