FIN236 Topic02

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

2

TOPIC
2
Using Excel
Overview 2.2
Topic learning outcomes .............................................................................................. 2.2
Further resources ........................................................................................................ 2.2
1 Accessing statistical functions in Excel 2.2
1.1 The Excel Analysis Toolpak ............................................................................... 2.5
1.2 Using Excel to perform statistical calculations .................................................... 2.6
1.3 SUM and AVERAGE ........................................................................................... 2.7
1.4 MEDIAN ........................................................................................................... 2.7
1.5 MODE .............................................................................................................. 2.8
1.6 MAX and MIN ................................................................................................... 2.8
1.7 QUARTILE ........................................................................................................ 2.9
1.8 STDEV (standard deviation) ............................................................................. 2.10
2 Measures of association 2.11
2.1 COVAR (covariance) ........................................................................................ 2.11
2.2 CORREL (correlation) ...................................................................................... 2.11
2.3 SKEW and KURT (skewness and kurtosis) ........................................................ 2.12
2.4 STANDARDIZE ................................................................................................ 2.13
2.5 NORMDIST ..................................................................................................... 2.14
3 Other commonly used functions in Excel 2.14
3.1 RAND( ) function (random number) .................................................................. 2.14
3.2 NORMINV ....................................................................................................... 2.15
3.3 NORMSINV (inverse of the standard normal) .................................................... 2.15
3.4 NORMINV(RAND( )) * S+N function .................................................................. 2.16
3.5 SLOPE ........................................................................................................... 2.16
3.6 INTERCEPT..................................................................................................... 2.16
3.7 SQRT (square root) ......................................................................................... 2.16
3.8 VARP (population variance) ............................................................................. 2.16
3.9 SOLVER (what-if analysis tool) ......................................................................... 2.17
3.10 RANK ............................................................................................................. 2.17
4 Monte Carlo sampling with Excel 2.17
5 Matrix algebra 2.19
5.1 Basic operations ............................................................................................ 2.20
5.2 Matrix operations ........................................................................................... 2.22
5.3 Types of matrices ........................................................................................... 2.23
5.4 Theorems about transposed matrices .............................................................. 2.25
5.5 MMULT and TRANSPOSE ................................................................................ 2.26
Suggested answers 2.28
2.2
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Overview
This topic focuses on the statistical functions of Excel that are frequently applied to problem-solving
in finance. It includes a case study illustrating a Monte Carlo sampling simulation to estimate
parameters of the distribution of the sample mean and standard error. In finance, Monte Carlo
methods are frequently applied to calculating risk. The topic also provides an overview of the basic
operations of matrix algebra.
This topic specifically addresses the following subject learning outcome:
1. Evaluate the strengths and limitations of quantitative analysis techniques.
Topic learning outcomes
On completing this topic, students should be able to:
apply Excel functionality to perform mathematical and statistical analysis of financial data
apply Excel functionality to conduct a Monte Carlo sampling simulation
perform basic matrix algebra operations to analyse financial data.
During the course of this subject, students will be required to develop increasingly complex
spreadsheets, so it is important to become familiar with the Help function in Excel.
Further resources
Levine, D, Stephan D, Krehbiel T & Berenson, M 2007, Statistics for managers using Microsoft
Excel and student CD package, 5th edn, Prentice Hall, New York. Available in the Kaplan Library.
1 Accessing statistical functions in Excel
There are hundreds of functions available within Excel. For students of this subject the statistical
category will be of most interest. The example below, based on the programme version Excel
2003, shows how to access statistical functions in Excel.
First, select insert in the main menu bar:

2.3
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Then select function:

The Insert Function dialogue box appears. Select the category statistical then select the
function you are interested in learning more about. For the current purposes, the function
AVEDEV has been selected.

2.4
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Select Help on this function in the bottom left corner of the dialogue box. A new window will pop
up with detailed technical information on the function, as shown below:

Selecting see also at the top left will produce a list of related topics for students to explore
further. Selecting show all in the top right corner will cause additional information to be provided
in many cases including a step-by-step, hands-on example of working with the function in
question within Excel.
2.5
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
1.1 The Excel Analysis Toolpak
An Excel add-ins called the Analysis Toolpak provides many statistical functions not available
directly through Excel. Depending on your installation, the Analysis Toolpak may or may not be
installed. This section provides instruction for Excel 2003 and Excel 2007.
If the Excel 2003 Tools menu has a Data Analysis command, the Analysis Toolpak is installed.
If not, you must install the Analysis ToolPak.
In Excel 2003 On the Tools menu, select Add-Ins. Tick the boxes for Analysis ToolPak,
Analysis Toolpak VBA and Solver Add-in.

In Excel 2007 (from the online help):
1. Click the Microsoft Office Button , and then click Excel Options.
2. Click Add-Ins, and then in the Manage box, select Excel Add-ins.
3. Click Go.
4. In the Add-Ins available box, select the Analysis ToolPak check box, and then click OK.
Tip: If Analysis ToolPak is not listed in the Add-Ins available box, click Browse to locate it.
5. If you get prompted that the Analysis ToolPak is not currently installed on your computer,
click Yes to install it.
6. After you load the Analysis ToolPak, the Data Analysis command is available in the Analysis
group on the Data tab.
Note: To include Visual Basic for Application (VBA) functions for the Analysis ToolPak, you load the
Analysis ToolPak VBA add-in the same way that you load the Analysis ToolPak. In the Add-ins
available box, select the Analysis ToolPak VBA check box, and then click OK.
2.6
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Discuss this: Analysis of variance (ANOVA) in Excel
Excels data analysis package can calculate many statistical tests automatically.
If the problem can be set out in columns on a spreadsheet, then it can probably be
solved with one of Excels data analysis functions. This can be a useful check or
quick analysis for simple financial problems.
On Excels menu, go to Tools Data Analysis to find out the tests (including ANOVA)
that can be performed. Use the help button on the right side to find out more about
the various tests and their functionalities.
Go to the Discussion Forum in the Subject Room and follow the discussion thread
called DT: Analysis of variance (ANOVA) in Excel and participate in the discussion
online.
1.2 Using Excel to perform statistical calculations
No matter how sophisticated the analysis, or how powerful the tools, the quality of the solution
depends on the quality of the data. It all begins with the data.
Types of data
Figure 1 below illustrates the types of data students of quantitative applications will frequently
encounter.
Figure 1 Types of data

Measures of central tendency
In statistics, measures of central tendency (also referred to as measures of location) include the
mode (the value that occurs most frequently), the median (the middle value in rank order), the
mean (average value) and other measures. Measures of central tendency are useful in terms of
showing where data are centred.
2.7
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
1.3 SUM and AVERAGE
In Figure 2 below, the yield is calculated by summing the values in column D using Excels SUM
function, and dividing by the number of data points in rows 4 to 13. A simpler way is to use
Excels AVERAGE function, as shown below.
Figure 2 SUM and AVERAGE

1.4 MEDIAN
Figure 3 below illustrates the use of Excels MEDIAN function applied to data in column D, rows 4
to 13. Note the syntax for stipulating the range (D4:D13).
Figure 3 MEDIAN

2.8
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
1.5 MODE
Figure 4 below illustrates the use of Excels MODE function applied to data in column D, rows 4
to 13.
Figure 4 MODE

1.6 MAX and MIN
Measures of dispersion include range, quartiles, standard deviation and variance. Measures of
dispersion are useful in terms of showing where and how data are dispersed, and are frequently
used to determine the variability (or volatility) within a data set. Outliers are data points that are
relatively widely dispersed.
Figure 5 below illustrates the use of Excels MAX and MIN functions applied to calculating the
range of the data in column D, rows 4 to 18.
Figure 5 MAX and MIN

2.9
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
1.7 QUARTILE
Figure 6 (data in column D, rows 4 to 18) and Figure 7 (rows 29 to 43) below illustrate the
calculation of quartile and interquartile ranges in Excel. Note the syntax and application of the
QUARTILE function.
Figure 6 QUARTILE

Figure 7 Calculating interquartile range

2.10
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
1.8 STDEV (standard deviation)
Figure 8 below illustrates the calculation of mean and standard deviation (STDEV).
Figure 8 Calculating the arithmetic mean and standard deviation

Outliers
Figure 9 illustrates the impact of data point outliers on the smoothness or otherwise of trends and
distributions.
Figure 9 Outliers

2.11
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
2 Measures of association
Sometimes referred to as measures of relative risk, measures such as covariance and correlation
are used to determining the relationships between variables.
2.1 COVAR (covariance)
Figure 10 (data in column D, rows 4 to 16) below illustrates the calculation of covariance.
Figure 10 Calculating covariance (COVAR function)

2.2 CORREL (correlation)
Figure 11 (data in column D, rows 4 to 16) below illustrates the use of the CORREL function, and
the syntax required to calculate the coefficient of correlation.
Figure 11 Calculating correlation (CORREL function)

2.12
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
2.3 SKEW and KURT (skewness and kurtosis)
Key concept: moment
In statistics, the term moment refers to an aspect or feature of a distribution.
The mean and variance are the first two moments of a distribution. Higher moments include
skewness and kurtosis.
Figure 12 below illustrates the use of Excel functions SKEW and KURT in calculating skewness
and kurtosis.
Figure 12 Calculating skewness (SKEW) and kurtosis (KURT)

2.13
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
2.4 STANDARDIZE
Figure 13 below illustrates the use of the STANDARDIZE function in Excel. The Z-score is the
deviation of a normally distributed variable expressed in units of standard deviation.
Using Z-scores is covered in Topic 1.
Figure 13 STANDARDIZE

2.14
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
2.5 NORMDIST
Figure 14 below illustrates the use of the NORMDIST function in Excel.
Figure 14 NORMDIST

3 Other commonly used functions in Excel
3.1 RAND( ) function (random number)
In Excel, the function RAND( ) generates a random number between 0 and 1. Having generated a
series of random numbers between 0 and 1, statistical functions can then be used to generate a
simulated series of random observations from a range of distributions. Random number series are
used in a wide range of statistical and other quantitative applications.
2.15
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
3.2 NORMINV
The function NORMINV returns the inverse of the normal cumulative distribution for the specified
mean and standard deviation. Figure 15 below provides more information. Figures 15 and 16 are
screen captures from Excel Help.
Figure 15 NORMINV

3.3 NORMSINV (inverse of the standard normal)
The function NORMSINV returns the inverse of the standard normal cumulative distribution.
Figure 16 below provides more information.
Figure 16 NORMSINV

2.16
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
3.4 NORMINV(RAND( )) * S+N function
In Excel, the function NORMINV(RAND( )) * S+N generates a random observation from a normal
distribution with mean N and standard deviation S.
Apply your knowledge 1: What if analysis
In the financial services industry, the ability to create, explore and analyse different
scenarios accurately and quickly is essential to success. Solver and Goal Seek are
commands enabling what if analysis to be performed. Using the Excel Help
function, familiarise yourself with the syntax and application of both commands.
3.5 SLOPE
Microsoft Support describes the SLOPE function in this way:
The SLOPE(known_ys,known_xs) function returns the slope of the linear regression line that is
used to predict y values from x values.
Syntax: SLOPE(known_ys,known_xs)
The arguments, known_ys and known_xs, must be arrays or cell ranges that contain equal
numbers of numeric data values.
The most common usage of the SLOPE function includes two ranges of cells that contain the data,
such as SLOPE(A1:A100, B1:B100).
3.6 INTERCEPT
Microsoft Support describes the INTERCEPT function in this way:
The INTERCEPT(known_ys,known_xs) function returns the INTERCEPT of the linear regression line
that is used to predict y values from x values.
Syntax: INTERCEPT(known_ys,known_xs)
The arguments, known_ys and known_xs, must be arrays or cell ranges that contain equal
numbers of numeric data values. Frequently, INTERCEPT includes 2 ranges of cells containing the
data, such as INTERCEPT(A1:A100, B1:B100).
3.7 SQRT (square root)
SQRT(number) gives the positive square root of the given number.
3.8 VARP (population variance)
Microsoft Support describes the VARP function in this way:
VARP returns the population variance for a population whose values are contained in an Excel
worksheet and are specified by the argument or arguments to VARP.
Syntax: VARP(value1, value2, value3, ...)
where value1, value2, ..., up to 30 value arguments.
2.17
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
The most common usage of VARP includes only 1 value argument that specifies a range of cells
that contains the population, for example, VARP(A1:B100).
3.9 SOLVER (what-if analysis tool)
Microsoft describes SOLVER in this way:
Solver is part of a suite of commands sometimes called what-if analysis tools. What-if analysis is
the process of changing the values in cells to see how those changes affect the outcome of
formulas on the worksheet. For example, varying the interest rate that is used in an amortisation
table to determine the amount of the payments.
With Solver, you can find an optimal value for a formula in one cell called the target cell on a
worksheet. Solver works with a group of cells that are related, either directly or indirectly, to the
formula in the target cell. Solver adjusts the values in the changing cells you specify called the
adjustable cells to produce the result you specify from the target cell formula. You can apply
constraints to restrict the values Solver can use in the model, and the constraints can refer to
other cells that affect the target cell formula.
3.10 RANK
The RANK function ranks the size of a number compared to other numbers in a list a data.
Syntax: = RANK(Number, Ref, Order)
where:
Number = the cell reference of the number to be ranked
Ref = the range of cells to use in ranking the Number
Order = determines whether the Number is ranked in ascending or descending order. 0 (zero)
ranks in descending order (largest to smallest). 1 ranks in ascending order (smallest
to largest).
4 Monte Carlo sampling with Excel
Monte Carlo simulation was described in Topic 1. This case study is a Monte Carlo simulation
using Excel to estimate parameters of the distribution of the sample mean and standard error.
This approach can be quite useful when there is little knowledge of the underlying probability
distribution.
This case study is interactive, requiring you to complete steps in an activity as you read. The case
study will lead you through the activity, providing prompts and examples. There is no one answer
for the activity as it involves generating random numbers in the first instance.
Step 1: Using Excel, insert 50 copies of a set of 100 normally distributed random numbers.
This is easily done with the Tools/Data Analysis/Random Number Generator option. You will make
the entry shown in Figure 17.
2.18
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Figure 17 Excel random generation of 50 copies of a set of 100 normally distributed random numbers

Step 2: With the resulting array of 50 columns each of 100 rows (i.e. 50 samples of a random
variable each with 100 observations) estimate the following:
Using only the first 10 rows of each column, estimate each columns mean and standard
deviation. The result will be a set of 50 estimates of the mean and standard deviation,
each based on a sample of size N = 10 observations.
Using all 100 rows of each column, estimate each columns mean and standard deviation.
The result will be another set of 50 estimates of the mean and standard deviation, each based
on a sample of size N = 100 observations.
Step 3: For each of these two sets of results, one based on a sample size of 10 and one on a
sample size of 100, calculate the mean and standard deviation of the 50 estimates of the sample
mean and the sample standard deviation. You should now have a set of results like those found
in Table 1.
Table 1 Sample results
Sample 1 Sample 2 ... Sample 50 Sample size Sample mean Sample std error
Mean 0.353 4.188 ... 1.072 10 2.221 1.581
Std dev 5.057 4.280 ... 2.925 4.950 1.187

Mean 2.225 3.338 ... 1.610 100 1.978 0.546
Std dev 4.829 5.385 ... 4.392 4.984 0.398
Note that the results here are reasonably close to the underlying actual parameters (recall that
the mean was set at 2 and the standard deviation was set at 5). Note also that the standard
deviation of the 50 mean estimates (the standard error) is very close to the theoretical one of
SE = /N, which for N = 10 is SE = 1.581 and for N = 100 is 0.500.
Step 4: Next estimate the simulated sample 90% confidence interval for your 50 mean estimates.
All you need do is order the 50 estimates of the mean from lowest to highest and take the middle
90% (i.e. the sample 90% confidence interval ranges from the 5% percentile to the 95%
percentile). It is easier still to use the Excel PERCENTILE function with the parameter set first at
0.05 and then at 0.95. For the results above, these estimates were as follows in Table 2.
2.19
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Table 2 Sample 90% confidence intervals for mean and standard deviation
Sample size Percentile 5% Percentile 95%
Mean 10 0.224 4.774
Std dev 2.830 6.647

Mean 100 1.151 2.817
Std dev 4.443 5.570
Table 2 shows that the simulated 90% confidence interval is (0.224, 4.774) based on a sample
of 10 observations and (1.151, 2.817) based on a sample of 100 observations. How do your
simulated confidence intervals compare with the theoretical ones based on a sample of either
10 or 100 observations?
Knowing that the confidence intervals are theoretically calculated as CI =
N
X t SE , the results
above become the following in Table 3.
Table 3 Confidence intervals for mean
Sample size Percentile 5% Percentile 95%
Mean 10 0.676 5.119

Mean 100 1.070 2.889
The simulated 90% confidence interval based on samples of 10 happened to come in narrower
than the theoretical, whereas the sample confidence interval based on samples of 100 is
reasonably close to the theoretical.
Discuss this: Monte Carlo sampling simulation
Based on the case study above, does either sample (i.e. of 10 or 100 observations)
appear normally distributed? What do you think will happen to your results as you
increase the number of random variables and/or the sample size?
Go to the Discussion Forum in the Subject Room and discuss your answers with other
students in the discussion thread called DT: Monte Carlo sampling simulation.
5 Matrix algebra
Matrix algebra is used extensively in multi-dimensional financial analysis, for example, portfolio
theory (which is covered in Topic 7) and econometrics. A matrix is defined as a rectangular array of
elements arranged in rows or columns as in:
A =
11 12 1
21 22 2
1 2
. .
. .
. . .
. . .
. .
n
n
m m mn
a a a
a a a


a a a
(
(
(
(
(
(
(
(
(


2.20
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
If it has mn elements arranged in m rows and n columns, it is said to be for order m by n, which is
often written m n. The element in the ith row and jth column is represented by a
ij
. The matrix
may be indicated even more concisely by:
A =
ij
a (

where i = 1, 2, , m and j = 1, 2, , n.
A matrix of order 1 n contains only a single row of elements and is commonly referred to as a
row vector, for example:
b = | |
1 2
. .
n
b b b
While a matrix of order m 1 is a column vector:
c =
1
2
.
.
m
c
c


c
(
(
(
(
(
(
(
(
(


Equality of two matrices
Two matrices A and B are said to be equal when they are of the same order and a
ij
= b
ij
for all i,j,
that is, the matrices are equal, element by element.
5.1 Basic operations
Addition of two matrices
If A and B are of the same order, then A + B is defined to be a new matrix C of the same order in
which c
ij
= a
ij
+ b
ij
for all i,j.
For example:
A =
2 0
5 6
(
(
(



and B =
3 6
4 1
(
(
(




then
C = A + B =
1 6
1 7
(
(
(




Scalar multiplication of matrices
If is a scalar, then scalar multiplication is defined such that:
A =
ij
a (


For example, if = 5, then:
A =
5 2 5 0
5 5 5 6


(
(
(



=
10 0
25 30
(
(
(




2.21
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
It follows from the rules of addition and scalar multiplication that:
A B = A + (1)B = [a
ij
b
ij
]
For example:
2 0
5 6
(
(
(




3 6
4 1
(
(
(



=
2 ( 3) 0 6
5 4 6 1
(
(
(



=
5 6
9 5
(
(
(




Matrix multiplication
If A is of order m n and B is of order n p, then the product AB is defined to be a matrix C of
m p, whose ij
th
element is:
1
n
ij ik kj
k
c a b
=
=

i = 1, 2, , m and j = 1, 2, , p
(i.e. the ij
th
element in the product matrix is found by multiplying the elements of the i
th
row of the
first matrix by the corresponding elements of the j
th
column of the second matrix and summing
over all terms.)
For this to be possible, it is clear that the number of elements in a row of the first matrix has to
be equal to the number of elements in a column of the second matrix. That is, the number of
columns in the first matrix should equal the numbers of rows in the second matrix. The matrices
are then said to be conformable with respect to multiplication.
Thus, if:
A =
11 12 13
21 22 23
a a a
a a a
(
(
(

and B =
11 12
21 22
31 32
b b
b b
b b
(
(
(
(
(


then:
A B =
11 11 12 21 13 31 11 12 12 22 13 32
21 11 22 21 23 31 21 12 22 22 23 32
a b a b a b a b a b a b
a b a b a b a b a b a b
+ + + + (
(
(
+ + + +


is a 2 2 matrix, while:
B A =
11 11 12 21 11 12 12 22 11 13 12 23
21 11 22 21 21 12 22 22 21 13 22 23
31 11 32 21 31 12 32 22 31 13 32 23

b a b a b a b a b a b a
b a b a b a b a b a b a
b a b a b a b a b a b a
+ + + (
(
(
+ + +
(
(
(
+ + +


is a 3 3 matrix.
2.22
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
For example:
A =
2 1 0
1 1 0


(
(
(

and B =
3 0
1 2
2 11
(
(
(
(
(





A B =
2 3 1 1 0 2 2 0 1 2 0 11
1 3 1 1 0 2 1 0 1 2 0 11


+ + + + (
(
+ + + + (




=
7 2
4 2
(
(
(




whereas:
B A =
3 2 0 1 3 1 0 1 3 0 0 0
1 2 2 1 1 1 2 1 1 0 2 0
2 2 11 1 2 1 11 1 2 0 11 0



+ + + (
(
+ + + (
(
( + + +





=
6 3 0
4 3 0
15 13 0
(
(
(
(
(





5.2 Matrix operations
1. The commutative law of addition holds for matrix additions, provided that the two matrices are
of the same order:
i.e. A + B = B + A, provided that A and B are of the same order.
2. In general, the commutative law of multiplication does not hold for matrix multiplication, even if
they are of the same order. If the matrices are of order m n and n m, both products will
exist but they will be of different orders and hence cannot be equal. If both are square matrices
of the same order, both products will exist and will be of the same order but not necessarily
equal:
i.e. A B B A, even if both n n.
3. The associative law of addition holds for matrix addition. Since addition of matrices is simply
achieved by adding corresponding elements and since it does not matter in which order
elements are added together, the associative law holds:
i.e. (A + B) + C = A + (B + C)
4. The associative law of multiplication holds for matrix multiplication:
i.e. (A B) C = A (B C)
5. The distributive law of scalar operations holds for matrix operations:
i.e. A (B + C) = A B + A C and (B + C) A = B A + C A
6. The distributive law of scalar multiplication holds:
i.e. (A + B) = A + B
( + )A = A + A
2.23
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Example: Matrix operations
A =
2 0
5 6
(
(
(



and B =
3 6
4 1
(
(
(




= 5 and = 6
5(A + B) = 5
1 6
1 7
(
(
(



=
5 30
5 35
(
(
(




5A + 5B =
10 0
25 30


(
(
(

+
15 30
20 5


(
(
(

=
5 30
5 35
(
(
(




Thus (A + B) = A + B
(5 + 6) A = 11
2 0
5 6


(
(
(

=
22 0
55 66
(
(
(




5A + 6A =
10 0
25 30


(
(
(

+
12 0
30 36


(
(
(

=
22 0
55 66
(
(
(




Thus ( + ) A = A + A
5.3 Types of matrices
The identity (or unit) matrix of order n is defined by:
I
n
=
1 0 . . 0
0 1 . . 0
. . .
. . .
0 0 . . 1

(
(
(
(
(
(
(
(
(






which is a square matrix of order n n, with ones along in the principal diagonal and zeros
everywhere else.
It is easy to verify that pre-multiplying or post-multiplying any matrix A by the identity matrix of
appropriate order leaves A unchanged:
i.e. I A = A I = A
Scalar matrix has a common scalar element in the principal diagonal and zeros everywhere else,
for example:
I
n
=
0 . . 0
0 . . 0
. . .
. . .
0 0 . .

(
(
(
(
(
(
(
(
(






2.24
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
A scalar in a matrix product can always be replaced by a scalar matrix and a convenient order of
that matrix chosen. For example, A is a m n matrix. Scalar multiplication is thus equivalent to
matrix multiplication and may be thought of a pre- or post-multiplication since:
A = (I
n
)A = A(I
m
) = A
Diagonal matrix is a general form of scalar matrix that has scalar elements, not necessarily
equal, in the principal diagonal and zeros in the off-diagonal positions, for example:
A =
11
22
0 . . 0
0 . . 0
. . .
0 0 . .
nn
a
a


a
(
(
(
(
(
(
(

= diag[a
11
, a
22
, , a
nn
]
The transpose of A is defined to be the matrix obtained from A by interchanging rows and
columns. That is, the first row of A becomes the first column of the transpose of A, the second
row of A becomes the second column of the transpose of A, and in general the ji
th
element in the
transpose is the ij
th
element of the original matrix. The transposed matrix is indicated by A, for
example:
A =
11 12 13
21 23
22
a a a
a a a

(
(
(


A =
11 21
12 22
13 23

a a
a a
a a
(
(
(
(
(


If A = A, then A is said to be a symmetric matrix and obviously it must also be a square matrix
such that:
a
ij
= a
ji
, i,j = 1, 2, , n.
Thus:
A A =
2 2 2
11 12 13 11 21 12 22 13 23
2 2 2
21 11 22 12 23 13 21 22 23
a a a a a a b a a
a a a a a a a a a
(
+ + + +
(
(
+ + + +


and
AA =
2 2
11 21 11 12 21 22 11 13 21 23
2 2
12 11 22 21 12 22 12 13 22 23
2 2
13 11 23 21 13 12 23 22 13 23
a a a a a a a a a a
a a a a a a a a a a
a a a a a a a a a a
(
+ + +
(
(
+ + +
(
(
+ + +
(


Notice that both A A and AA are symmetric. Since A is not square, these products are of different
orders, but their traces (defined below) are equal.
The trace of a square matrix is defined as the sum of the elements in the principal diagonal.
The trace of AA is denoted by tr(A A) and it is equal to tr(AA). This trace is in fact the sum of the
squares of the elements of A.
2.25
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Notice that if x is a column vector of n elements, then x is a row vector of n elements and:
xx =
2
1
n
i
i
x
=


and
x x =
2
1 1 2 1
2
2 1 2 2
2
1 2
. .
. .
. .
n
n
n n n
x x x x x
x x x x x


x x x x x
(
(
(
(
(
(
(
(
(
(


5.4 Theorems about transposed matrices
(A) = A
(A + B) = A + B
(A B) = BA
and
(A B C) = CBA
Proof:
(A B C) = [(A B)C] = C (A B) = CBA
The following examples illustrate some simple operations with matrices.
The set of n simultaneous equations with n unknowns (x
1
, x
2
, , x
n
)
11 1 12 2 1 1
21 1 22 2 2 2
1 1 2 2
...
...
.
.
.
...
n n
n n
n n nn n n
a x a x a x h
a x a x a x h
a x a x a x h
+ + + =
+ + + =
+ + + =

may be written
A x = h
where:
A = [a
ij
] is the matrix of coefficients of order n n
x = the column vector of n elements of unknowns, where x = [x
1
, x
2
, , x
n
]
h = the column vector of n elements of constants, where h = [h
1
, h
2
, , h
n
].
The product of the matrix A and the vector x gives a column vector of n elements h.
The first element in the vector A x is a
11
x
1
+ a
12
x
2
+ + a
1n
x
n
which is equated to h
1
and similarly
for the other n 1 elements, giving n simultaneous equations in all.
2.26
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
The quadratic form xAx is a very important function in statistics and financial applications. For the
general case where A is a symmetric matrix of order n n and x is a column vector of n elements:
2 2
11 1 12 1 2 1 1 22 2 23 2 3 2 2
2
' 2 ... 2 2 ... 2
...
n n n n
nn n
x A x a x a x x a x x a x a x x a x x
a x
= + + + + + + +
+ +

For example, for n = 2:
A =
11 12
21 22
a a
a a
(
(
(

x =
1
2
x
x
(
(
(


xA x = | |
11 12 1
1 2
21 22 2
a a x
x x
a a x
( (
( (
( (


=
2 2
11 1 12 1 2 21 2 1 22 2
a x a x x a x x a x + + +
=
2 2
11 1 12 1 2 22 2
2 a x a x x a x + +
This is because when A is symmetric, a
12
= a
21
for n = 3:
A =
11 12 13
21 22 23
31 32 33
a a a
a a a
a a a
(
(
(
(
(

x =
1
2
3
x
x
x
(
(
(
(
(


xA x
=
2 2 2
11 1 22 2 33 3 12 1 2 13 1 3 23 2 3
2 2 2 a x a x a x a x x a x x a x x + + + + +
For example, the quadratic form:
2 2 2
1 2 3 1 2 2 3
3 5 2 8 x x x x x x x + +
implies that A =
1 1 0
1 3 4
0 4 5



(
(
(
(
(


since the coefficients of the terms
2
i
x appear on the principal diagonal of A and the symmetric
off-diagonal terms are one-half the coefficients of the cross product terms.
5.5 MMULT and TRANSPOSE
Excel includes a number of useful functions that make it easier and quicker to perform matrix
operations on array functions, including the following:
MMULT returns the matrix product of two arrays. The result is an array with the same number
of rows as the first array and the same number of columns as the second array.
TRANSPOSE returns a vertical range of cells as a horizontal range, or vice versa.
2.27
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
To use MMULT:
1. Highlight the cells where you expect the matrix answer to appear.
Note: A 2x2 matrix needs 4 cells highlighted in a square. A 5x1 matrix needs 5 cells
highlighted down in the same column. Similarly a 1x5 matrix need 5 cells highlighted across in
the same row. You must mentally figure out how many cells to highlight for the answer before
proceeding. If you only highlight one cell, you only get part of the resulting matrix. You can
highlight more cells than needed for your resulting matrix but some of the cells would be
blanks.
2. Press F2.
3. Press Ctrl + Shift + Enter.
Apply your knowledge 2: Excel array functions
Use Excels Help function to familiarise yourself with the MMULT and TRANSPOSE
functions.
Apply your knowledge 3: Matrix algebra
1. Given
A =
1 0 3
2 1 1


(
(
(


B =
3 4 1
0 1 5
1 2 2



(
(
(
(
(


C =
2
1
4


(
(
(
(
(


Calculate (A B), BA, (A C), and CA.
2. If
V =
0 1 0
0 0 1
0 0 0



(
(
(
(
(


find V
2
and V
3
.
3. Given
A =
1 3 2
2 6 9
7 6 1



(
(
(
(
(

and
E =
0 1 0
1 0 0
0 0 1



(
(
(
(
(


Calculate A , E and B where B = E A.
Verify that B = E A .
2.28
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
Suggested answers
Apply your knowledge 1: What if analysis
Please note that no solution is provided.
Apply your knowledge 2: Excel array functions
Please note that no solution is provided.
Apply your knowledge 3: Matrix algebra
1. A B =
1 0 3 3 4 1
0 1 5
2 1 1 1 2 2


( (
( (
( (


which multiplies out to become another 2 by 3 matrix with elements equal to:
3 4 1
(1 0 3) 0 , (1 0 3) 1 , (1 0 3) 5
1 2 2
3 4 1
( 2 1 1) 0 , ( 2 1 1) 1 , ( 2 1 1) 5
1 2 2
( ( (
| | | | | |
( ( ( | | |
| | |
( ( (
\ . \ . \ .

( ( (
| | | | | |
( ( ( | | |
| | |
( ( (
\ . \ . \ .


or
[(1)(3)+(0)(0)+(3)(1)],[(1)(4)+(0)(1)+(3)(2)],[(1)(1)+(0)(5)+(3)(2)]
[(2)(3)+( 1)(0)+(1)(1)],[(2)(4)+(1)(1)+(1)(2)],[(2)(1)+(1)(5)+(1)(2)]
That is, the matrix:
A B =
6 10 5
7 11 5


(
(
(


and whose transpose is
(A B) =
6 7
10 11
5 5



(
(
(
(
(


B =
3 0 1
4 1 2
1 5 2
| |
|
|

\ .
, A =
1 2
0 1
3



(
(
(
(
(

1

BA =
3 0 3 6 0 1
4 0 6 8 1 2
1 0 6 2 5 2



+ + + + (
(
+ + + + (
(
( +




=
6 7
10 11
5 5



(
(
(
(
(


which is equal to (A B).
2.29
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
A C =
1 0 3
2 1 1


(
(
(

2
1
4


(
(
(
(
(

=
2 0 12
4 1 4


+ + (
(
+ + (

=
14
9
(
(
(


(A C) = [14 9]
C = [2 1 4]
C A = | |
1 2
2 1 4 0 1 [ 2 0 12 4 1 4] [14 9]
3



(
(
= + + + + = (
(
(

1

which is equal to (A C)
2. If:
V =
0 1 0
0 0 1
0 0 0



(
(
(
(
(


V
2
= V V =
0 1 0
0 0 1
0 0 0



(
(
(
(
(

0 1 0
0 0 1
0 0 0



(
(
(
(
(

=
0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0



+ + + + + + (
(
+ + + + + + (
(
( + + + + + +





=
0 0 1
0 0 0
0 0 0



(
(
(
(
(


V
3
= V
2
V =
0 0 1
0 0 0
0 0 0



(
(
(
(
(

0 1 0
0 0 1
0 0 0



(
(
(
(
(

=
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0



+ + + + + + (
(
+ + + + + + (
(
( + + + + + +





=
0 0 0
0 0 0
0 0 0



(
(
(
(
(


2.30
Quantitative Applications in Finance | FIN236.SM1.8 Kaplan Higher Education
3. |A| = det
1 3 2
2 6 9
7 6 1



(
(
(
(
(


Expanding along the first row, we have
|A| =
6 9 2 9 2 6
1 3 2
6 1 7 1 7 6
+
= 1(6 1) (6 9) 3(2 1) (7 9) + 2(2 6) (7 6)) = 75
|E| = det
0 1 0
0 0 1 0 1 0
1 0 0 0 1 0
0 1 0 1 0 1
0 0 1



(
(
= + (
(
(

= 0 1 + 0 = 1
B = E A =
0 1 0 1 3 2 2 6 9
1 0 0 2 6 9 1 3 2
0 0 1 7 6 1 7 6 1



( ( (
( ( (
= ( ( (
( ( (
( ( (


|B| = det
2 6 9
3 2 1 2 1 3
1 3 2 2 6 9
6 1 7 1 7 6
7 6 1



(
(
= + (
(
(


= 2(3 12) 6(1 14) + 9(6 21) = 75
Now, |E||A| = (1)(75) = 75 = |B|

You might also like