Integral Calculus and Differential Equations › Integration Techniques for Finance

Michael BrenndoerferOctober 28, 20259 min read
Quantitative FinanceAll chapters
Part 1 of 15Mathematical Foundations
Chapter 7Integral Calculus and Differential Equations › Integration Techniques for Finance
Reading section 4 of 14 · Integration Techniques for Finance · 9 minSection 4 of 14 · 9 min

Book contents

Section 4 of 14 · 9 min read

Integral Calculus and Differential Equations › Integration Techniques for FinanceOne section · Sections in this chapter4 / 14 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

The following examples use several integration techniques. They are useful when a model lacks a convenient antiderivative. We begin with substitutions and products before turning to numerical integration.

Integration by Substitution

Integration by substitution reverses the chain rule of differentiation, allowing us to simplify integrals by changing variables. The core insight is that a complex integrand might become simple under the right transformation. If g(t)g(t) is a differentiable function and ff is continuous, then:

∫f(g(t))⋅g′(t) dt=∫f(u) du\int f(g(t)) \cdot g'(t) \, dt = \int f(u) \, du

where u=g(t)u = g(t).

The power of substitution lies in recognizing when an integrand contains a function and its derivative: the signature of the chain rule applied in reverse. When we spot this pattern, we can simplify the integral by treating the inner function as a new variable.

Consider pricing a bond with continuous coupon payments where the coupon rate decays exponentially. This structure might arise when modeling a company whose cash flows are expected to decline over time. If the coupon rate at time tt is C(t)=C0e−αtC(t) = C_0 e^{-\alpha t} and the discount factor is D(t)=e−rtD(t) = e^{-rt}, we need to compute the present value of this decaying stream of payments:

PV=∫0TC0e−αt⋅e−rt dtPV = \int_0^T C_0 e^{-\alpha t} \cdot e^{-rt} \, dt

where:

  • C0C_0: initial coupon cash-flow rate at t=0t=0, in currency per year
  • α\alpha: decay rate of the coupon (how fast it decreases)
  • rr: risk-free discount rate
  • TT: maturity time

The present value of coupons from 00 to TT is:

PV=∫0TC0e−αt⋅e−rt dt=C0∫0Te−(r+α)t dtPV = \int_0^T C_0 e^{-\alpha t} \cdot e^{-rt} \, dt = C_0 \int_0^T e^{-(r+\alpha)t} \, dt

Here we used ea⋅eb=ea+be^a \cdot e^b=e^{a+b} to combine the exponentials. When r+α≠0r+\alpha\ne0, substitution with u=−(r+α)tu=-(r+\alpha)t gives the first branch below. At r+α=0r+\alpha=0, the integrand is the constant C0C_0:

PV={C0r+α(1−e−(r+α)T),r+α≠0,C0T,r+α=0.PV=\begin{cases}\dfrac{C_0}{r+\alpha}\left(1-e^{-(r+\alpha)T}\right),&r+\alpha\ne0,\\[6pt]C_0T,&r+\alpha=0.\end{cases}

For the usual nonnegative discount and decay rates, r+αr+\alpha combines the two forces that reduce future coupon value. For C0>0C_0>0, the finite perpetuity limit C0/(r+α)C_0/(r+\alpha) exists only when r+α>0r+\alpha>0. At equality the value grows linearly as C0TC_0T; when r+α<0r+\alpha<0, it grows exponentially rather than converging. A zero stream has value zero for every rate.

Integration by Parts

Integration by parts reverses the product rule, enabling us to integrate products of functions by transferring the derivative from one factor to another. This technique is especially valuable when one function becomes simpler upon differentiation while the other has a known antiderivative. For continuously differentiable functions u(t)u(t) and v(t)v(t):

∫u dv=uv−∫v du\int u \, dv = uv - \int v \, du

where:

  • uu: a function chosen to simplify when differentiated
  • vv: an antiderivative of the factor represented by dvdv, so dv=v′(t) dtdv=v'(t)\,dt
  • dvdv: the differential of vv
  • dudu: the differential of uu

The strategy is to choose uu and dvdv so that ∫v du\int v \, du is simpler than the original integral. A useful mnemonic for choosing uu is LIATE (Logarithmic, Inverse trigonometric, Algebraic, Trigonometric, Exponential), which suggests the order of preference for what to differentiate.

This technique is important when integrating products, especially in option pricing where payoffs multiply probability densities. When computing expected values, we often encounter integrals of the form ∫x⋅f(x) dx\int x \cdot f(x) \, dx, where f(x)f(x) is some probability density.

For an option-pricing application, let FF and pp be the CDF and density of a nonnegative terminal price STS_T. Provided the expectation is finite and (s−K)[1−F(s)]→0(s-K)[1-F(s)]\to0 as s→∞s\to\infty, integration by parts turns a call's expected payoff into a tail-probability integral. Choose

u=s−K,dv=p(s) ds,du=ds,v=F(s)−1.u=s-K,\qquad dv=p(s)\,ds,\qquad du=ds,\qquad v=F(s)-1.

Then the boundary term is explicit:

E[(ST−K)+]=∫K∞(s−K)p(s) ds=[(s−K)(F(s)−1)]K∞+∫K∞[1−F(s)] ds=∫K∞[1−F(s)] ds.\begin{aligned} E[(S_T-K)^+] &=\int_K^\infty (s-K)p(s)\,ds\\ &=\left[(s-K)(F(s)-1)\right]_K^\infty +\int_K^\infty [1-F(s)]\,ds\\ &=\int_K^\infty [1-F(s)]\,ds. \end{aligned}

Consider computing the expected payoff of a call option under a uniform distribution (a simplified model for illustration). If the stock price STS_T at expiration is uniformly distributed on [80,120][80, 120] with strike K=100K = 100, the expected payoff is:

E[max⁡(ST−K,0)]=∫100120(ST−100)⋅140 dSTE[\max(S_T - K, 0)] = \int_{100}^{120} (S_T - 100) \cdot \frac{1}{40} \, dS_T

Direct integration gives the same value as integrating the uniform survival function (120−s)/40(120-s)/40 from 100 to 120:

=140[(ST−100)22]100120=140⋅4002=5= \frac{1}{40} \left[ \frac{(S_T - 100)^2}{2} \right]_{100}^{120} = \frac{1}{40} \cdot \frac{400}{2} = 5
In[9]:
Code
from scipy import integrate


# Expected call option payoff under uniform distribution
def call_payoff_density(s, strike=100, lower=80, upper=120):
    """Payoff times probability density for uniform distribution."""
    if not np.isfinite([lower, upper, strike]).all() or upper <= lower:
        raise ValueError("Require finite bounds and strike, with upper > lower")
    if s < lower or s < strike or s > upper:
        return 0
    return (s - strike) * (1 / (upper - lower))


expected_payoff, _ = integrate.quad(call_payoff_density, 80, 120)
Out[10]:
Console
Expected call option payoff: $5.00
Out[11]:
Visualization
Plot of the probability-weighted call payoff, shaded between stock prices 100 and 120; the shaded area integrates to an expected payoff of 5 dollars.
Expected call option payoff under a uniform distribution. The shaded area represents the probability-weighted payoff that integrates to the expected value of $5.

The Gaussian Integral

The Gaussian integral is fundamental to quantitative finance because normal distributions appear throughout risk modeling and option pricing. Some mean-variance analyses assume normal arithmetic returns; the mean-variance criterion itself uses means and covariances rather than requiring normality. Under Black-Scholes, continuously compounded (log) returns are normal and terminal prices are lognormal; other option models need not use normal returns. In each normal-model setting, we encounter integrals involving the exponential of a quadratic. The basic Gaussian integral states:

∫−∞∞e−x2 dx=π\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}

For this particular unnormalized Gaussian, the area is π\sqrt{\pi}; changing its height or width changes that area. One derivation squares the integral and integrates e−(x2+y2)e^{-(x^2+y^2)} over the plane. Polar coordinates give 2π∫0∞ρe−ρ2 dρ=π2\pi\int_0^\infty \rho e^{-\rho^2}\,d\rho=\pi, so the positive original integral is π\sqrt{\pi}.

More generally, for the standard normal density:

∫−∞∞12πe−x2/2 dx=1\int_{-\infty}^{\infty} \frac{1}{\sqrt{2\pi}} e^{-x^2/2} \, dx = 1

This integral equals 1 because it represents the total probability under the standard normal density. A probability density, when one exists, integrates to 1. Discrete probability masses are normalized by summation; more generally, a probability measure assigns total mass 1 to its sample space. The factor 1/2π1/\sqrt{2\pi} is precisely the normalization constant that ensures this property.

The cumulative distribution function of the standard normal:

Φ(z)=∫−∞z12πe−t2/2 dt\Phi(z) = \int_{-\infty}^{z} \frac{1}{\sqrt{2\pi}} e^{-t^2/2} \, dt

where:

  • Φ(z)\Phi(z): cumulative distribution function (CDF) of the standard normal distribution
  • zz: upper limit of integration, representing the number of standard deviations
  • tt: dummy variable of integration
  • 12πe−t2/2\frac{1}{\sqrt{2\pi}} e^{-t^2/2}: the standard normal probability density function

has no expression in elementary functions. It can be written with the special function erf⁡\operatorname{erf} as Φ(z)=12[1+erf⁡(z/2)]\Phi(z)=\tfrac12[1+\operatorname{erf}(z/\sqrt2)] and is evaluated numerically in practice. It appears directly in the Black-Scholes formula for option pricing, where call and put prices are expressed in terms of Φ(d1)\Phi(d_1) and Φ(d2)\Phi(d_2).

Out[12]:
Visualization
Standard normal PDF with shaded tail regions.
Standard normal PDF showing key probability thresholds used in risk management.
S-shaped CDF curve.
Standard normal CDF showing cumulative probabilities.
Out[14]:
Console
Standard Normal CDF Values:
------------------------------
  Φ(-2) = 0.022750
  Φ(-1) = 0.158655
  Φ( 0) = 0.500000
  Φ( 1) = 0.841345
  Φ( 2) = 0.977250

The value Φ(−2)≈0.023\Phi(-2) \approx 0.023 means that a standard normal variable falls below −2-2 with probability about 2.3%. Under a model in which a return is normal and has been standardized by subtracting its mean and dividing by its standard deviation, this is the model probability of a return more than two standard deviations below its mean.