Download presentation

Presentation is loading. Please wait.

Published byLawrence Hallas Modified over 2 years ago

1
**Economics Masters Refresher Course in Mathematics**

Lecturer: Jonathan Wadsworth Teaching Assistant: Tanya Wilson Aim: to refresh your maths and statistical skills, to the level needed for success in the Royal Holloway economics masters. Why do we need maths/statistics? to improve your understanding of Economics. As such everything in the course tailored to try to bring out the relevance of the techniques you will (re)learn help the analysis of Economic issues

2
**Economics Masters Refresher Course in Mathematics**

How to do it? Lectures 10-1 and classes 2:30-3:30 each day. In the afternoons and evening you will be expected to: Read the text Do the daily problem set. Prepare to present your answers to the class the next day.

3
Vectors and matrices Learning objectives. By the end of this lecture you should: Understand the concept of vectors and matrices Understand their relationship to economics Understand vector products and the basics of matrix algebra Introduction Often interested in analysing the economic relationship between several variables Use of vectors and matrices can make the analysis of complex linear economic relationships simpler

4
**Lecture 1. Vectors and matrices**

1. Definitions Vectors are a list of numbers or variables – where the order ultimately matters E.g. a list of prices, a list of marks in a course test. (Pricelabour , Pricecapital ) (25, 45, 65, 85) Since this is just a list can store the same information in different ways Can enter the list either horizontally or vertically (25, 45, 65, 85) or

5
Definitions Dimensions of a vector If a set of n numbers is presented horizontally it is called a row vector with dimensions 1 x n (so the number of rows is always the 1st number in a dimension and the number of columns is always the 2nd number) Eg a = (25, 45, 65, 85) is a 1 x 4 row vector If a set of n numbers is presented vertically it is called a column vector with dimensions n x 1 (Note tend to use lower case letters (a b c etc) to name vectors )

6
Definitions Special Types of vector A null vector or zero vector is a vector consisting entirely of zeros e.g. (0 0 0) is a 1 x 3 null row vector A unit vector is a vector consisting entirely of ones denoted by the letter i e.g. is a 4 x 1 unit column vector

7
**More definitions and some rules**

Adding vectors General rule If a = (a1, a an) and b = (b1, b bn) then a+b = (a1+ b1, a2 + b2, an + bn) e.g. (0 2 3 ) + ( 1 0 4) = (0+1, 2+0, 3+4) = (1 2 7) (same rule for addition of column vectors ) Note that the result is a vector with the same dimension 1 x n Note you can only add two vectors if they have the same dimensions e.g. you cannot add (0 2 3) and (0 1) (1 x 3 & 1 x 2) Note also that sometimes adding two vectors may be mathematically ok, but economic nonsense Eg simply adding factor prices together does not give total input price

8
**More definitions and some rules**

Multiplying vectors by a number (a ‘scalar’) Let x = (x1, …,xn) and a be a scalar, then ax = (ax1, ax2,…,axn) e.g. a = 2, x = ( ) ax = (2 4 6)

9
**More on multiplication**

Multiplying vectors In general you cannot multiply two row vectors or two column vectors together Eg a = (1 2) b = (2 3) ? But there are some special cases where you can And you can often multiply a column vector by a row vector and vice versa. We’ll meet them when we do matrices

10
**3. Vector products – a special case of vector multiplication**

Definition: Vector product also known as the dot product or inner product Let x = (x1, x2, …, xn), y = (y1,…,yn). The vector product is written x.y and equals x1y1 + x2y2 + …xnyn. Or Note that vector products are only possible if the vectors have the same dimensions.

11
**3. Vector products – a special case of vector multiplication**

Example. Miki buys two apples and three pears from the Spar shop. Apples cost £0.50 each; pears cost £0.40 each. How much does she spend in total? Answer: This can be seen as an example of a vector product Write the prices as a vector: p=(0.5, 0.4) Write the quantities as a vector q=(2, 3) Total Expenditure (=Price*Quantity) is the sum of expenditures on each good found by multiplying the first element of the first vector by the first element of the second vector and multiplying the second element of the first vector by the second element of the second vector & adding the results Spending = 2x x0.4 = £2.20

12
Instant Quiz What are the dimensions of the following? 2. Can you add the following (if you can, provide the answer)? 3. Find the dot product

13
Geometry Idea: vectors can also be thought of as co-ordinates in a graph. A n x 1 vector can be a point in n –dimensional space E.g. x = (5 3) – which might be a consumption vector C= (x1,x2) x2 5 3 x1 A straight line is drawn out from the origin with definite length and definite direction is called a radius vector

14
Geometry Using this idea can give a geometric interpretation of scalar multiplication of a vector, vector addition or a “linear combination of vectors” Eg If x = (5 3) then 2x = (10 6) and the resulting radius vector will overlap the original but will be twice as long x2 6 5 3 x1 10 Similarly multiplication by a negative scalar will extend a radius vector in the opposite quadrant

15
Geometry Also can think of a vector addition as generating a new radius vector between the 2 original vectors Eg If u = (1 4) and v = (3 2) then u+v = (4, 6) and the resulting radius vector will look like this x2 u+v 6 u 4 1 2 v x1 4 3 Note that this forms a parallelogram with the 2 vectors as two of its sides

16
**Linear combinations depicted**

Given this can depict any linear vector sum (or difference) now called a linear combination geometrically E.g. x = (5 3); y = (2 2) 2x+3y = (16,12) 16 12 3 x 2 5 y 2

17
**Can also think of a geometric representation of vector inner (dot) product**

Remember A geometric representation of this is that the dot product measures how much the 2 vectors lie in the same direction Special Cases If x.y=constant then the radius vectors overlap Eg x=(1 1) y =(2 2) So x.y= (1*2 + 1*2) = 4

18
**Can also think of a geometric representation of vector inner (dot) product**

Remember A geometric representation of this is that the dot product measures how much the 2 vectors lie in the same direction Special Cases If x.y= 0 then the radius vectors are perpendicular (orthogonal) Y=(0,4) Eg x=(5 0) y =(0 4) So x.y= (5*0 + 0*4) = 0 x ┴ y X=(5 0)

19
Will return to these issues when deal with the idea of linear programming (optimising subject to an inequality rather than an equality constraint)

20
Linear dependence A group of vectors are said to be linearly dependent if (and only if) one of them can be expressed as a linear combination of the other If not the vectors are said to be linearly independent Equally linear dependence means that there is a linear combination of them involving non-zero scalars that produces a null vector E.g. are linearly dependent Proof. Because x=2y or x – 2y = 0 But are linearly independent Proof. Suppose x – ay = 0 for some a or other. In other words, Then 2 – a = 0 and also 1 – 3a = 0. So a = 2 and a = 1/3 – a contradiction

21
Linear dependence Generalising, a group of m vectors are said to be linearly dependent if there is a linear combination of (m-1) of the vectors that yields the mth vector Formally, the second definition: Let x1 , x2 , …xm be a set of m nx1 vectors If for some scalars a1, a2, …am-1 a1x1 + a2x2 + … am-1 xm-1 = xm then the group of vectors are linearly dependent, But also a1x1 + a2x2 + … am-1 xm-1 – xm = which is the first definition Summary. To prove linear dependence find a linear combination that produces the null vector. If you try to find such a linear combination but instead find a contradiction then the vectors are linearly independent

22
Quiz II A group of vectors are said to be linearly independent if there is no linear combination of them that produces the null vector are linearly independent. Prove it. 3. What about ?

23
Quiz answers A group of vectors are said to be linearly independent if there is no linear combination of them that produces the null vector are linearly independent. Suppose not, so that 2a + 0 = 0 and a+1 = 0 for some a, then a = 0 and a = -1 – a contradiction. Suppose not then 2a+0 = 0 and 2a+3 = 0 for some a, but then a = 0 and a = -1.5 – a contradiction 3. No… x = y + 2z so x – y – 2z = 0

24
Rank The rank of a group of vectors is the maximum number of them that are linearly independent are linearly independent. So the rank of this group of vectors is 2 are linearly dependent, (2x=y) So the rank is 1 Any two vectors in this group are independent (x=y+2z) so the rank is 2

25
**Vectors: Summary Definitions you should now learn:**

Vector, matrix, null vector, scalar, vector product, linear combination, linear dependence, linear independence, rank 4 skills you should be able to do: Add two nx1 or 1xn vectors Multiply a vector by a scalar and do the inner (dot) product Depict 2 dimensional vectors and their addition in a diagram Find if a group of vectors are linearly dependent or not.

26
**Matrices Introduction**

Recall that matrices are tables where the order of columns and rows matters E.g. marks in a course test for each question and each student Andy Ahmad Anka Qn. 1 44 74 65 Qn. 2 23 56 48 Qn. 3 8 24

27
**Some common types of matrices in applied economics.**

Storing data Input-output Tables Transition matrices. (U = unemployed, E = employed, prob. = probability) US GDP UK GDP PRC GDP 1999 100 80 11 2000 103 82 12 2001 84 13 Per kg iron Per kg coal Kg iron 0.1 0.01 Kg coal 1 Hours labour 0.001 Prob. U in 2011 Prob E in 2011 U in 2010 0.3 0.7 E in 2010 0.1 0.9

28
**Can also derive matrices from economic theory**

Eg consider a simple demand and supply system for a good Supply: Q= P Demand: Q=10-2P Re-arranging Supply: Q – 3P = - 2 Demand: Q +2P = 10 Or in short-hand Ax = b where

29
**In general any system of m equations with n variables (x1, x2,**

In general any system of m equations with n variables (x1, x2, ...xn) Can be written in matrix form Ax = b where

30
Definitions Dimensions of a matrix are always defined by the number of rows followed by the number of columns So is a matrix with m rows and n columns. Example So A is a 2 x 5 matrix (2 rows , 5 columns) B is 5x2 matrix

31
Definitions Can think of vectors as special cases of matrices Hence a row vector is a 1 x n matrix B is a 1 by 3 row vector Similarly a column vector is an n x 1 matrix So C is a 3 x 1 column vector ( note the content is the same as B. This means that you can store the same information in different ways)

32
Definitions Sometimes we wish to refer to individual elements in a matrix E.g. the number in the third row, second column. We use the notation aij (or bij etc.) to indicate the appropriate element i refers to the row j refers to the column Example So a13 = 3 and a21 = 7 If What is b21 ?

33
Definitions The null matrix or zero matrix is a matrix consisting entirely of zeros A square matrix is one where the number of rows equals the number of columns i.e. nxn Eg. For a square matrix, the main (or leading) diagonal is all the elements aij where i = j So in the above the main diagonal is (2 1)

34
Definitions The identity matrix is a square matrix consisting of zeros except for the leading diagonal which consists of 1s: We write I for the identity matrix If we wish to identify its size (number of rows or columns) we write In

35
Definitions A diagonal matrix is a square matrix with aik = 0 whenever i ≠ k And so consists of zeros everywhere except for the main diagonal which consists of non-zero numbers (so the identity matrix is a special case of a diagonal matrix since it has just ones along the main diagonal)

36
Trace of a matrix is the sum of the elements on the main (leading) diagonal of any square matrix So tr(A) = = -4

37
Mini quiz What are the dimensions of A? What is a21? Is B a square matrix? What is the largest element on the main diagonal of B? What is the value of the largest element on the main diagonal of B?

38
More Definitions The transpose of a matrix A is obtained by by turning rows into columns and vice versa swapping aij for aji for all i and j We write the transpose as A’ or AT ( A “prime”) A symmetric matrix is one where A’ = A A positive matrix is one where all of the elements are strictly positive A non-negative matrix is one where all of the elements are either positive or zero

39
**Useful Properties of Transposes**

(A’)’ = A The transpose of a transpose is the original matrix 2. (A + B)’ = A’ + B’ The transpose of a sum is the sum of the transposes 3. (AB)’ = B’A’ The transpose of a product is the product of the transposes in reverse order Eg. Given Find (AB)’ and B’A’

40
More Definitions A negative matrix is one where none of the elements are positive A strictly negative matrix is one where all of the elements are strictly negative C is strictly positive and symmetric; B is negative; A is neither positive nor negative.

41
Some rules Adding matrices add each element from the corresponding place in the matrices. i.e. if A and B are m x n matrices, then A+B is the m x n matrix where cij= aij+bij for i = 1,..,m and j = 1,…,n. You can only add two matrices if they have the same dimensions. e.g. you cannot add A and B

42
**Matrix Multiplication**

Multiplying by a scalar When you multiply by a scalar (e.g. 3, 23.1 or -2), then you multiply each element of the matrix by that scalar Example 1: what is 4A if Example 2: what is xB if

43
**Matrix Multiplication**

In general multiplication of 2 or more matrices has some special rules The first rule is that the order of multiplication matters. In general AxB (or AB) is not the same as BA (so this is very different to multiplying numbers where the order doesn’t matter – e.g. 3x4 = 4x3 = 12 ) Asides: Addition, multiplication, matrix multiplication etc. are examples of operators An operator is said to be commutative if x operator y = y operator x for any x and y (the order of multiplication does not matter) Addition is commutative: x+y = y+x; multiplication is commutative; subtraction is not commutative (2-1 ≠ 1-2) Matrix multiplication is commutative but matrix multiplication is not

44
**Multiplying two matrices**

2. The second rule is that you can only multiply two matrices if they are conformable Two matrices are conformable if the number of columns for the first matrix is the same as the number of rows for the second matrix If the matrices are not conformable they cannot be multiplied. Example 1: does AB exist? Answer: A is a 2x4 matrix. B is a 3x3. So A has 4 columns and B has 3 rows. Therefore AB does not exist. A and B are not conformable.

45
**Multiplying two matrices**

Example 2: does AB exist? Answer: A is a 2x5 matrix. B is a 5x2. So A has 5 columns and B has 5 rows. A and B are conformable. Therefore AB exists. How to find it?

46
**Multiplying two matrices**

Finding AB A and B are conformable. So C = AB exists and will be a 2 x 2 matrix (no. of rows of A by no. Columns of B) To calculate it: To get the first element on the first row of C take the first row of A and multiply each element in turn against its corresponding element in the first column of B. Add the result. Example: c11 = (4x4) + (-1x-1) + (3x3) + (3x3) + (0x1) = 35 To get the remaining elements in the first row: repeat this procedure with the first row of A multiplying each column of B in turn.

47
**Multiplying two matrices**

So top left hand element is And top right hand element is

48
**Multiplying two matrices**

......and so on to give

49
**Multiplying two matrices - formally**

Suppose A is an mxn matrix and and B is an nxr matrix with typical elements aik and bkj respectively then AB =C where element cij is : Note that the result is an mxr matrix

50
Another example Example 2: calculate AB First we note that A is 1x4 and B is 4x2 so C=AB exists and is a 1x2 matrix The first element c11 = (1)(1)+(0)(2)+(2)(1)+(0)(0)= 3 The second element c12 = (1)(0)+(0)(0)+(2)(3)+(0)(1)= 6 So C = (3 6)

51
Quiz. Can you multiply the following matrices? If so, what is the dimension of the result? BA BC AA’ A’A CC

52
Answers Finding CC (sometimes written C2).

53
**Multiplying square matrices by the identity matrix**

Recall: A square matrix has the same number of rows and columns – it’s nxn The identity matrix is a square matrix with 1s in the leading diagonal and 0s everywhere else. E.g.

54
**The usefulness of the identity matrix is similar to that of the number 1 in number algebra**

Since IA = AI = A - if multiply a matrix by the identity matrix the product is the original matrix Eg (leave it to you to show AI=A)

55
**A general result for square matrices**

If A is a square matrix then IA = AI = A NB. This only applies to square matrices

56
**This result can be useful sometimes to help solve matrix algebra**

Since if AI = A Then AIB = (AI) B = A (BI) = AB The inclusion of the identity matrix does not affect the matrix product result (since like multiplying by “1” (will see example of this in econometrics EC5040) Also note that An identity matrix squared is equal itself Any matrix with this property AA = A Is said to be idempotent

57
**Inverses for (square) matrices**

Idea: In standard multiplication every number has an inverse (except maybe zero unless you count infinity) The inverse of 3 is 1/3; the inverse of 27 is 1/27, the inverse of -1.1 = -1/1.1 Also a number times its inverse equals 1: x(1/x) = 1 and the inverse times the number equals 1: (1/x)x = 1 and the inverse of the inverse is the original number 1/(1/x) = x

58
**Inverses for (square) matrices**

The rules for the inverse of a matrix are similar (but not identical) If A is an nxn matrix then the inverse of A, written A-1 , is an nxn matrix such that: AA-1 = I A-1A = I Notes: This means that A is the inverse of A-1 But... A-1 may not always exist

59
**An Inverse matrix example**

Suppose and Then So given AA-1=I it must be that in this case B=A-1

60
**In general need to introduce some more terminology before can invert a matrix**

Only square matrices can be inverted. Not all square matrices can be inverted however A matrix that can be inverted is said to be nonsingular (so squareness is a necessary but not sufficient condition to invert) 3. The sufficient condition is that the columns (or rows since it is square) be linearly dependent - think of this as being separate equations so the equations must be independent (n equations and n unknowns) if a solution is to be found

61
Eg So that the 1st row of A is twice that of the 2nd row and there is linear dependence One equation is redundant (no extra information) and the system reduces to a single equation with 2 unknowns So no unique solution for x1 and x2 exists

62
Rank of a matrix The idea of vector rank can be easily extended to a matrix The rank of a matrix is the maximum number of linearly independent rows or columns If the matrix is square the maximum number of independent rows must be the same as the maximum number of independent columns If the matrix is not square then the rank is equal to the smaller of the maximum number of rows or columns, ρ<=min(rows, cols) If a matrix of order n is also of rank n, the matrix is said to be of full rank Important: Only full rank matrices can be inverted Matrix ranks are closely linked to the concept of determinants

63
Determinants Let A be an nxn matrix then the determinant of A is a unique number (scalar), defined as: (1) Notes: In each term there are three components: (-1)1+j a1j Det(A1j) What does this mean? Start with a 2 x 2 matrix which gives a single number (scalar) as the answer – as do all determinants Can you see how this relates to equation (1) ?

64
Determinants Eg What is the determinant of So matrices that are not full rank – have linear dependent rows/columns - have zero determinants (will come back to this) and are singular

65
Determinants. The determinant of a matrix is defined iteratively An nxn is calculated as the sum of terms involving the determinants of nx(n-1)x(n-1) (ie n!) matrices Each (n-1)x(n-1) matrix determinant is the sum of terms involving n-1 determinants of (n-2)x(n-2) matrices and so on Since we know how to calculate the determinant of a 2x2 matrix we can always use this definition to find the determinant of an nxn matrix In practice we shall not go above 3x3 matrices (unless using a computer program) but we need to know the general formula for an inverse

66
**General properties of determinants**

If B = A’, then det. B = det. A If B is constructed from A by swapping two rows, then det. B = -det. A If B is constructed from A by swapping two columns, then det. B = -det. A If B is constructed from A by multiplying one row (or column) by a constant, c, then det. B = c det. A If B is constructed from A by adding a multiple of one row to another, then det. B = det. B

67
**Determinants of triangular matrices**

Are examples of – respectively – an upper triangular and a lower triangular matrix (zeros below or above the main diagonal) The determinant of either an upper or lower triangular matrix is equal to the product of the elements on the main diagonal Eg det.A = 1(24-0) - 2(0) + 3(0) = 24 = 1*4*6

68
Determinants For a 3 x 3 matrix, using Question: What is the determinant of

69
**Method 1: Laplace expansion of an n x n matrix.**

Can generalise this rule for the determinant of any n by n matrix As part of this method, you need to know the following: Minor M Co-factor C (which are also essential to invert a matrix)

70
**nxn Matrix inversion - minors**

There is a minor Mij for each element aij in the square matrix. To find it construct a new matrix by deleting the row i and deleting the column j. Then find the determinant of what’s left E.g. M11 Example M12 1 2 3 A= 4 5 6 7 8 9 1 2 3 Delete row and column 4 5 6 7 8 9

71
**N xn matrix inversion: Co-factor and adjoint matrices**

The cofactor is Cij is a minor with a pre-assigned algebraic sign given to it For each element aij, work out the minor Then multiply it by (-1)i+j In simpler language: if i+j is even then Cij = Mij If i+j is odd, then Cij = -Mij The co-factor matrix is just The adjoint matrix is C’ – i.e. the transpose of C.

72
**Co-factor, adjoint matrices and the inverse matrix**

The inverse matrix, A-1 is just So i) find the determinant – if it is non-zero, the matrix is non-singular so its inverse exists ii) Find the cofactors of all the elements of A and arrange them in the cofactor matrix iii) Transpose this matrix to get the adjoint matrix iv) Divide the adjoint matrix by the determinant to get the inverse

73
Example 1 (2 x 2 matrix) If find A-1 Use the formula First find the determinant which is non-zero so can continue Now find matrix of cofactors, which in the 2 x 2 case is a set of 1 X 1 determinants

74
Example 1 (2 x 2 matrix) Now transpose the matrix of cofactors to get the adjoint matrix Now using the formula above which is non-zero so can continue then NB. Always check that the answer is right by looking if AA-1 = I

75
Example 2: 3 x 3 matrix While

76
Example continued

77
Quiz In each case find the matrix of minors Find the determinant Find the inverse and check it.

79
Some more jargon The term is called the determinant of A, often written det.(A). Vertical lines surrounding the original matrix entries also means ‘determinant of A’. The matrix part of the solution is called the ‘adjoint of A’ written adj. A. The elements of the adj.A are called co-factors. So,

80
**2x2 Matrix Inversion Quiz**

Suppose What is det. A? What is A-1 What is det. B? Can you find B-1

81
**Summary 11 Definitions you should now memorise:**

Matrix dimensions, null matrix, identity matrix, transpose, symmetric matrix, square matrix, leading diagonal, nonnegative, positive, nonpositive, and negative matrices. 5 skills you should be able to do: Add two nxm matrices Multiply a matrix by a scalar Transpose a matrix. Identify the element aij in any matrix Understand and have practised matrix multiplication

82
**For home study: Method - the Gaussian approach.**

In a row operation multiples of one row are added or subtracted from multiples of another row to produce a new matrix. Example: transform A by replacing row 1 by the sum of row 1 and row 2: A row operation can be represented by matrix multiplication. A’ = BA where

83
**Method 2: the Gaussian method.**

Suppose, by a series of m row operations we transform A into I, the identity matrix. Let Bi indicate the series of matrices in this sequence of m row operations: BmBm-1…B1A = I. Let C = BmBm-1…B1 so that CA = I. It follows that, by the definition of the inverse that C = A-1. Since C = CI we can find C by taking the row operations conducted on A and conducting them in parallel on I. Method. Begin with the extended matrix [A I]: Carry out row operations on the extended matrix until it has the form [I C] C = A-1

84
Quiz Use the Gaussian method to find the inverse and check it works.

85
5. An odd example. In Cafeland there are only two goods: x1 = latte, x2 = muffin. Peculiarly, it is not possible to buy and sell the goods separately. Instead the following combinations are available x: Latte lover : x1 = 2, x2 = 1. y: Muffintopia: x1 = 0, x2 = 3. Any fraction of these combinations can be bought and sold Joan wishes to own and consume exactly one latte and one muffin. Can she buy to achieve her goal? Answer: She buys 1/2 of latte lover combo and 1/6 of muffintopia combo. This mix of vectors is called a linear combination. More formally, if x and y are n x 1 vectors and a and b are scalars, ax + by is a linear combination. Joan’s purchase is (1/2)x + (1/6)y

86
The example again In Cafeland there are only two goods: x1 = latte, x2 = muffin. Peculiarly, it is not possible to buy and sell the goods separately. Instead the following combinations are available x: Latte lover : x1 = 2, x2 = 1. y: Muffintopia: x1 = 0, x2 = 3. Any fraction of these combinations can be bought and sold Can Joan construct any combination of latte and muffin out of x and y? Any combination: So formally, is there an a and a b such that: Or

87
**The example again I.e. two equations in two unknowns: x1 = 2a and**

x2 = a+3b Or 0.5x1 = a and so x2 = a + 3b = 0.5x1 + 3b or x2 –0.5x1= 3b or b = (x2 -0.5x1)/3 For instance if x1 = 1 and x2 = 1, then a = 0.5 and b = 1/6

88
10. Vector Space The set of vectors generated by the various linear combinations of 2 vectors is called a 2-dimensional vector space Consider a space with n dimensions It follows that a single nx1 vector is a point in that space A group of nx1 vectors is said to form a basis for the space if any point in that space can be represented as a linear combination of the vectors in the group. In the example, formed a basis for 2 dimensional space. These vectors are also said to span 2 dimensional space In other words if a group of vectors form a basis for an n-dimensional space that’s the same as saying that they span the n-dimensional space.

89
**Multiplying two matrices.**

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google