Introduction to Computational Finance and Financial Econometrics Matrix Algebra Review

Similar documents
Econ 424 Review of Matrix Algebra

Introduction to Computational Finance and Financial Econometrics Probability Review - Part 2

Introduction to Computational Finance and Financial Econometrics Probability Theory Review: Part 2

Basic Concepts in Matrix Algebra

Covariance. Lecture 20: Covariance / Correlation & General Bivariate Normal. Covariance, cont. Properties of Covariance

Chapter 5 continued. Chapter 5 sections

Linear Algebra Review

7.5 Operations with Matrices. Copyright Cengage Learning. All rights reserved.

Multivariate Gaussian Distribution. Auxiliary notes for Time Series Analysis SF2943. Spring 2013

Introduction to Normal Distribution

UCSD ECE153 Handout #34 Prof. Young-Han Kim Tuesday, May 27, Solutions to Homework Set #6 (Prepared by TA Fatemeh Arbabjolfaei)

2. Matrix Algebra and Random Vectors

Joint Distributions. (a) Scalar multiplication: k = c d. (b) Product of two matrices: c d. (c) The transpose of a matrix:

[POLS 8500] Review of Linear Algebra, Probability and Information Theory

A Probability Review

Continuous Random Variables

Notes on Random Vectors and Multivariate Normal

Let X and Y denote two random variables. The joint distribution of these random

7.6 The Inverse of a Square Matrix

. a m1 a mn. a 1 a 2 a = a n

Exam 2. Jeremy Morris. March 23, 2006

x. Figure 1: Examples of univariate Gaussian pdfs N (x; µ, σ 2 ).

MA/ST 810 Mathematical-Statistical Modeling and Analysis of Complex Systems

Multivariate Distributions

Elements of Probability Theory

Lecture Notes on the Gaussian Distribution

TAMS39 Lecture 2 Multivariate normal distribution

EEL 5544 Noise in Linear Systems Lecture 30. X (s) = E [ e sx] f X (x)e sx dx. Moments can be found from the Laplace transform as

Math 4377/6308 Advanced Linear Algebra

Chapter 1 Vector Spaces

Bivariate distributions

18 Bivariate normal distribution I

Elementary maths for GMT

Introduction to Probability and Stocastic Processes - Part I

Multiple Random Variables

Joint Gaussian Graphical Model Review Series I

matrix-free Elements of Probability Theory 1 Random Variables and Distributions Contents Elements of Probability Theory 2

Today. Probability and Statistics. Linear Algebra. Calculus. Naïve Bayes Classification. Matrix Multiplication Matrix Inversion

Finite Mathematics Chapter 2. where a, b, c, d, h, and k are real numbers and neither a and b nor c and d are both zero.

MSc Quantitative Techniques Mathematics Weeks 1 and 2

Principal Components Theory Notes

Multivariate Random Variable

Math 313 Chapter 1 Review

3. Probability and Statistics

ECE 541 Stochastic Signals and Systems Problem Set 9 Solutions

Lecture 11. Multivariate Normal theory

MATH2210 Notebook 2 Spring 2018

Math 4377/6308 Advanced Linear Algebra

Matrix Algebra Determinant, Inverse matrix. Matrices. A. Fabretti. Mathematics 2 A.Y. 2015/2016. A. Fabretti Matrices

Phys 201. Matrices and Determinants

MSc Quantitative Techniques Mathematics Weeks 1 and 2

Two hours. Statistical Tables to be provided THE UNIVERSITY OF MANCHESTER. 14 January :45 11:45

Statistics, Data Analysis, and Simulation SS 2015

I L L I N O I S UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN

Matrix operations Linear Algebra with Computer Science Application

Notes on Random Variables, Expectations, Probability Densities, and Martingales

Machine Learning for Large-Scale Data Analysis and Decision Making A. Week #1

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0.

ECON 3150/4150, Spring term Lecture 6

Matrix Arithmetic. j=1

CS100: DISCRETE STRUCTURES. Lecture 3 Matrices Ch 3 Pages:

STT 843 Key to Homework 1 Spring 2018

MATRICES. a m,1 a m,n A =

18.440: Lecture 26 Conditional expectation

The Multivariate Normal Distribution. In this case according to our theorem

COMPUTING AND DATA ANALYSIS WITH EXCEL. Matrix manipulation and systems of linear equations

STA 256: Statistics and Probability I

10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections )

MATH 323 Linear Algebra Lecture 6: Matrix algebra (continued). Determinants.

Statistics STAT:5100 (22S:193), Fall Sample Final Exam B

More than one variable

MA 575 Linear Models: Cedric E. Ginestet, Boston University Revision: Probability and Linear Algebra Week 1, Lecture 2

Topic 7 - Matrix Approach to Simple Linear Regression. Outline. Matrix. Matrix. Review of Matrices. Regression model in matrix form

Random Variables and Their Distributions

Chapter 5. Chapter 5 sections

Statistical Pattern Recognition

Delta Method. Example : Method of Moments for Exponential Distribution. f(x; λ) = λe λx I(x > 0)

This exam is closed book and closed notes. (You will have access to a copy of the Table of Common Distributions given in the back of the text.

Lecture 2: Review of Probability

MATH Topics in Applied Mathematics Lecture 12: Evaluation of determinants. Cross product.

Introduction Eigen Values and Eigen Vectors An Application Matrix Calculus Optimal Portfolio. Portfolios. Christopher Ting.

Review of Vectors and Matrices

Section 8.1. Vector Notation

MAS223 Statistical Inference and Modelling Exercises

Random Vectors, Random Matrices, and Matrix Expected Value

SIMG-713 Homework 5 Solutions

7.3. Determinants. Introduction. Prerequisites. Learning Outcomes

1: PROBABILITY REVIEW

Random Variables. Random variables. A numerically valued map X of an outcome ω from a sample space Ω to the real line R

Math 3191 Applied Linear Algebra

The Multivariate Gaussian Distribution

TOPIC III LINEAR ALGEBRA

Political Science 6000: Beginnings and Mini Math Boot Camp

Joint Probability Distributions and Random Samples (Devore Chapter Five)

UC Berkeley Department of Electrical Engineering and Computer Science. EE 126: Probablity and Random Processes. Problem Set 8 Fall 2007

Linear Algebra and Matrix Inversion

The word Matrices is the plural of the word Matrix. A matrix is a rectangular arrangement (or array) of numbers called elements.

Matrices Gaussian elimination Determinants. Graphics 2009/2010, period 1. Lecture 4: matrices

MAC Module 2 Systems of Linear Equations and Matrices II. Learning Objectives. Upon completing this module, you should be able to :

P (x). all other X j =x j. If X is a continuous random vector (see p.172), then the marginal distributions of X i are: f(x)dx 1 dx n

Transcription:

You can t see this text! Introduction to Computational Finance and Financial Econometrics Matrix Algebra Review Eric Zivot Spring 2015 Eric Zivot (Copyright 2015) Matrix Algebra Review 1 / 54

Outline 1 Matrices and Vectors Basic Matrix Operations Addition and subtraction Scalar multiplication Matrix multiplication The Identity Matrix Matrix inverse Systems of linear equations Representing summation using matrix notation Portfolio math with matrix algebra Bivariate normal distribution Derivatives of simple matrix functions Eric Zivot (Copyright 2015) Matrix Algebra Review 2 / 54

Matrices and vectors Matrix A = (n m) a 11 a 12 a 1m a 21 a 22 a 2m...... a n1 a n2 a nm Vector Square matrix : n = m x = (n 1) x 1 x 2 n = # of rows, m = # of columns. x n Eric Zivot (Copyright 2015) Matrix Algebra Review 3 / 54

Remarks R is a matrix oriented programming language Excel can handle matrices and vectors in formulas and some functions Excel has special functions for working with matrices. There are called array functions. Must use: <ctrl>-<shift>-<enter> to evaluate array function Eric Zivot (Copyright 2015) Matrix Algebra Review 4 / 54

Transpose of a Matrix Interchange rows and columns of a matrix: A = transpose of A (m n) (n m) Example, A = x = 1 2 3 4 5 6 1 2 3, x =, A = 1 2 3 1 4 2 5 3 6 Eric Zivot (Copyright 2015) Matrix Algebra Review 5 / 54

Computational tools R function t(a) Excel function TRANSPOSE(matrix) <ctrl>-<shift>-<enter> Eric Zivot (Copyright 2015) Matrix Algebra Review 6 / 54

Symmetric Matrix A square matrix A is symmetric if: A = A Example, 1 2 A = 2 1, A = 1 2 2 1 Remark: Covariance and correlation matrices are symmetric. Eric Zivot (Copyright 2015) Matrix Algebra Review 7 / 54

Outline 1 Matrices and Vectors Basic Matrix Operations Addition and subtraction Scalar multiplication Matrix multiplication The Identity Matrix Matrix inverse Systems of linear equations Representing summation using matrix notation Portfolio math with matrix algebra Bivariate normal distribution Derivatives of simple matrix functions Eric Zivot (Copyright 2015) Matrix Algebra Review 8 / 54

Addition and Subtraction (element-by-element) 4 9 2 1 4 9 2 1 + 2 0 0 7 2 0 0 7 = = = = 4 + 2 9 + 0 2 + 0 1 + 7 6 9 2 8 4 2 9 0 2 0 1 7 2 9 2 6 Eric Zivot (Copyright 2015) Matrix Algebra Review 9 / 54

Scalar Multiplication (element-by-element) c = 2 = scalar A = 2 A = 3 1 0 5 2 3 2 ( 1) 2 0 2 5 = 6 2 0 10 Eric Zivot (Copyright 2015) Matrix Algebra Review 10 / 54

Matrix Multiplication (not element-by-element) A = (3 2) a 11 a 12 a 21 a 22 a 31 a 32, B = (2 3) b11 b 12 b 13 b 21 b 22 b 23 Note: A and B are comformable matrices: # of columns in A = # of rows in B: A B (3 2) (2 3) = a 11 b 11 + a 12 b 21 a 11 b 12 + a 12 b 22 a 11 b 13 + a 12 b 23 a 21 b 11 + a 22 b 21 a 21 b 12 + a 22 b 22 a 21 b 13 + a 22 b 23 a 31 b 11 + a 32 b 21 a 31 b 12 + a 32 b 22 a 31 b 13 + a 32 b 23 Remark: In general, A B B A Eric Zivot (Copyright 2015) Matrix Algebra Review 11 / 54

Example A = A B = R operator A%*%B Excel function 1 2 3 4, B = 5 6 7 8 5 + 14 6 + 16 15 + 28 18 + 32 MMULT(matrix1, matrix2) <ctrl>-<shift>-<enter> = 19 22 43 50 Eric Zivot (Copyright 2015) Matrix Algebra Review 12 / 54

Identity Matrix The n dimensional identity matrix has all diagonal elements equal to 1, and all off diagonal elements equal to 0. Example, 1 0 I 2 = 0 1 Remark: The identity matrix plays the roll of 1 in matrix algebra, 1 0 a11 a 12 I 2 A = 0 1 a 21 a 22 = = A a11 + 0 a 12 + 0 0 + a 21 0 + a 22 = a11 a 12 a 21 a 22 Eric Zivot (Copyright 2015) Matrix Algebra Review 13 / 54

Identity Matrix cont. Similarly, a11 a 12 A I 2 = a 21 a 22 a11 a 12 = a 21 a 22 1 0 0 1 = A R function diag(n) creates n dimensional identity matrix. Eric Zivot (Copyright 2015) Matrix Algebra Review 14 / 54

Matrix Inverse Let A (n n) = square matrix. A 1 = inverse of A satisfies: A 1 A=I n AA 1 =I n Remark: A 1 is similar to the inverse of a number: a = 2, a 1 = 1 2 a a 1 = 2 1 2 = 1 a 1 a = 1 2 2 = 1 Eric Zivot (Copyright 2015) Matrix Algebra Review 15 / 54

Computational tools R function solve(a) Excel function MINVERSE(matrix) <ctrl>-<shift>-<enter> Eric Zivot (Copyright 2015) Matrix Algebra Review 16 / 54

Representing Systems of Linear Equations Using Matrix Algebra Consider the system of two linear equations x + y = 1 2x y = 1 The equations represent two straight lines which intersect at the point: x = 2 3, y = 1 3 Eric Zivot (Copyright 2015) Matrix Algebra Review 17 / 54

Representing Systems of Linear Equations Using Matrix Algebra cont. Matrix algebra representation: 1 1 x 1 = 2 1 y 1 or, A z = b where, A = 1 1 2 1, z = x y and b = 1 1. Eric Zivot (Copyright 2015) Matrix Algebra Review 18 / 54

Representing Systems of Linear Equations Using Matrix Algebra cont. We can solve for z by multiplying both sides by A 1 : A 1 A z = A 1 b = I z = A 1 b = z = A 1 b or, x y = 1 1 2 1 1 1 1 Remark: As long as we can determine the elements in A 1, we can solve for the values of x and y in the vector z. Since the system of linear equations has a solution as long as the two lines intersect, we can determine the elements in A 1 provided the two lines are not parallel. Eric Zivot (Copyright 2015) Matrix Algebra Review 19 / 54

Matrix Inverse (2 2 case) There are general numerical algorithms for finding the elements of A 1 and programs like Excel and R have these algorithms available. However, if A is a (2 2) matrix then there is a simple formula for A 1. Let, a11 a 12 A =. a 21 a 22 Then, where, A 1 = 1 a22 a 12 det(a) a 21 a 11 det(a) = a 11 a 22 a 21 a 12 0. Eric Zivot (Copyright 2015) Matrix Algebra Review 20 / 54

Matrix Inverse (2 2 case) cont. Let s apply the above rule to find the inverse of A in our example: A 1 1 1 1 1 1 = = 3 3. 1 2 2 1 2 3 1 3 Notice that, A 1 A = 1 3 2 3 1 3 1 3 1 1 2 1 = 1 0 0 1. Eric Zivot (Copyright 2015) Matrix Algebra Review 21 / 54

Matrix Inverse (2 2 case) cont. Our solution for z is then, z = A 1 b = = 1 1 3 3 2 1 3 3 2 3 1 = 3 1 1 x y so that x = 2 3 and y = 1 3. Eric Zivot (Copyright 2015) Matrix Algebra Review 22 / 54

Representing Systems of Linear Equations Using Matrix Algebra cont. In general, if we have n linear equations in n unknown variables we may write the system of equations as: a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2. =. a n1 x 1 + a n2 x 2 + + a nn x n = b n which we may then express in matrix form as: a 11 a 12 a 1n b 1 a 21 a 22 a 2n x 1 x 2... = b 2. a n1 a n2 a nn x n Eric Zivot (Copyright 2015) Matrix Algebra Review 23 / 54 b n

Representing Systems of Linear Equations Using Matrix Algebra cont. or, A (n n) x = (n 1) b. (n 1) The solution to the system of equations is given by: x = A 1 b where A 1 A = I and I is the (n n) identity matrix. If the number of equations is greater than two, then we generally use numerical algorithms to find the elements in A 1. Eric Zivot (Copyright 2015) Matrix Algebra Review 24 / 54

Outline 1 Matrices and Vectors Basic Matrix Operations Addition and subtraction Scalar multiplication Matrix multiplication The Identity Matrix Matrix inverse Systems of linear equations Representing summation using matrix notation Portfolio math with matrix algebra Bivariate normal distribution Derivatives of simple matrix functions Eric Zivot (Copyright 2015) Matrix Algebra Review 25 / 54

Representing Summation Using Matrix Notation n x i = x 1 + x 2 + + x n i=1 x = (n 1) x 1 x 2., 1 = (n 1) x n 1 1. 1 Eric Zivot (Copyright 2015) Matrix Algebra Review 26 / 54

Representing Summation Using Matrix Notation cont. Then, ( x 1 = ) x 1 x 2 x n 1 1. 1 n = x 1 + x 2 + + x n = x i i=1 Eric Zivot (Copyright 2015) Matrix Algebra Review 27 / 54

Representing Summation Using Matrix Notation cont. Equivalently, ( 1 x = 1 1 1 x 1 x 2 ). x n n = x 1 + x 2 + + x n = x i i=1 Eric Zivot (Copyright 2015) Matrix Algebra Review 28 / 54

Representing Summation Using Matrix Notation cont. Sum of Squares: n x 2 i = x 2 1 + x 2 2 + + x 2 n i=1 ( ) x x = x 1 x 2 x n x 1 x 2. x n n = x 2 1 + x 2 2 + + x 2 n = x 2 i i=1 Eric Zivot (Copyright 2015) Matrix Algebra Review 29 / 54

Representing Summation Using Matrix Notation cont. Sums of cross products: n x i y i = x 1 y 1 + x 2 y 2 + + x n y n i=1 ( ) x y = x 1 x 2 x n y 1 y 2. y n n = x 1 y 1 + x 2 y 2 + + x n y n = x i y i i=1 = y x Eric Zivot (Copyright 2015) Matrix Algebra Review 30 / 54

Computational tools R function t(x)%*%y, t(y)%*%x crossprod(x,y) Excel function MMULT(TRANSPOSE(x),y) MMULT(TRANSPOSE(y),x) <ctrl>-<shift>-<enter> Eric Zivot (Copyright 2015) Matrix Algebra Review 31 / 54

Outline 1 Matrices and Vectors Basic Matrix Operations Addition and subtraction Scalar multiplication Matrix multiplication The Identity Matrix Matrix inverse Systems of linear equations Representing summation using matrix notation Portfolio math with matrix algebra Bivariate normal distribution Derivatives of simple matrix functions Eric Zivot (Copyright 2015) Matrix Algebra Review 32 / 54

Portfolio Math with Matrix Algebra Three Risky Asset Example: Let R i denote the return on asset i = A, B, C and assume that R A, R B and R C are jointly normally distributed with means, variances and covariances: µ i = ER i, σ 2 i = var(r i ), cov(r i, R j ) = σ ij Portfolio x : x i = share of wealth in asset i x A + x B + x C = 1 Portfolio return: R p,x = x A R A + x B R B + x C R C. Eric Zivot (Copyright 2015) Matrix Algebra Review 33 / 54

Portfolio Math with Matrix Algebra cont. Portfolio expected return: µ p,x = ER p,x = x A µ A + x B µ B + x C µ C Portfolio variance: σ 2 p,x = var(r p,x ) = x 2 Aσ 2 A + x 2 Bσ 2 B + x 2 Cσ 2 C + 2x A x B σ AB + 2x A x C σ AC + 2x B x C σ BC Portfolio distribution: R p,x N(µ p,x, σ 2 p,x) Eric Zivot (Copyright 2015) Matrix Algebra Review 34 / 54

Portfolio Math with Matrix Algebra cont. Matrix algebra representation: R A µ A R = R B, µ = µ B R C µ C x = x A x B x C, Σ = Portfolio weights sum to 1: x 1 = x A x B x C ) = x A + x B + x C = 1, 1 = 1 1 1 σa 2 σ AB σ AC σ AB σb 2 σ BC σ AC σ BC σc 2 1 1 1 Eric Zivot (Copyright 2015) Matrix Algebra Review 35 / 54

Digression on Covariance Matrix Using matrix algebra, the variance-covariance matrix of the N 1 return vector R is defined as: var(r) N N = cov(r) = E(R µ)(r µ) = Σ Because R has N elements, Σ is the N N matrix: σ 2 1 σ 12 σ 1n σ 12 σ 2 2 σ 2n Σ =...... σ 1n σ 2n σn 2 Eric Zivot (Copyright 2015) Matrix Algebra Review 36 / 54

Digression on Covariance Matrix cont. For the case N = 2, we have: ( ) E(R µ) (R µ ) R1 µ 1 = E (R 1 µ 1, R 2 µ 2 ) 2 1 1 2 R 2 µ 2 = E = = ( (R1 µ 1 ) 2 (R 1 µ 1 )(R 2 µ 2 ) (R 2 µ 2 )(R 1 µ 1 ) (R 2 µ 2 ) 2 ( E(R1 µ 1 ) 2 E(R 1 µ 1 )(R 2 µ 2 ) E(R 2 µ 2 )(R 1 µ 1 ) E(R 2 µ 2 ) 2 ( var(r1 ) cov(r 1, R 2 ) cov(r 2, R 1 ) var(r 2 ) ) = ( σ 2 1 σ 12 σ 12 σ 2 2 ) ) ) = Σ. Eric Zivot (Copyright 2015) Matrix Algebra Review 37 / 54

Portfolio Math with Matrix Algebra cont. Portfolio return: R p,x = x R = ( x A x B x C ) = x A R A + x B R B + x C R C = R x Portfolio expected return: µ p,x = x µ = ( x A x B x X ) = x A µ A + x B µ B + x C µ C = µ x R A R B R C Eric Zivot (Copyright 2015) Matrix Algebra Review 38 / 54 µ A µ B µ C

Computational tools Excel formula MMULT(transpose(xvec),muvec) <ctrl>-<shift>-<enter> R formula crossprod(x,mu) t(x)%*%mu Eric Zivot (Copyright 2015) Matrix Algebra Review 39 / 54

Portfolio Math with Matrix Algebra cont. Portfolio variance: σ 2 p,x = var(x R) = E ( x R x µ ) 2 = E ( x (R µ) ) 2 = Ex (R µ)x (R µ) = Ex (R µ)(r µ) x = = x E(R µ)(r µ) x = x Σx = ( x A x B x C ) σa 2 σ AB σ AC σ AB σb 2 σ BC σ AC σ BC σc 2 x A x B x C = x 2 Aσ 2 A + x 2 Bσ 2 B + x 2 Cσ 2 C + 2x A x B σ AB + 2x A x C σ AC + 2x B x C σ BC Eric Zivot (Copyright 2015) Matrix Algebra Review 40 / 54

Computational tools Excel formulas MMULT(TRANSPOSE(xvec),MMULT(sigma,xvec)) MMULT(MMULT(TRANSPOSE(xvec),sigma),xvec) <ctrl>-<shift>-<enter> Note: x Σx = (x Σ) x = x (Σx) R formulas t(x)%*%sigma%*%x Portfolio distribution R p,x N(µ p,x, σp,x) 2 Eric Zivot (Copyright 2015) Matrix Algebra Review 41 / 54

Covariance Between 2 Portfolio Returns 2 portfolios: x = x A x B x C, y = x 1 = 1, y 1 = 1 Portfolio returns: R p,x = x R R p,y = y R Covariance: cov(r p,x, R p,y ) = x Σy = y Σx y A y B y C Eric Zivot (Copyright 2015) Matrix Algebra Review 42 / 54

Covariance Between 2 Portfolio Returns cont. Derivation: cov(r p,x, R p,y ) = cov(x R, y R) = E(x R x µ)(y R y µ) = Ex (R µ)y (R µ) = Ex (R µ)(r µ) y = x E(R µ)(r µ) y = x Σy Eric Zivot (Copyright 2015) Matrix Algebra Review 43 / 54

Computational tools Excel formula MMULT(TRANSPOSE(xvec),MMULT(sigma,yvec)) MMULT(TRANSPOSE(yvec),MMULT(sigma,xvec)) <ctrl>-<shift>-<enter> R formula t(x)%*%sigma%*%y Eric Zivot (Copyright 2015) Matrix Algebra Review 44 / 54

Outline 1 Matrices and Vectors Basic Matrix Operations Addition and subtraction Scalar multiplication Matrix multiplication The Identity Matrix Matrix inverse Systems of linear equations Representing summation using matrix notation Portfolio math with matrix algebra Bivariate normal distribution Derivatives of simple matrix functions Eric Zivot (Copyright 2015) Matrix Algebra Review 45 / 54

Bivariate Normal Distribution Let X and Y be distributed bivariate normal. The joint pdf is given by: 1 f(x, y) = 2πσ X σ Y 1 ρ 2 XY { (x ) 1 2 ( ) µx y 2 µy exp 2(1 ρ 2 XY ) + 2ρ XY (x µ X )(y µ σ X σ Y σ X σ Y where EX = µ X, EY = µ Y, sd(x) = σ X, sd(y ) = σ Y, and ρ XY = cor(x, Y ). Eric Zivot (Copyright 2015) Matrix Algebra Review 46 / 54

Bivariate Normal Distribution Let X and Y be distributed bivariate normal. The joint pdf is given by: f(x, y) = 1 2πσ X σ Y 1 ρ 2 XY { ( ) 1 exp x µx 2 ( ) } 2(1 ρ 2 XY ) σ X + y µy 2 σ Y 2ρ XY (x µ X )(y µ Y ) σ X σ Y where EX = µ X, EY = µ Y, sd(x) = σ X, sd(y ) = σ Y, and ρ XY = cor(x, Y ). Eric Zivot (Copyright 2015) Matrix Algebra Review 47 / 54

Bivariate Normal Distribution cont. Define X = ( X Y ), x = ( x y ), µ = ( µx µ Y ) ( σ 2, Σ = X σ XY σ XY σy 2 ) Then the bivariate normal distribution can be compactly expressed as: where, f(x) = 1 2π det(σ) 1/2 e 1 2 (x µ) Σ 1 (x µ) det(σ) = σ 2 Xσ 2 Y σ 2 XY = σ 2 Xσ 2 Y σ 2 Xσ 2 Y ρ 2 XY = σ 2 Xσ 2 Y (1 ρ 2 XY ). We use the shorthand notation: X N(µ, Σ) Eric Zivot (Copyright 2015) Matrix Algebra Review 48 / 54

Outline 1 Matrices and Vectors Basic Matrix Operations Addition and subtraction Scalar multiplication Matrix multiplication The Identity Matrix Matrix inverse Systems of linear equations Representing summation using matrix notation Portfolio math with matrix algebra Bivariate normal distribution Derivatives of simple matrix functions Eric Zivot (Copyright 2015) Matrix Algebra Review 49 / 54

Derivatives of Simple Matrix Functions Result: Let A be an n n symmetric matrix, and let x and y be an n 1 vectors. Then, x x y = x Ax= x x Ax = x 1 x y. x n x y x 1 (Ax). x n (Ax) x 1 x Ax. x n x Ax = y, = A, = 2Ax. Eric Zivot (Copyright 2015) Matrix Algebra Review 50 / 54

Example We will demonstrate these results with simple examples. Let, ( ) ( ) ( ) a b x1 y1 A =, x =, y = b c For the first result we have, x y = x 1 y 1 + x 2 y 2. x 2 y 2 Then, x x y = ( x 1 x y x 2 x y ) = ( x 1 (x 1 y 1 + x 2 y 2 ) x 2 (x 1 y 1 + x 2 y 2 ) ) = ( y1 y 2 ) = y. Eric Zivot (Copyright 2015) Matrix Algebra Review 51 / 54

Example cont. Next, consider the second result. Note that, ( ) ( ) ( ) a b x1 ax1 + bx 2 Ax = = b c x 2 bx 1 + cx 2 and, (Ax) = (ax 1 + bx 2, bx 1 + cx 2 ) Then, ( x Ax= x 1 (ax 1 + bx 2, bx 1 + cx 2 ) x 2 (ax 1 + bx 2, bx 1 + cx 2 ) ) ( a b = b c ) = A Eric Zivot (Copyright 2015) Matrix Algebra Review 52 / 54

Example cont. Finally, consider the third result. We have, ( ) ( ) ( ) x a b x1 Ax = x 1 x 2 = ax 2 1 + 2bx 1 x 2 + cx 2 b c 2. x 2 Then, ( ( x x Ax= x 1 ax 2 1 + 2bx 1 x 2 + cx 2 ) ) ( 2 2ax1 + 2bx ( x 2 ax 2 1 + 2bx 1 x 2 + cx 2 ) 2 = 2 2bx 1 + 2cx 2 ( ) ( ) a b x1 = 2 = 2Ax. b c x 2 ) Eric Zivot (Copyright 2015) Matrix Algebra Review 53 / 54

You can t see this text! faculty.washington.edu/ezivot/ Eric Zivot (Copyright 2015) Matrix Algebra Review 54 / 54