Calculus Primer

Stochastic Foundations for Finance

Lorenzo Naranjo

Fall 2024

Derivatives

The Derivative of a Function

  • The derivative of a function f(x) at a point x measures the change in the function for a very small change in the underlying variable.

Definition 1 The derivative of f(x) at the point x is denoted by f'(x) and is defined as: \begin{aligned} f'(x) = \lim_{h \rightarrow 0} \frac{f(x + h) - f(x)}{h}. \end{aligned}

Example 1 (Derivative of a Linear Function) Let’s first apply Definition 1 to compute the derivative of f(x) = x. Intuitively the rate of change of x with respect to x is one-to-one, which suggest that this derivative should be 1. To see this formally, note that: \begin{aligned} \frac{(x + h) - x}{h} = 1, \end{aligned} which shows that f'(x) = 1.

Example 2 (Derivative of a Square Function) We can apply Definition 1 to compute the derivative of f(x) = x^{2}. We first note that: \begin{aligned} \frac{(x + h)^{2} - x^{2}}{h} = \frac{x^{2} + 2 xh + h^{2} - x^{2}}{h} = 2x + h, \end{aligned} which allows us to compute: \begin{aligned} f'(x) = \lim_{h \rightarrow 0} 2x + h = 2x. \end{aligned}

Useful Differentiation Formulas

  • In the following expressions, f and g are two differentiable functions.

Name Formula
Sum Rule (f + g)' = f' + g'
Product Rule (f g)' = f' g + f g'
Inverse Rule (f \neq 0) (1/f)' = - 1/(f')^{2}
Chain Rule (g \circ f)' = (g' \circ f) f'

Example 3 (Scalar Multiplication) Consider an arbitrary differentiable function f and let g = c, where c \in \mathbb{R} is a constant. Then, g' = 0 and the product rule implies that: \begin{aligned} (f g)' = f' g + f g' = c f'. \end{aligned} Therefore, (c f)' = c f'.

Example 4 (Derivative of a Power Function) We can use the product rule to compute the derivative of x^{3} as follows: \begin{aligned} (x^{3})' & = (x x^{2})' \\ & = x^{2} + x (2 x) \\ & = 3 x^{2}. \end{aligned}

Example 5 (Derivative of the Exponential Function) Let f(x) = e^{x} and note that: \frac{e^{x + h} - e^{x}}{h} = e^{x} \left( \frac{e^{h} - 1}{h} \right). We can use the Taylor expansion of the exponential function to write: \begin{aligned} \frac{e^{h} - 1}{h} & = \frac{1}{h} \left( 1 + \frac{h}{1!} + \frac{h^{2}}{2!} + \frac{h^{3}}{3!} + ... - 1 \right) \\ & = 1 + \frac{h}{2!} + \frac{h^{2}}{3!} + \frac{h^{3}}{4!} + ..., \end{aligned} which shows that: f'(x) = e^{x} \lim_{h \rightarrow 0} \frac{e^{h} - 1}{h} = e^{x}.

Example 6 (Derivative of the Logarithm Function) Define f(x) = \exp(\ln(x)) = x. The chain rule then implies that: \begin{aligned} f'(x) & = \ln'(x) \exp(\ln(x)) \\ & = \ln'(x) x \\ & = 1. \end{aligned} Therefore, \ln'(x) = 1 / x.

Example 7 Consider a power function such that f(x) = x^{\alpha} where x > 0 and \alpha \in \mathbb{R}. Since f(x) = e^{\alpha \ln(x)}, the chain rule allows us to compute: \begin{aligned} f'(x) = \alpha \ln'(x) e^{\alpha \ln(x)} = \alpha x^{-1} x^{\alpha} = \alpha x^{\alpha - 1}. \end{aligned}

List of Common Derivatives

  • Below is a list of common derivatives that we will use in this class.

Function Derivative
e^{x} e^{x}
\ln(x) x^{-1}
x^{\alpha} \alpha x^{\alpha - 1}

Differentials

The Tangent Line

  • One of the most common uses of derivatives in finance is to approximate the change of a function with respect to a financial quantity such as a stock price, interest rate, volatility, among others.
  • In order to achieve this, we need to introduce the notion of differential.

Definition 2 The differential of y = f(x) at the point x is denoted by dy and is defined as: dy = f'(x) dx, where dx \in \mathbb{R} is an arbitrary quantity.

Relation with the Derivative

  • The differential of a function y = f(x) at a point x describes the linear relationship between dx and dy.
    • It is for this reason that it is common to use \frac{dy}{dx} and f'(x) interchangeably.
  • For example, we can write: \frac{d \ln(x)}{dx} = \frac{1}{x}, to denote the derivative of \ln(x).

Graphical Representation of a Function Differentials

The figure shows the graphical representation of the differential of a function. The differential of y over the differential of x then represents the slope coefficient of the tangency line of the function y = f(x) at the point x.

Some Interesting Properties

  • It is interesting to see how good notation can make some results easier to understand.
  • Let z = f(x) and y = (g \circ f)(x) = g(z). The chain rule can then be stated as: \frac{dy}{dx} = \frac{dy}{dz} \frac{dz}{dx}. \tag{1}
  • Another useful application of differentials is to use them to derive the derivative of a function inverse.
  • If y = f(x) so that x = f^{-1}(y), we then have: \frac{dy}{dx} = \frac{1}{\frac{dx}{dy}}. \tag{2}

First Order Approximation

  • It is important to note that in Definition 2, the quantity dx need not be small but can be arbitrarily large.
  • However, when \Delta x = dx is a small quantity, then we have that \Delta y = f(x + \Delta x) - f(x) \approx dy.

Property 1 (First Order Approximation) Take y = f(x) and define \Delta y = f(x + \Delta x) - f(x) for a change \Delta x in x. If \Delta x is small, then we have that: \Delta y \approx f'(x) \Delta x

Second Order Approximation

  • It is possible to improve the first order approximation by using the second derivative of the function.

Property 2 (Second Order Approximation) Take y = f(x) and define \Delta y = f(x + \Delta x) - f(x) for a change \Delta x in x. If \Delta x is small, then we have that: \Delta y = f(x + \Delta x) - f(x) \approx f'(x) \Delta x + \frac{1}{2} f''(x) (\Delta x)^{2}

Integrals

The Integral as an Approximation

  • We saw that derivatives describe changes of a function.
  • Integrals are about just the opposite, aggregating the changes.
  • Consider an interval [a,b] and consider the points \{x_{i}\}_{i=0}^{n} such that a = x_{0} < x_{1} < x_{2} < \cdots < x_{n-1} < x_{n} = b.
  • In each sub-interval (x_{i-1}, x_{i}) pick a point \xi_{i}, where i = 1, 2, \cdots, n and consider the sum: f(\xi_{1})(x_{1}-x_{0}) + f(\xi_{2})(x_{2}-x_{1}) + \cdots + f(\xi_{n})(x_{n}-x_{n-1}) = \sum_{i=1}^{n} f(\xi_{i}) \Delta x_{i}, where \Delta x_{i} = x_{i} - x_{i-1}.

Defining the Integral Using Rectangles

The Riemann Integral

  • The Riemann integral of a function f(x) from a to b is then defined as: \int_{a}^{b} f(x) \, dx = \lim_{n \rightarrow \infty} \sum_{i=0}^{n} f(\xi_{i}) \Delta x_{i}, where \Delta x_{i} \rightarrow 0 as n \rightarrow \infty and whenever the limit does not depend on how we make the sub-divisions.
  • The integral of f over [a,b] then represents the area under the curve y = f(x) from the point x = a to the point x = b.

The Integral is the Area Under the Curve

Property 3 (Important Properties of the Definite Integral) If f(x) and g(x) are two integrable functions over [a,b], then

  1. \displaystyle \int_{a}^{b} f(x) + g(x) \, dx = \int_{a}^{b} f(x) \, dx + \int_{a}^{b} g(x) \, dx.
  2. \displaystyle \int_{a}^{b} A f(x) \, dx = A \int_{a}^{b} f(x) \, dx where A \in \mathbb{R} is a constant.
  3. \displaystyle \int_{a}^{b} f(x) \, dx = \int_{a}^{c} f(x) \, dx + \int_{c}^{b} f(x) \, dx as long as f(x) is integrable in [a,c] and [c,b].
  4. \displaystyle \int_{a}^{b} f(x) \, dx = - \int_{b}^{a} f(x) \, dx.
  5. \displaystyle \int_{a}^{a} f(x) \, dx = 0.

The Antiderivative of a Function


Definition 3 Any function F such that F'(x) = f(x) is called the antiderivative or indefinite integral of f.

  • Below is a list of common antiderivatives that we will use in this class.

Function Antiderivative
e^{x} e^{x}
1/x \ln(x)
x^{\alpha} \dfrac{x^{\alpha + 1}}{\alpha + 1}

The Fundamental Theorem of Calculus

Theorem 1 Let f be a continuous function on [a,b]. Let F be a function defined for all x \in [a,b] by: F(x) = \int_{a}^{x} f(t) \, dt. Then F is uniformly continuous on [a,b], differentiable on (a,b), and F'(x) = f(x) for all x \in (a,b).

Theorem 2 Let f be a function defined on [a,b] and F an antiderivative of f in (a,b). If f is Riemann integrable on [a,b] then \int_{a}^{b} f(x) \, dx = F(b) - F(a).

A Note on the Theorems

  • Theorem 1 implies that F(a) = 0 and F(b) = \int_{a}^{b} f(t) \, dt, so that \int_{a}^{x} f(t) \, dt = F(b) - F(a).
  • However, Theorem 2 does not assume that f is continuous.
  • Also, note that Theorem 2 can be interpreted as an application of the differential of F: \int_{a}^{b} f(x) \, dx = \int_{a}^{b} F'(x) \, dx = \int_{a}^{b} dF(x) = F(b) - F(a).

Example 8 (Present Value of a Continuous-Time Annuity) The most common use of integrals in finance is to compute the present value of continuous cash flows. At each time t \in [0, T], a security pays a cash flow of c \, dt. If the interest rate is r expressed with continuous compounding, the present value of these cash flows is: V = \int_{0}^{T} c e^{-r t} \, dt = c \left.\left( - \frac{e^{-r t}}{r} \right) \right|_{0}^{T} = \frac{c}{r} \left( 1 - e^{-r T} \right). This is the continuous-time analog of the present value of an annuity.

Improper Integrals

  • It is common in mathematics, statistics and finance to consider integrals over (-\infty, b), (a, \infty), or (-\infty, \infty).

Example 9 Consider the continuous annuity presented in Example 8 when T \rightarrow \infty. This is what we called a perpetuity, that in this case pays at each time t a cashflow of c \, dt. The value of this instrument is then: V = \int_{0}^{\infty} c e^{-r t} \, dt = \lim_{T \rightarrow \infty} \int_{0}^{T} c e^{-r t} \, dt = \lim_{T \rightarrow \infty} \frac{c}{r} \left( 1 - e^{-r T} \right) = \frac{c}{r}.