Skip to main content

4  Integration and Numerical Approximation

This section covers integration techniques for continuous-time and probabilistic settings, alongside numerical approximation methods used when closed-form integration is unavailable.

4.1 Continuous Time Integration

4.1.1 Infinite compounding

Suppose an account pays nominal interest rate \(r\) per year, compounded \(n\) times per year. After \(t\) years, one dollar grows to

\[ \left(1 + \frac{r}{n}\right)^{nt}. \]

For any fixed rate \(r\), continuous compounding is the limit as the number of compounding periods goes to infinity:

\[ \lim_{n \to \infty} \left(1 + \frac{r}{n}\right)^{nt} = e^{rt}. \]

To see this, set \(h=r/n\), so \(h\to 0\) as \(n\to\infty\) and

\[ \left(1 + \frac{r}{n}\right)^{nt} = \left[(1+h)^{1/h}\right]^{rt} \to e^{rt}, \]

using the standard limit \(\lim_{u\to\infty}(1+1/u)^u = e\). Thus continuous compounding replaces the discrete growth factor \((1+r/n)^{nt}\) by the exponential \(e^{rt}\).

(If \(r=0\), both sides equal \(1\), so the formula still holds.)

4.1.2 Future value

If a principal \(PV\) is invested at continuous rate \(r\) for time \(t\), its future value is

\[ FV = e^{rt}\, PV. \]

More generally, suppose deposits arrive as a continuous flow at rate \(s\) (dollars per unit time). A small deposit \(s\,dt\) made at time \(t\) grows until terminal date \(T\) by the factor \(e^{r(T-t)}\). The accumulated balance at \(T\) is therefore the integral

\[ A(T) = \int_0^{T} s\, e^{r(T-t)}\, dt = s\, e^{rT} \int_0^{T} e^{-rt}\, dt = s\, e^{rT} \left[\frac{1 - e^{-rT}}{r}\right] = \frac{s}{r}\left(e^{rT} - 1\right), \]

for \(r \neq 0\). When \(r=0\), the same integral collapses to \(A(T) = sT\).

4.1.3 Present value

Discounting is the inverse of compounding. A payment of \(FV\) due at time \(t\) has present value

\[ PV = e^{-rt}\, FV. \]

If consumption or payments arrive as a continuous flow at rate \(c\) from date \(0\) to date \(T\), the present value of the stream is

\[ PV = \int_0^{T} c\, e^{-rt}\, dt = c \left[\frac{1 - e^{-rT}}{r}\right], \]

for \(r \neq 0\). When \(r=0\), present value equals total undiscounted consumption \(cT\).

4.1.4 Money at bank to support \(N\) withdrawals

Consider a Baumol–Tobin-style cash inventory problem in continuous time. An individual withdraws cash from the bank to put in pocket at \(N\) dates, with the same \(\tau\) distance between each consecutive date. Between withdrawals, cash in pocket supports flow consumption \(c\). Money in pocket has a leakage interest rate of \(r^c\), and money at the bank has savings interest rate \(r^s\).

The question is: how much money must we have at the bank at time \(t=0\) to support consumption between \(t=0\) and \(t=\tau \cdot N\), assuming that the first withdrawal happens at time \(t=0\)?

We compute this in the following way. At the moment of the last withdrawal, right before withdrawing, how much deposits must we have at the bank? We can use the formula we derived in the previous section. The level of deposits at the bank at time \(\tau \cdot (N-1)\) needed to finance consumption from \(\tau \cdot (N-1)\) to \(\tau\cdot N\) is:

\[ c \left[\frac{1 - e^{-r^c\tau}}{r^c}\right] \]

When \(r^c=0\), this amount is the continuous limit \(c\tau\).

Working backwards to the moment of the \((N-1)\)st withdrawal, how much money must be at the bank to support both the \((N-1)\)st happening immediately and the \(N\)th withdrawal happening next? The level of deposits at the bank at time \(\tau \cdot (N-2)\) needed to finance consumption from \(\tau \cdot (N-2)\) to \(\tau\cdot N\):

\[ c \left[\frac{1 - e^{-r^c\tau}}{r^c}\right]\cdot \left[ e^{-r^s \tau} + 1 \right] \]

The \(e^{-r^s \tau}\) term discounts the money needed for the \(N\)th withdrawal, and the \(+1\) is for the money needed for the \((N-1)\)st withdrawal. Going back further to \(N-2\), the level of deposits at the bank at time \(\tau \cdot (N-3)\) needed to finance consumption from \(\tau \cdot (N-3)\) to \(\tau\cdot N\):

\[ c \left[\frac{1 - e^{-r^c\tau}}{r^c}\right]\cdot \left[ e^{- 2\cdot r^s \tau} + e^{- r^s \tau} + 1 \right] \]

The \(e^{-2\cdot r^s \tau}\) term discounts the money needed for the \(N\)th withdrawal, the \(e^{-r^s \tau}\) term discounts the money needed for the \(N-1\)th withdrawal, and the \(+1\) is for the money needed for the \(N-2\)th withdrawal. Proceeding through this, the level of deposits at the bank at time \(t=0\) needed to finance consumption from \(t=0\) to \(\tau\cdot N\):

\[ c \left[\frac{1 - e^{-r^c\tau}}{r^c}\right]\cdot \sum_{n=0}^{N-1} e^{- n \cdot r^s \tau} \]

4.2 Integration techniques

How do integration by parts and integration by substitution work? Integration by parts is linked to the derivative product rule, and integration by substitution is linked to the derivative chain rule.

4.2.1 Integration by parts from the product rule

Starting from the product rule, we have:

\[ \frac{d}{dx}\big(u(x)v(x)\big) = u'(x)v(x) + u(x)v'(x). \]

Moving terms around, we have:

\[ u(x)v'(x) = \frac{d}{dx}\big(u(x)v(x)\big) - u'(x)v(x). \]

Now integrate both sides with respect to \(x\):

\[ \int u(x)v'(x)\,dx = \int \frac{d}{dx}\big(u(x)v(x)\big)\,dx - \int u'(x)v(x)\,dx. \]

Use the Fundamental Theorem of Calculus so that the middle term is left only with \(u(x)v(x)\). And we know that \(v'(x) = \frac{dv(x)}{dx}\), so \(v'(x)dx = dv\). Similarly, \(u'(x)dx = du\). Given these, we end up with the formula for integration by parts:

\[ \int u\,dv = uv - \int v\,du\,. \]

4.2.2 Integration by parts example

Suppose \(Z\) is a nonnegative, continuously distributed random variable with density \(f\) and finite mean. We are interested in:

\[ \int_0^{\infty} z f(z)\,dz \]

We can rewrite the expression above using integration by parts. Choose \(u=z\), then:

  • with \(u = z\)
  • then \(du = dz\)
  • and \(dv = f(z)dz\)
  • therefore, integrating both sides of \(dv = f(z)dz\) over \(z\), we have \(v(z)= F(z) + C\), where \(C\) is some constant. If \(C = -1\), we have \(v(z) = -(1-F(z))\), which turns out to be easier to work with.

Given these, we apply integration by parts, and arrive at the following formula:

\[ \int_0^{\infty} z f(z)\,dz = \Big[-z(1-F(z))\Big]_0^{\infty} + \int_0^{\infty}(1-F(z))\,dz, \]

Since \(E[Z]<\infty\), the boundary term vanishes as the upper limit tends to infinity, giving the familiar tail-integral identity \(E[Z]=\int_0^\infty (1-F(z))\,dz\). The expression above will be useful for a later exercise.

4.2.3 Integration by Substitution from the chain rule

By reversing the chain rule, we arrive at the integration by substitution formula. From the chain rule, we have:

\[ \frac{d}{dx}H(\phi(x)) = H'(\phi(x))\phi'(x). \]

Now rename \(H'(u)\) as \(g(u)\), (we do this to end up with the standard substitution form later), then we have:

\[ \frac{d}{dx}H(\phi(x)) = g(\phi(x))\phi'(x). \]

Integrate both sides with respect to \(x\):

\[ \int g(\phi(x))\phi'(x)\,dx = H(\phi(x)) + C. \]

Since \(H'(u)=g(u)\), this is equivalently written as

\[ \int g(\phi(x))\phi'(x)\,dx = \int g(u)\,du, \quad \text{with } u=\phi(x), \]

up to an additive constant.

4.2.4 Integration by Substitution example

A distribution-based example for integration by substitution. Assume the CDF \(F\) is continuously differentiable and strictly increasing on its support, with positive density \(f\), and write \(q_\tau=F^{-1}(\tau)\). Then \(d\tau=f(x)\,dx\) under the change of variables below.

\[ \int_0^1 \frac{F_2(q_\tau)-F_1(q_\tau)}{f(q_\tau)}\,d\tau. \]

By definition of quantile, \(x=q_\tau\) means \(\tau=F(x)\), therefore, differentiating both sides, we have:

\[ \frac{d\tau}{dx}=\frac{dF(x)}{dx}=f(x). \]

Therefore, we have:

\[ d\tau=f(x)dx. \]

Now we substitute out the integration over \(\tau\) by integration over \(x\). Rather than evaluating the CDF and pdf at \(q_{\tau}\), which means looking at the quantile value corresponding to \(\tau\), we move away from the \(\tau\) and directly looking at the \(x=q_{\tau}\).

The integral becomes:

\[ \int_0^1 \frac{F_2(q_\tau)-F_1(q_\tau)}{f(q_\tau)}\,d\tau = \int \frac{F_2(x)-F_1(x)}{f(x)} f(x)\,dx = \int \big(F_2(x)-F_1(x)\big)\,dx. \]

Note that the bounds of the integral were previously \(0\) to \(1\), but after the transformation they become bounds over the support of \(x\).

4.3 Integrating over the standard normal distribution

4.3.1 Standard normal interval expectation integration by substitution

Consider the truncated (finite-interval) expectation integral against the standard normal density,

\[ \int_{a}^{b} x \cdot \phi(x)\, dx, \qquad \phi(x) = \frac{1}{\sqrt{2\pi}} e^{-x^2/2}. \]

Unlike the full-line integral \(\int_{-\infty}^{\infty} x\phi(x)\,dx\), which is zero by oddness, a finite interval \([a,b]\) need not be symmetric, so the integral is generally nonzero. We evaluate it by substitution.

Let \(u = x^2/2\). Then \(du = x\, dx\), and

\[ \int x \cdot \phi(x)\, dx = \int \frac{1}{\sqrt{2\pi}} e^{-x^2/2}\, x\, dx = \frac{1}{\sqrt{2\pi}} \int e^{-u}\, du = -\frac{1}{\sqrt{2\pi}} e^{-u} + C = -\phi(x) + C. \]

Therefore, on a definite interval,

\[ \int_{a}^{b} x \cdot \phi(x)\, dx = \Bigl[-\phi(x)\Bigr]_{a}^{b} = -\phi(b) + \phi(a) = \phi(a) - \phi(b). \]

4.3.2 Standard normal interval expectation integration by parts

Now compute the same integral by parts, without using the identity

\[ \phi'(x)=-x\phi(x) \]

inside this section.

\[ I(a,b):=\int_a^b x\phi(x)\,dx \]

Choose

\[ u=1,\qquad dv=x\phi(x)\,dx. \]

Then

\[ du=0,\qquad v=\int x\phi(x)\,dx. \]

To find \(v\) directly (within this method), compute:

\[ v=\int x\phi(x)\,dx =\frac{1}{\sqrt{2\pi}}\int x e^{-x^2/2}\,dx. \]

Let \(t=x^2/2\), so \(dt=x\,dx\). Then

\[ v=\frac{1}{\sqrt{2\pi}}\int e^{-t}\,dt =-\frac{1}{\sqrt{2\pi}}e^{-t}+C =-\phi(x)+C. \]

We can take \(v=-\phi(x)\) (constants do not affect integration by parts).

Apply integration by parts:

\[ \int_a^b u\,dv=\big[u v\big]_a^b-\int_a^b v\,du. \]

Therefore,

\[ I(a,b)=\Big[1\cdot(-\phi(x))\Big]_a^b-\int_a^b (-\phi(x))\cdot 0\,dx =\Big[-\phi(x)\Big]_a^b =\phi(a)-\phi(b). \]

This matches the substitution result.

4.3.3 Standard normal interval expectation using the normal-pdf identity

Now use the identity specific to the standard normal density:

\[ \phi'(x)=\frac{d}{dx}\left(\frac{1}{\sqrt{2\pi}}e^{-x^2/2}\right)=-x\phi(x). \]

Then

\[ I(a,b)=\int_a^b x\phi(x)\,dx=-\int_a^b \phi'(x)\,dx. \]

Evaluate directly by the Fundamental Theorem of Calculus:

\[ I(a,b)=-\big[\phi(x)\big]_a^b=\phi(a)-\phi(b). \]

This is usually the fastest method once the normal-pdf identity is known.

4.4 Numerical Approximation and Integration

4.4.1 Expectation of the standard normal

The pdf of a standard normal distribution is:

\[ \phi(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac{x^2}{2}} \]

The expected value of a standard normal random variable is:

\[ \int_{-\infty}^{\infty} x \cdot \phi(x) \, dx \]

We approximate this integral using numerical integration, specifically Gauss–Hermite quadrature, and also show that the exact value is zero because the integrand is an odd function over a symmetric interval.

4.4.2 Integration by point-wise simulation

Perhaps the most reliable method to integrate is to simulate. Integration is just a weighted average, with weights determined by area below the density curve in the case of a continuous random variable. If we draw randomly many times from the correct distribution, and then compute the relevant average statistics, we have approximated the integral.

How do we do this with the normal random variable? The value of \(x\) can be drawn from \(-\infty\) up to \(\infty\), how can we randomly draw? We start from the uniform:

  1. Draw randomly from the uniform distribution between 0 and 1, think about this as randomly drawing from quantile indexes.
  2. Map from uniform draws to random draws from the normal distribution, by inverting the uniform randomly drawn values via the inverse cumulative distribution function (CDF) of the normal distribution.
  3. Compute the average of the function values at these random draws to approximate the integral. The statistic for the expected value of the normal random variable is just the value of the random normal draw themselves, which we will average over.

In turns out that in many settings, we can draw randomly from the distribution we are interested in using the appropriate CDF inversion, note that the range of the CDF function is always between 0 and 1.

Generally integration by numerical simulation is reliable and helps us to integrate complex distributions with arbitrary shapes. But this is potentially expensive, requiring a large number of random draws and evaluation to achieve high accuracy.

4.4.3 Integration by polynomial approximation

Archimedes tells us that we can approximate the area of a circle by summing up the areas of many triangles. Riemann tells us that we can approximate the area below any curve as the sum of rectangles.

So a branch of calculus integrates by finding approximate sub-geometries whose area we know how to compute, and summing the areas of these sub-geometries to approximate the overall integral of interest.

Integration by Newton-Cotes quadrature follow these methods, except that they are not about the adding up of triangles and rectangles, but approximating unknown area with areas we can compute exactly when the curve follows a polynomial. Why polynomial? Because we know that \(\frac{d A X^{\alpha}}{dx} = \alpha A X^{\alpha-1}\), so we can integrate polynomials exactly. Remember that polynomials are linearly additive, a 3rd order polynomial is:

\[ y(x) \approx \widehat{y}(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3\,. \]

The integral of the above function between \(x=1\) and \(x=2\) is:

\[ \int_1^2 (a_0 + a_1 x + a_2 x^2 + a_3 x^3) \, dx = a_0 + \frac{3}{2} a_1 + \frac{7}{3} a_2 + \frac{15}{4} a_3 \]

If we have four points of \(x\) values between \(x=1\) and \(x=2\), we can evaluate the corresponding \(y\) values for \(y(x)\), and then pin down the coefficients \(a_0, a_1, a_2, a_3\). Now we have a polynomial, \(\widehat{y}(x)\), that exactly fits our four points, and that provides generally a good approximation of the actual curve \(f(x)\). So it turns out that polynomials are as convenient to deal with as rectangles and triangles in terms of finding areas.

Given \(N\) distinct nodes and the function values at those nodes, there is a unique interpolating polynomial of degree at most \(N-1\). Integrating that polynomial gives a quadrature approximation to the integral of the original function.

Gauss-Hermite quadrature is a Gaussian quadrature rule designed for integrals with a Gaussian weight, so its nodes are not equally spaced. With \(N\) nodes, the rule integrates exactly every polynomial of degree at most \(2N-1\) when the integrand is multiplied by the corresponding weight. This exactness is a property of the quadrature rule; it does not mean that the \(N\) sampled points determine a polynomial of degree \(2N-1\). For the standard normal expectation, a change of variables maps the normal density to the physicists’ Hermite weight, and the resulting nodes and weights provide an efficient approximation.