Mathematical Background
Financial Risk Management Topic 1: Mathematical Background
Carol Alexander
Professor of Finance University of Sussex Business School
Mathematical Background
Outline
To ensure that all students have the necessary mathematical background we cover the parts of elementary
1. Algebra
2. Statistics
3. Regression
4. Calculus
which are needed just for this course – no more, no less.
Very elementary mathematics will already be known, such as drawing graphs, dealing with numbers and differentiating functions.
Many of you will already be familiar with the material we cover this week, but it is still good to have a refresher ... and it also helps to have a one-stop set of lecture notes to refer back to later on.
Mathematical Background
Linear Algebra
1. Linear Algebra
Mathematical Background
Linear Algebra
Definition of a Vector
▶ Vectors are columns or rows of data (in our case, data are real numbers) usually denoted by lower-case bold type letters, x, y, a, b etc.
▶ A column vector has n rows and 1 column, i.e. its dimension is
n × 1. A row vector has n columns and 1 row, i.e. its dimension is 1×n
1 ▶ Anexampleofa4×1columnvectoris: x= 2
▶ A 1 × 1 vector is called a scalar and it is not written in bold. For our purposes a scalar is just a number
0 −1
Mathematical Background
Linear Algebra
Definition of a Matrix
▶ A matrix is a rectangular array of numbers. It is denoted by a bold capital letter, such as X, Y, A or B
▶ Its dimension (also known as its order) is the number of rows and the number of columns. This is written as r × c.
?251?
▶ For example, 0 6 4 is a 2×3 matrix
▶ The individual cells (or elements) in a matrix are identified by their position in the row and column
▶ In general notation, the element at the junction of the ith row and jth column of matrix Y is written yij
? 1 5 −1 3 ?
▶ SoifA= 2 1 4 6 thena12 =5,forexample.
Mathematical Background
Linear Algebra
Transpose of a Matrix
The matrix produced by swapping the rows and columns of a given matrix is called the transpose of that matrix
Transpose is denoted by the T superscript or a ‘prime’ symbol ′ Examples
3 2
? 3 12 9 29 ?′ 12 18 =
218461 94
The transpose of a column vector is a row vector:
2 ′
8=?2 8 1? 1
Mathematical Background
Linear Algebra
Matrix Addition and Multiplication
▶ Matrices can be added and subtracted only if each matrix has the same dimension
▶ Matrices can be multiplied only if their dimensions are compatible i.e. the number of columns in the first equals the number of rows in the second:
If A has order r×c and B has order m×n then AB only exists if c = m; then AB has order r × n
Mathematical Background
Linear Algebra
Adding and Scalar Multiplication
▶ Addition and Subtraction:
X+Y = (xij +yij) and X−Y = (xij −yij)
Example
?3 4 2??2 −2 3? ?(3+2) (4−2) (2+3)? ?5 2 5? 0 6 5 + 5 5 1 = (0+5) (6+5) (5+1) = 5 11 6
▶ Scalar Multiplication: For any number (i.e. scalar) c cX = (cxij)
Example
?8 6? ?8 6? ?16 12? X= 3 2 ⇒2X=2 3 2 = 6 4
Mathematical Background
Linear Algebra
Dot Product – Excel Function SUMPRODUCT
▶ The dot product x.y only exists for two vectors x and y of the same dimension
▶ It works by multiplying elements in the same position then adding. For instance:
12
2 . 3 =2+6+0−5=3
0 7 −1 5
▶ The result would be the same if the two vectors were both 1 × 4 row vectors
Mathematical Background
Linear Algebra
Vector Multiplication – Excel Function SUMPRODUCT
▶ Alternatively, the same result as the dot product applies if the first vector is a 1×4 row and the second is a 4×1 column vector – but now we don’t put the ‘dot’ between them.
▶ Thus, for instance:
12 1′2 2
2 .3= 2 3=(120−1)3=3 0 7 0 7 7
−1 5 −1 5 5
Mathematical Background
Linear Algebra
Matrix Multiplication – Excel Function MMULT
▶ The product of two matrices requires vector multiplication for each cell in the matrix product
▶ The ijth relement the product AB is found by multiplying the ith rowofAbythejth columnofB
Example
?621?2840 ?19 62 31 6? 8 9 4 3 4 2 3= 47 124 62 27
▶ Forinstance: 124=8×8+9×4+4×6
▶ Note that AB ̸= BA except for some special matrices
Mathematical Background
Linear Algebra
Matrix Inverse – Excel Function MINVERSE
▶ Matrices cannot be divided but some matrices have an inverse — this is not denoted 1/A, but by A−1. Thus, we may be able to write AB−1 or B−1A (if the dimensions are compatible, and if B−1 exists) but we may never write A/B
▶ The inverse matrix only exists if the matrix is square, but even some square matrices don’t have an inverse
▶ If the inverse of an n × n matrix A exists then AA−1=A−1A=I where I is the identity matrix which has 1’s along the diagonal and zeros elsewhere
▶ NotethatIX=XI=XforanymatrixX
Mathematical Background
Linear Algebra
Matrix Form of Systems of Linear Equations
A system of n linear in m unknowns may be written as Ax = b
where A is an n × m coefficient matrix; x = (x1, x2, ...., xm)′ is an m×1vectorofunknowns;andb=(b1,b2,....,bn)′ isann×1vectorof known values.
For example, in the system:
x1 + 2x2 − x3 4x1 +3x2 +3x3 2x1 +x2 +2x3 +5
1 2 −1 0 wehaveA= 4 3 3 andb= 4 .
212 −5
= 0 =4 =0
Mathematical Background
Linear Algebra
Solution of Linear Equations using Matrix Inverse
If n = m and the inverse of the coefficient matrix, i.e. A−1 exists (it does not always exist!) then the system Ax = b has the solution
x = A−1b.
For the example, using the Excel function MINVERSE, we have :
3 −5 9 A−1 = −2 4 −7
−2 3 −5
Hence, using the Excel function MMULT we can find the solution:
x1 3 −5 9 0 −65 x=x2 =−2 4 −7 4 = 51
x3 −23−5−537
Mathematical Background
Linear Algebra
Definition of Quadratic Form
▶ Let A be a given square matrix of dimension n (i.e. A is n × n) and let x be any n×1 vector
▶ Then x′Ax is called a quadratic form ?12? ′
▶ Forinstance,ifA= 3 −1 andx=(x,y) then x′Ax = x2 + 5xy − y2
▶ So if, for instance, x = 1 and y = 2 then the value of the quadratic form is 1 + 10 − 4 = 7
▶ A matrix A is positive definite if (and only if) all quadratic forms are positive, for any (non-zero) value of x.
Mathematical Background
Linear Algebra
Vector of Portfolio Weights
▶ Consider a portfolio containing long positions in n assets with returnsri fori=1,...,n
▶ Set wi to be the weight on asset i, i.e. the proportion of the total amount invested that is invested in asset i. Then
w = (w1, w2, ..., wn)′ is called the vector of portfolio weights
▶ Note that, for a fully-funded long-only portfolio, w1 +w2 +...+wn =1
▶ For instance, if I have $5m and I invest $1.5m in asset 1 and $3.5m in asset 2, the portfolio weights are (0.3, 0.7)′
Mathematical Background
Linear Algebra
Definition of Covariance Matrix
▶ Again consider n assets with returns ri for i = 1, ..., n
▶ Now set vij to be the covariance between ri and rj, for
i, j = 1, ....n – this is properly defined in the next section
▶ Then the matrix V = (vij ) is called the n × n covariance matrix of
the returns on these n assets
▶ Note that the ith diagonal element vii is the variance of ri
▶ Every covariance matrix is symmetric because vij = vji ∀ i, j
▶ And every covariance matrix is always positive definite – because the variance of a portfolio can be written as a quadratic form.......
Mathematical Background
Linear Algebra
Writing Portfolio Variance as a Quadratic Form
▶ Let V be the covariance matrix of the returns on n assets and let w be the n × 1 vector of portfolio weights
▶ Then w′Vw is the variance of the portfolio return. Being a variance, it must always be positive, for any weights – even if some are negative
?0.1 0.2? ′
▶ For instance, if V = 0.2 0.15 and w = (w1, w2) then
w′Vw = 0.1w12 + 0.4w1w2 + 0.15w2
▶ Soifw1 =0.3andw2 =0.7then
w′Vw=0.1×0.32 +0.4×0.3×0.7+0.15×0.72 =0.1665
Mathematical Background
Basic Statistics
2. Basic Statistics
Mathematical Background
Basic Statistics
Sample Mean
▶ The mean x ̄ of a sample {x1,...,xn} on a random variable X is the arithmetic average:
1 Xn x ̄=n xi
i=1
▶ For instance, if the sample has five observations, {1, 2, 3, 4, 5},
then x ̄ = 3
▶ The mean sets the location of the sample, i.e. it lies in the middle
of the observations
▶ But how closely clustered the observations are, depends on the sample variance
Mathematical Background
Basic Statistics
Sample Variance and Standard Deviation
▶ The variance s2 of a sample {x1, . . . , xn} on a random variable X
is:
1 Xn
s 2 = n − 1
2 (−2)2 +(−1)2 +02 +12 +22 4+1+0+1+4
▶ The standard deviation s is the square root of the variance. We
like s because it is in the same units of measurement as the
observations – and their mean
√
( x i − x ̄ ) 2 ▶ For instance, if the sample is {1, 2, 3, 4, 5} then
s= 4 = 4 =2.5 ▶ The greater the sample variance, the more dispersed
i=1
▶ In this example s =
2.5 = 1.5811
Mathematical Background
Basic Statistics
Sample Covariance
▶ The covariance sxy between two samples, {x1, . . . , xn} on a random variable X and {y1, . . . , yn} on a random variable Y , is calculated using the formula
1 Xn
(xi −x ̄)(yi −y ̄)
▶ For instance, if the two samples are: {1, 2, 3, 4, 5} on X and
sxy = n−1
{3, 2, 0, −2, −3} on Y , then x ̄ = 3 and y ̄ = 0 so we have
i=1
sxy = [−2×3]+[(−1)×2]+[1×−2]+[2×−3] = −6−2−2−6 = −4 44
▶ Covariance can be positive or negative and its sign should be apparent from a scatter plot
Mathematical Background
Basic Statistics
Sample Correlation
▶ The sample covariance is a measure of association between two samples but it is measured in weird units
▶ For instance, if X is height (measured in metres) and Y is weight (measured in kilos), the covariance is measured in metres × kilos
▶ The sample correlation rxy is a unit-less measure of association obtained dividing the covariance by the product of the two
standard deviations:
rxy = sxy sx sy
▶ Wealwayshave−1≤rxy ≤1
Mathematical Background
Basic Statistics
Example: Sample Correlation
▶ Consider two samples {1,2,3,4,5} on X and {3,2,0,−2,−3} on Y
▶ We have, after some calculations:
x ̄ = 3,sx = 1.58,y ̄ = 0,sy = 2.55,sxy = −4
Hence
rxy = −4 = −0.99 1.58 × 2.55
▶ If you calculate a sample correlation that is not between −1 and +1 you have made an error
Mathematical Background
Basic Statistics
Expected Value of a Random Variable
▶ The expected value of a random variable X is denoted E[X] in operator notation, or μ in parameter notation. This may be assumed or forecasted ex ante
▶ Sample statistics can only be derived from ex post, or historical observations (also called realisations of the random variable)
▶ In finance, when X denotes a return over the next few days or weeks, we usually assume E[X] is the risk-free (discount) rate
▶ The expectation sets the location of the distribution of X
▶ Most of the realisations of X should be located about μ – but how close they are depends on the variance of X
Mathematical Background
Basic Statistics
Variance and Standard Deviation of a Random Variable
▶ The variance of a random variable X is denoted V[X] in operator notation, or σ2 in parameter notation
▶ This is an assumed or forecast value for the variance of X
▶ The greater the variance, the greater the range of likely values in
the distribution of X
▶ It may be written in terms of the expectation operator: V[X] = E[(X − E[X])2]
▶ The standard deviation of X is the square root of the variance and is denoted pV[X], or σ
Mathematical Background
Basic Statistics
Covariance Between X and Y
▶ The covariance refers to two random variables X and Y , and it
tells us how they move together
▶ It is denoted Cov[X, Y ] in parameter notation, or σxy in parameter notation and it is defined as:
Cov[X, Y ] = E[(X − E[X])(Y − E[Y ])]
▶ When Cov[X, Y ] is positive, positive values for X tend to be accompanied by positive values in Y ; when it is negative, positive values for X tend to be accompanied by negative values in Y
▶ If X and Y are independent then Cov[X, Y ] = 0
Mathematical Background
Basic Statistics
Correlation Between X and Y
▶ The correlation Corr[X, Y ] is a standardized form of Cov[X, Y ]:
Cov[X, Y ] Corr[X,Y]= pV[X]V[Y]
▶ Or, in parameter notation:
ρxy = σxy
σx σy
▶ It is unit-less and we always have −1 ≤ ρxy ≤ 1
▶ If X and Y are independent then Corr[X, Y ] = 0
Mathematical Background
Basic Statistics
Rules for Statistical Operators
For random variables X and Y and constants a and b:
1. E[aX+bY]=aE[X]+bE[Y]
2. E[XY]=E[X]E[Y]+Cov[X,Y]
3. V[aX+bY]=a2V[X]+b2V[Y]+2abCov[X,Y]
4. Cov[aX,bY]=abCov[X,Y]
5. Corr[aX,bY]=sign(ab)Corr[X,Y]
Mathematical Background
Basic Statistics
i.i.d. Random Variables
Two random variables X and Y are independent and identically distributed (i.i.d.) if they have identical distributions and these distributions are independent
Two important consequences which we shall be using are:
1. They have identical distributions, so μx = μy and σx = σy
2. Because they are independent, σxy = ρxy = 0
We could also write this in operator notation, but it is longer:
1. E[X]=E[Y]andV[X]=V[Y]
2. Cov[X,Y]=Corr[X,Y]=0
Mathematical Background
Basic Statistics
The Normal Distribution Family
▶ The normal or Gaussian distribution is the most widely used probability distribution in finance. We write
X ∼ N(μ,σ2)
▶ The distribution is specified by two only parameters, the mean, μ
and the variance, σ2:
μ = E(X),
▶ The normal density function is:
f(x) = σ√2π exp
σ2 = V(X)
1 ?x − μ?2! −2 σ
Mathematical Background
Basic Statistics
Standard Normal PDF and CDF
Z ∼ N (0, 1) is the standard normal variable
φ = density function (pdf) Area =
Φ = distribution function (cdf)
φ(z) = √1 2π
exp(−0.5z2)
Values of Φ(z) are given in statistical tables
Mathematical Background
Basic Statistics
Normal Probabilities
The normal density function is a bell-shaped curve. That is, if X variable is normally distributed:
68.27% of observations on X fall within ± one standard deviation from the mean:
P (μ − σ < X < μ + σ) = 0.6827
95.45% of observations on X fall within ± two standard deviation
from the mean:
P (μ − 2σ < X < μ + 2σ) = 0.9545 99.73% of observations on X fall within ± three standard
deviations from the mean:
P (μ − 3σ < X < μ + 3σ) = 0.9973
Mathematical Background
Basic Statistics
Mathematical Background
Basic Statistics
Quantiles of the Standard Normal Distribution
▶ Φ(z) ∈ (0,1) is the distribution function for Z ∼ N(0,1)
▶ The inverse function Φ−1(α) is the α-quantile
▶ Notethatα∈(0,1)andΦ−1(1−α)=−Φ−1(α)
▶ Another notation: Φ−1(α) = Zα
▶ Another term for quantile when α is small is a critical value
▶ We often use the following critical values of N(0,1):
Φ−1(0.01)=−2.32635,Φ−1(0.025)=−1.95996,Φ−1(0.05)=−1.64485, Φ−1(0.1)=−1.28155
Mathematical Background
Basic Statistics
Standard Normal Commands in Excel
= NORMSDIST(x) Gives the value Φ(x) = NORMSINV(p)
Gives an observation z from N(0,1) such that P(Z < z) = p
”=NORMSDIST(0.15)” is 0.56 and ”=NORMSINV(0.56)” is 0.15
Φ distribution function
Mathematical Background
Basic Statistics
Sums of Normal Variables
The sum of normal variables is another normal variable
Let X1 and X2 be normal variables with
X1 ∼ N ?μ1,σ12?, X2 ∼ N ?μ2,σ2?
and correlation ρ. Then for any a and b
aX1 + bX2 ∼ N ?aμ1 + bμ2, a2σ12 + b2σ2 + 2abρσ1σ2?
This ‘stable’ property is very rare. It makes normal distributions easy to work with – and that is why we use them so much
Mathematical Background
Basic Statistics
Example: Sums of Normal Variables
▶ Suppose X1 ∼ N (1, 2) and X2 ∼ N (−1, 8) are normal variables with correlation −0.5. What is the distribution of Y = 2X1 − 3X2 ?
Solution
▶ We know that the sum of normal variables is another normal variable
▶ Byrule1,Y hasmean2×1−3×(−1)=5
▶ By rule 2, Y has variance:
√√ 4×2+9×8+2×2×(−3)×(−0.5)× 2× 8
√
8+72+6× 16=80+24=104
▶ Thus,Y ∼N(5,104)
Mathematical Background
Basic Statistics
Standard Normal Transformation
A normally distributed random variable X ∼ N(μ,σ2) may be standardised, i.e. transformed into a standard normal variable by setting:
Z=X−μ σ
e.g. ifX∼N(1,4)thenZ=(X−1)/2∼N(0,1) Conversely, we can transform a standard normal variable Z into
any other normal variable X ∼ N(μ,σ2) by setting:
X = Zσ + μ
e.g. ifZ∼N(0,1)thenX=4Z−2∼N(−2,16)
Mathematical Background
Linear Regression
Simple Regression Models
3. Linear Regression
Mathematical Background
Linear Regression
Simple Regression Models
Simple Linear Model
▶ The aim of regression is to test the influence of one or more independent variables – also referred to as regressors or explanatory variables – on one particular variable, known as the dependent variable, which is usually labelled Y
▶ The simple linear model (SLM) is
Yt =α+βXt +εt εt ∼i.i.d?0,σ2? t=1,...,T
▶ β measures the effect of X on Y : if β = 0 then X has no effect on Y
▶ Data on X and Y allow one to estimate the model parameters αˆ,βˆ and σˆ
Mathematical Background
Linear Regression
Simple Regression Models
Single Index Model
In the Single Index Model Yt is the return on an asset (stock, commodity, bond...) from time t − 1 to time t and Xt is the return on a single market index risk factor over the same period
8% 6% 4% 2% 0% -2% -4%
SP100 Return
-2.5%
-2.0%
-1.5%
-1.0%
-0.5%
0.0%
0.5%
1.0%
1.5%
2.0%
2.5%
Amex Return
Mathematical Background
Linear Regression
Simple Regression Models
Residuals
A residual et is an observation on the error εt
It is the difference between the actual value of y and the fitted
value of y at time t:
e = y − yˆ = y − ? αˆ + βˆ x ?
tttt t
where αˆ and βˆ are the estimated intercept and slope of the regression line:
ˆ
"!
"!
ˆ
$ =" −" !!!
ˆˆ " = αˆ + β #
!!
Mathematical Background
Linear Regression
Ordinary Least Squares
Ordinary Least Squares in Simple Linear Model
▶ By minimizing the residual sum of squares
T
R S S = X e 2t
t=1
we derive the ordinary least squares OLS formulae:
ˆˆsxy rRSS αˆ=y ̄−βx ̄; β=s2; σˆ= T−2
x
▶ To estimate the standard error of the regression we have divided by T − 2 and not T − 1 because we have lost 2 degrees of freedom (one to estimate α and another to estimate β)
Mathematical Background
Linear Regression
Ordinary Least Squares
OLS Beta vs Correlation
▶ In the Simple Linear Model the OLS estimate of the slope of the regression line is related to rxy, the correlation between X and Y and to sy/sx, the relative volatility of Y and X:
ˆ sxy rxysxsy ?sy ? β=s2=s2 =rxys
xxx
▶ OLS beta has the same sign as the sample correlation
▶ But the OLS beta may be greater than 1 or less than −1
Mathematical Background
Linear Regression
Ordinary Least Squares
Example
▶ A sample on X and Y gives the following statistics:
x ̄=4 sx =2 y ̄=9 sy =4 rxy =0.7
▶ Find the OLS estimates of the coefficient parameters Solution
▶ Applying the OLS formulae:
ˆ ?sy ? ?4? β=rxy s =0.7 2 =1.4
x
and αˆ = y ̄ − βˆx ̄ = 9 − 1.4 × 4 = 3.4
▶ Hence the OLS regression line is Yˆ = 3.4 + 1.4X
Mathematical Background
Linear Regression
Ordinary Least Squares
Goodness of Fit
▶ The smaller the RSS the better the fit of the model to the data
▶ The goodness-of-fit of the model to the data is measured by the
model R-squared:
▶ The denominator is the total sum of squares:
T
T SS = X (yt − y ̄)2 = (T − 1)V(Y )
t=1
▶ The numerator is the explained sum of squares (ESS) which is the amount of variation in Y that is explained by the regression. We can find ESS using:
TSS = ESS + RSS
R2 =ESS/TSS
Mathematical Background
Linear Regression
Ordinary Least Squares
Example
Suppose the sample statistics in the previous example were based on a sample of size 32 and the OLS regression gave a residual sum of squares of 270. Estimate the standard error of the regression, the explained sum of squares and the R2
Solution
▶ We have: σˆ = qRSS = q270 = 3 T−2 30
ESS = TSS − RSS = s2y × (T − 1) − RSS = 16×31−270 = 496−270 = 226
▶ Then R2 = 226/496 = 0.456
Mathematical Background
Linear Regression
General Linear Model
Multiple Regression
General Linear Model (GLM) is:
Yt =β1 +β2X2t + β3X3t + ..... +βkXkt +εt, εt ∼ i.i.d?0,σ2?, t = 1,...,T
Here β2, . . . , βk are the sensitivities to returns on different risk factors X2,...Xk and X1 = 1 so that we have an intercept β1.
For instance, equity risk factors might be:
▶ Broad market indices in different countries (for international equity
portfolios)
▶ Sector indices such as banking, agricultural, pharmaceutical, etc. (for domestic stock portfolios)
Mathematical Background
Linear Regression
General Linear Model
Matrix Form of GLM
y = Xβ + ε
y1 1 x21 ··· x
k1
y2 1 x22 ··· xk2 ↑ ↑ ··· ↑ y=.,X=. . . .=1X2···Xk, . ....↓↓···↓
yT
1 x2T ··· xkT
β1 ε1
β2 ε2 β= . , ε= .
. . βk εT
Mathematical Background
Linear Regression
General Linear Model
Fitted Model in Matrix Form
▶ To fit the model, we use data on y and X to estimate the model parameters
▶ Denote the estimated coefficients by βˆ – see next slide
▶ Then we write the fitted model as:
▶ Or, equivalently, as:
yˆ = X βˆ y = X βˆ + e
where the residual vector e is:
e = y − yˆ
Mathematical Background
Linear Regression
General Linear Model
OLS Formula in Matrix Form
▶ Ordinary least squares (OLS) fits the regression line by estimating the parameters β and σ in such as way as to minimize the sum of the squared residuals (RSS) – now written in matrix form as:
RSS = e′e
▶ It can be shown that the OLS criterion leads to the following
formulae for the parameter estimates:
βˆ = (X′X)−1 (X′y)
r e′e σˆ= T−k
Mathematical Background
Linear Regression
Market Risk Decomposition
Risk Decomposition in the Single Index Model
Let Yt = α+βXt +εt where Yt is the return on a stock portfolio and Xt is the return on the stock market index. Taking variances:
V (Yt) = β2V (Xt) + σ2
Thus there are 3 components to the market risk of a stock portfolio, as
measured by the variance of a portfolio return:
▶ The portfolio’s sensitivity, or ‘risk relative to the market’ – captured by
the equity beta
▶ The systematic risk which is undiversifiable – captured by V (Xt)
▶ The portfolio’s specific risk, also called ‘idiosynchratic’ or ‘diversifiable’ risk – captured by σ2
Mathematical Background
Linear Regression
Market Risk Decomposition
Risk Decomposition with Multiple Risk Factors
Most large stock portfolios have multiple equity risk factors, so we write:
y = Xβ + ε
where Xit is the return on the ith equity risk factor i > 2. The fitted
model is:
Taking variances yields the systematic risk – also called the equity risk:
yˆ = X βˆ
ˆ′ ?ˆ?ˆ
V(yˆ)=βV X β
?ˆ? This is a quadratic form with the risk factor covariance matrix V X
and the vector of equity betas of the portfolio.
Mathematical Background
Excerpts from Calculus
4. Excerpts from Calculus
Mathematical Background
Excerpts from Calculus
Logs and Exponentials
The Exponential Function ex or exp(x)
e = 2.71828182845904523536028747135266249 . . .
It an irrational number, but it’s still just a number between 2 and 3, so the graph of ex lies between 2x and 3x:
The exponential function ex is also denoted exp(x)
Mathematical Background
Excerpts from Calculus
Logs and Exponentials
The Natural Logarithm ln x
The function lnx, also denoted loge(x) is the inverse function of
exp(x), which means that:
ln(ex)=xand exp(lnx)=x
Thegraphoflnxisthereflectionofy=ex intheliney=x
y
y = x
y = ln(x)
x
y = ex
Mathematical Background
Excerpts from Calculus
Logs and Exponentials
Rules for ex and ln x
▶ Rules for ex are the same as the rules for any indices – like
23 × 24 = 27, or 30 = 1
▶ In particular, e0 = exp(0) = 1 and the function turns sums into
products:
e−x = 1/ex, ex+y = exey, ex−y = exe−y = ex/ey
▶ Rules for ln x are derived as the inverse of rules for exp(x) – for
instance, ln 1 = 0
▶ And logs turn products into sums:
ln(x−1)=−lnx, ln(xy)=lnx+lny, ln(x/y)=lnx−lny
▶ It follows that ln(xa) = a ln x
Mathematical Background
Excerpts from Calculus
Logs and Exponentials
Expansion of ln(1 + x)
▶ When−1<x≤1itcanbeshownthat:
x2 x3 x4 ln(1+x)=x− 2 + 3 − 4 +...
▶ Butwhen−1<x≤1weknowthatxisgreaterthanx2,andx2 is greater than x3 etc....
▶ And if x is close to zero, x2 is very small and x3 is tiny ... so, from the above expansion, we have:
x ≈ ln(1 + x)
Mathematical Background
Excerpts from Calculus
Returns and Volatility
Profit and Loss (P&L) and Returns: Backward Looking
▶ Let Pt denote the value of the portfolio at time t, then: h-day P&L at time t = Pt − Pt−h
▶ Returns only make sense if Pt > 0, then:
h-day return at time t = Rht = ?Pt−Pt−h ?
Pt−h
▶ When h is small we may use a log return, rht to approximate Rht:
?Pt−Pt−h?
≈ ln
?Pt ?
P = ln Pt − ln Pt−h = rht
t−h
Rht = P t−h
▶ Log returns are not traded, but they allow us to prove some theoretical results, such as the square root of time rule
Mathematical Background
Excerpts from Calculus
Returns and Volatility
Square-Root-of-Time Rule
This rule states that: If the returns on an asset or portfolio are independent and identically distributed (i.i.d.) then their standard deviation scales with the square root of the holding period
▶ Thus, if σh denotes the standard deviation of h-period returns then
√
σh = σ1 ×
h and σ1 = √
10%
σ1 = √25 = 2% and that σ100 = 10% ×
4 = 20%
σh
h
▶ For instance, if we know σ25 = 10% then we can deduce that
√
Mathematical Background
Excerpts from Calculus
Returns and Volatility
Definition of Volatility
▶ Volatility is the annualized standard deviation of h-period returns:
√
Volatility = σ250 =
where n is the number of h-day returns per year
▶ We assume there are 250 trading days per year ..... but some people assume 260, or 252 ....... and we assume 52 weeks (some assume 50) and 12 months
▶ Forh=10weusen=250 =25,sovolatilityis5×σ10 h
√
▶ Butn=52forσ5 sovolatilityisσ5
▶ And n = 12 if σh is the standard deviation of monthly returns
n × σh
52(butitisokifyouuse50)
Mathematical Background
Excerpts from Calculus
Returns and Volatility
Example: Standard Deviation → Volatility
Find the volatility of an asset whose daily returns have a standard deviation of σ1 = 0.02
√
▶ Volatility = σ250 = 0.02 ×
250 = 31.62%
Find the volatility of an asset with monthly returns having a standard deviation of 8%
√
▶ Volatility = σ250 = 0.08 ×
12 = 27.71%
Mathematical Background
Excerpts from Calculus
Returns and Volatility
Example: Volatility → Standard Deviation
Find the standard deviation of daily returns (σ1) for an asset with volatility 20%
√
▶ σ1 =0.2÷
250=1.265%
Find the standard deviation of 10-day returns (σ10) for an asset with volatility 20%
√
▶ σ10 =0.2÷
25=4%
Find the standard deviation of weekly returns (σ5) for an asset with volatility 20%
√
▶ σ5 =0.2÷
52=2.77%
Mathematical Background
Excerpts from Calculus
Taylor Expansion
Quick (Non-Essential) Recap of Differentiation
The derivative of a function f(x) is the slope of its tangent It is denoted f′(x) or, if we set y = f(x) by dy
Also, we can differentiate a sum term by term, i.e. the derivative of f(x) ± g(x) is f′(x) ± g′(x)
f(x) f′(x)
a0
ax a
ax2 2ax xn nxn−1
lnx x−1 ex ex
dx
Mathematical Background
Excerpts from Calculus
Taylor Expansion
Intuition for First-Order Taylor Expansion
▶ We know that first derivative of a function (the slope of the tangent) is approximately equal to the slope of the chord:
f′(x)≈ f(x+ε)−f(x) ε
▶ Turning this around gives the first order Taylor expansion of the change inf forasmallchangeεinx:
f (x + ε) − f (x) ≈ εf′ (x)
▶ The same expansion, for the value of f in a neighbourhood of some given
value x0 is obtained by setting ε = x − x0:
f (x) ≈ f (x0 ) + (x − x0 ) f ′ (x0 )
▶ This is a linear function of x because x0 is a given constant
Mathematical Background
Excerpts from Calculus
Taylor Expansion
What is Taylor Expansion?
▶ What happens when P&L is a non-linear function of its risk factors? For example:
▶ The price of a bond is an exponential function of an interest rate
▶ The price of an option is a non-linear function of two main risk
factors – the underlying price and its volatility
Taylor expansion provides a way to approximate the change in price, given certain changes in each risk factor, using a low-order polynomial. It is a local approximation of the value of a non-linear function f(x, y, . . .) by a polynomial in x and y
Mathematical Background
Excerpts from Calculus
Taylor Expansion
General Taylor Expansions of f(x)
▶ The nth order Taylor expansion for a non-linear and n times continuously
differentiable function f(x) is:
ε2 ε3 εn f(x+ε)−f(x)≈εf′(x)+ 2!f′′(x)+ 3!f′′′(x)+···+ n!f(n)(x)
where ε must be small for a good approximation
▶ This can also be expressed as an nth order polynomial for f(x) in the
neighbourhood of some point x0
▶ For instance, a quadratic approximation to f(x) is:
f (x) ≈ f (x0 ) + (x − x0 ) f ′ (x0 ) +
0 f ′′ (x0 )
(x−x )2
Mathematical Background
Excerpts from Calculus
Taylor Expansion
Example: Taylor Approximation
Let f (x) = x2 + ln x. Find a second order Taylor approximation to: (a) the change in value of f(x) between x = 1 and x = 1.2
(b) the function f(x) in a neighbourhood of x = 1
Solution
f (1) = 1 + ln (1) = 1, f′(x)=2x+x−1 =3whenx=1, f′′(x)=2−x−2 =1whenx=1
(a) f(1.2)−f(1)≈0.2×f (1)+ (b) f(x) ≈f(1)+(x−1)f′(1)+
×f (1)=0.2×3+0.02×1=0.62
2 (x−1)2
′ 0.22 ′′
×f′′(1)
= 1+3(x−1)+0.5(x−1)2 = 3x−2+0.5?x2 −2x+1?
= 0.5x2 +2x−1.5
Mathematical Background
Excerpts from Calculus
Taylor Expansion
Taylor Expansion of Functions of Several Variables
Taylor expansion can be generalised to a function of more than one variable. For instance a Taylor expansion for f(x,y) that is second order in x and first order in y is:
f (x + εx,y + εy)−f (x,y) ≈ εxfx (x,y)+ε2x fxx (x,y)+εyfy (x,y) 2!
Here fx, and fy denote the first partial derivatives of f(x,y) and fxx denotes its second partial derivative with respect to x.
Later we shall apply this to find the delta-gamma-vega approximation to the change in an option value when the underlying price and volatility change by small amounts