The order is specified as: number of rows × number of columns For example, the matrix A above has 5 rows and 3 columns and so its order is 5× 3.. For example, the set of car rental price
Trang 115Matrix algebra
Learning objectives
After completing this chapter students should be able to:
• Formulate multi-variable economic models in matrix format
• Add and subtract matrices
• Multiply matrices by a scalar value and by another matrix
• Calculate determinants and cofactors
• Derive the inverse of a matrix
• Use the matrix inverse to solve a system of simultaneous equations both manuallyand using a spreadsheet
• Derive the Hessian matrix of second-order derivatives and use it to check thesecond-order conditions in an unconstrained optimization problem
• Derive the bordered Hessian matrix and use it to check the second-order conditions
in a constrained optimization problem
15.1 Introduction to matrices and vectors
Suppose that you are responsible for hiring cars for your company’s staff to use The weeklyhire rates for the five different sizes of car that are available are: Compact: £139, Intermediate:
£160, Large: £205, 7-Seater People Carrier: £340 and Luxury limousine: £430 For next weekyou know that your car hire requirements will be: 4 Compact, 3 Intermediate, 12 Large, 2People Carrier and 1 Luxury limousine How would you work out the total car hire bill?
If you worked out total expenditure as
4× £139 + 3 × £160 + 12 × £205 + 2 × £340 + 1 × £430 = £4,606
then you would be correct You would have also already done a matrix multiplication problem,although you may not have realized it! Before we look at the formal theory of matrices, let
us continue with this example for a while longer
If you know that your car hire requirements will change from week to week, it can helpmake calculations clearer if the number of cars required in each category are set out in tabularform, as inTable 15.1
Trang 2A matrix is defined as an array of numbers (or algebraic symbols) set out in rows and
columns Therefore, the car hire requirements for the 3-week period in this example can beset out as the matrix
where each row corresponds to a size of car and each column corresponds to a week The
usual notation system is to denote matrices by a capital letter in bold type, as for matrix A
above, and to enclose the elements of a matrix in a set of squared brackets, i.e [ ]
Matrices may also be specified with algebraic terms instead of numbers Each entry isusually known as an ‘element’ The elements in each matrix must form a complete rectangle,without any blank spaces For example, if there are 5 rows and 3 columns there must be
3 elements in each row and 5 elements in each column An element may be zero though
The size of a matrix is called its ‘order’ The order is specified as:
( number of rows) × (number of columns)
For example, the matrix A above has 5 rows and 3 columns and so its order is 5× 3
Matrices with only one column or row are known as vectors These are usually represented
by lower case letters, in bold For example, the set of car rental prices we started this chapterwith can be specified (in £) as the 1× 5 row vector
Matrix addition and subtraction
Matrices that have the same order can be added together, or subtracted The addition, orsubtraction, is performed on each of the corresponding elements
Trang 3Example 15.1
A retailer sells two products, Q and R, in two shops A and B The number of items sold
for the last 4 weeks in each shop are shown in the two matrices A and B below, where the
columns represent weeks and the rows correspond to products Q and R, respectively
Total sales for each week will simply be the sum of the corresponding elements in matrices
A and B For example, in week 1 the total sales of product Q will be 5 plus 8 Total combined
sales for Q and R can therefore be represented by the matrix
There are two forms of multiplication that can be performed on matrices A matrix can
be multiplied by a specific value, such as a number (scalar multiplication) or by anothermatrix (matrix multiplication) Scalar multiplication simply involves the multiplication ofeach element in a matrix by the scalar value, as in Example 15.3 Matrix multiplication israther more complex and is explained later, in Section 15.2
Trang 4Example 15.3
The number of units of a product sold by a retailer for the last 2 weeks are shown in matrix
A below, where the columns represent weeks and the rows correspond to the two different
shop units that sold them
Total revenue is calculated by multiplying each element in matrix of sales quantities A by
the scalar value 4, the price that each unit is sold at Thus total revenue can be represented(in £) by the matrix
R = 4A = 44× 12 4 × 30× 8 4× 15
= 4832 12060
The scalar value that a matrix is multiplied by may be an algebraic term rather than a specific
number value For example, if the product price in Example 15.3 above was specified as p
instead of £4 then the total revenue matrix would become
R= 12p 30p
Scalar division works in the same way as scalar multiplication, but with each element divided
by the relevant scalar value
Example 15.4
If the set of car rental prices in the vector p=139 160 205 340 430
includes VAT
(Value Added Tax) at 17.5% and your company can claim this tax back, what is the vector v
of prices without this tax?
Solution
First of all we need to find the scalar value used to scale down the original vector elementvalues As the tax rate is 17.5% then the quoted prices will be 117.5% times the basic price.Therefore a quoted price divided by 1.175 will be the basic price and so the vector of prices(in £) without the tax will be
1
1.175
160
1
1.175
205
1
1.175
340
1
1.175
430
=118.30 136.17 174.47 289.36 365.96
Trang 5Test Yourself, Exercise 15.1
1 A firm uses 3 different inputs K, L and R to make two final products X and Y.Each unit of X produced requires 2 units of K, 8 units of L and 23 units of R Eachunit of Y produced requires 3 units of K, 5 units of L and 26 units of R Set upthese input requirements in matrix format
2 ‘A vector is a special form of matrix but a matrix is not a special form of vector’
Is this statement true?
3 For the pairs of matrices below say whether it is possible to add them together and
then, where it is possible, derive the matrix C = A + B.
−91
If profit earned is always 20% of sales revenue, use scalar multiplication to derive
a matrix showing profit on each product for each retail outlet
15.2 Basic principles of matrix multiplication
If one matrix is multiplied by another matrix, the basic rule is to multiply elements alongthe rows of the first matrix by the corresponding elements down the columns of the secondmatrix The easiest way to understand how this operation works is to first work through someexamples that only involve matrices with one row or column, i.e vectors
Returning to our car hire example, consider the two vectors
The row vector p contains the prices of hire cars in each category and the column vector q
contains the quantities of cars in each category that your company wishes to hire for the week
Trang 6At the start of this chapter we worked out the total car hire bill as
139× 4 + 160 × 3 + 205 × 12 + 340 × 2 + 430 × 1 = £4,606
In terms of these two vectors, what we have done is multiply the first element in the row
vector p by the first element in the column vector q Then, going across the row, the second element of p is multiplied by the second element down the column of q The same procedure
is followed for the other elements until we get to the end of the row and the bottom of thecolumn
Now consider the situation where the car hire prices are still shown by the vector
This should have the order 1× 3, as there will be one element (i.e the bill) for each of the
three weeks The first element of t is the bill for the first week, which we have already found
in the example above The car hire bill for the second week is worked out using the same
method, but this time the elements across the row vector p multiply the elements down the second column of matrix A, giving
139× 7 + 160 × 5 + 205 × 9 + 340 × 1 + 430 × 1 = £4,388
The third element is calculated in the same manner, but working down the third column of A.
The result of this matrix multiplication exercise is therefore
of rows in the first matrix
Trang 7Example 15.5
Multiply the two matrices A= 28 31
and B= 74 58 21
that it is multiplying The answer to this question is that it is not possible to multiply two
matrices if the number of columns in the first matrix does not equal the number of rows in
the second matrix Therefore, if a matrix A has order m × n and another matrix B has order
r × s, then the multiplication AB can only be performed if n = r, in which case the resulting
matrix C= AB will have order (m × s).
This principle is illustrated in Example 15.5 above Matrix A has order 2 × 2 and matrix B
has order 2× 3 and so the product matrix AB has order 2 × 3 Some other examples of how
the order of different matrices affects the order of the product matrix when they are multipliedare given in Table 15.2
4× 3 4 × 3 Matrix multiplication not possible
Test Yourself, Exercise 15.2
1 Given the vector v=2 5
and matrix A= 6 2
3 7
find the product matrix vA.
2 For the pairs of matrices below say if it is possible to derive the product matrix
C = AB and, when this is possible, calculate the elements of this product matrix (a) A= 2 10
Trang 8(b) A= 58 31
and B= 127 08 21
−91
3 A company’s input requirements over the next four weeks for the three inputs X,
Y and Z are given (in numbers of units of each input) by the matrix
15.3 Matrix multiplication – the general case
Now that the basic principles have been explained with some straightforward examples, wecan set out a general formula for matrix multiplication that can be applied to more complex
matrix multiplication exercises The general m × n matrix with any number of rows m and columns n can be written as
For each element aij the subscript i denotes the row number and the subscript j denotes the
column number For example
a11= element in row 1, column 1
a12= element in row 1, column 2
a 1n = element in row 1, column n
a mn = element in row m, column n
Trang 9If this general m × n matrix A multiplies the general n × r matrix B then the product will be
the m × r matrix C Thus we can write
Using the general matrix multiplication formula, the elements of the first two rows of the
product matrix C can be calculated as:
Trang 10Now try and calculate the elements of the final row yourself You should get the values
do not actually require you to calculate all the elements of the product matrix For occasionswhen you do need to calculate all these elements, an Excel spreadsheet can be used
Using Excel for matrix multiplication
The best way to explain how to use the Excel MMULT formula to multiply two matrices A and B is to work through an example.
(a) Enter the values of matrices A and B on a spreadsheet For example, put the elements
of A in cells (A2; C3) and the elements of B in cells (E2; G4) You can also enter labels
for the matrix names in the rows of cells above
(b) Highlight the cells where you want the calculated AB matrix to go Since the order of A
is 2× 3 and the order of B is 3 × 3 the product matrix AB must have order 2 × 3 You
therefore need to highlight a block of cells with 2 rows and 3 columns, such as (A6; C7).(c) With this cell range still highlighted, enter the formula = MMULT(A2;C3,E2;G4) oruse whatever cells range applies for your matrices to be multiplied, or use mouse to markout matrices to be multiplied with dotted lines
(d) Hold down the CNTRL and SHIFT keys together and press ENTER (if you do not dothis then the formula will not treat all the highlighted cells as part of an array, i.e amatrix)
Your spreadsheet and the computed product matrix AB should now be as shown inTable 15.3
In the simple example above you can check the answers manually However, once you aresatisfied that you can use the Excel MMULTformula properly then you can use it for morecomplex examples where manual computation would be too time-consuming
Trang 11In the spreadsheet in Table 15.4, the MMULT formula has been used to multiply the 5× 6
matrix A by the 6 × 8 matrix B to get the 5 × 8 product matrix AB Try entering the matrices
A and B yourself and see if you can use the Excel MMULTformula to get the same product matrix AB.
Vectors of coefficients
In economic models it is common to specify one dependent variable as a function of avector of explanatory variables, especially when employing econometric analysis to esti-mate coefficients of these explanatory variables A typical vector format for a function is
q = βx where β is the vector of coefficients for the exogenous explanatory variables in vector x.
For example, assume that the demand for oil in time t is the linear function
q t = β0+ β1x1t + β2x2t + β3x3t + β4x4t + β5x5t
Trang 12where the superscript t denotes the time period (rather than an exponent) for all variables and
x1= price of oil
x2= average income
x3= price of substitute fuel
x4= price of complement (e.g cars)
6× 1 However, because it multiplies the constant, the first element in the column remains
as 1 even though the values of other elements (i.e the explanatory variables) may change for
different time periods The actual values of the coefficients β0, β1, β2, etc will be estimated
by a method such as Ordinary Least Squares, which you should come across in your statistics
or econometrics modules
As vectorβ has the order 1 × 6 and the vector of values of the explanatory variables x has
the order 6× 1 then the product matrix βx will have the order 1 × 1 This means that it will
contain the single element q t which is the predicted output
Example 15.9
Assume that the demand for oil (in millions of barrels) can be explained by the model q = βx
and the vector of coefficients of the explanatory variables has been reliably estimated as
Trang 13Thus the answer is 29.92 million barrels.
You can check the calculations for arriving at this answer manually or using Excel
Test Yourself, Exercise 15.3
1 For each of the pairs of matrices A and B below use an Excel spreadsheet to find the product matrix AB.
(a) A= 49 18 32
and B=
2 The demand for good G depends on a vector of four explanatory variables x.
There is a linear relationship, including a constant term, between these explanatory
variables and g, the amount of good G demanded such that g= βx where β is the
Trang 1415.4 The matrix inverse and the solution of
simultaneous equations
The concept of ‘matrix division’ is approached in matrix algebra by deriving the inverse of
a matrix One reason for wanting to find a matrix inverse is because it can be used to helpsolve a set of simultaneous equations specified in matrix format For example, consider theset of four simultaneous equations:
3x1+ 8x2+ x3+ 2x4= 96
20x1− 2x2+ 4x3+ 0.5x4= 69
11x1+ 3x2+ 3x3− 5x4= 75
x1+ 12x2+ x3+ 8x4= 134
These equations can be represented in matrix format by putting:
• the coefficients of the four unknown variables x1, x2, x3and x4into a 4× 4 matrix A
• the four unknown variables themselves into a 4 × 1 vector x
• the constant terms from the right-hand side of the equations into the 4 × 1 vector b.
These can be written as
= b
If this is not immediately obvious to you, try working through the matrix multiplication
process to get the product matrix Ax Working across the rows of A, each element multiplies
the elements down the vector of unknown variables x1, x2, x3and x4 If you write out the
calculations in full for the four elements of the product matrix Ax and equate to the ponding element in vector b, then you should get the same set of simultaneous equations For example, multiplying the elements across the first row of A by the elements down the column vector x gives the first element of Ax as
corres-3x1+ 8x2+ x3+ 2x4
so setting this equal to the first element of the product vector b, which is 96, gives us the first
of our set of simultaneous equations
You could of course, solve this set of simultaneous equations by the standard row operationsmethod but there are certain advantages from using the matrix method, as you will find outlater on
The same matrix format as that derived above can be used for the general case Assume
that there are n unknown variables x1, x2, , x n and n constant values b1, b2, b3, , b n
Trang 15This system of n simultaneous equations with n unknowns can be written in matrix format
as Ax= b, where A is the n × n matrix of coefficients
How does this specification of the set of simultaneous equations in the matrix format
Ax= b help us to solve for the unknown variables in x? If x and A were single terms, instead
of vectors and matrices, and Ax = b then basic algebra would suggest that x could be found
by simply re-specifying the equation as x = A−1b The same logic is used when x, A and b
are matrices and we try to find x = A−1b.
The derivation of the matrix inverse A−1is, however, a rather involved procedure and it is
explained over the next few sections in this chapter There is no denying that some studentswill find it hard work ploughing through the analysis It is worth it, though, because you willlearn:
• How to solve large sets of simultaneous equations in a few seconds by using matrixinversion on a spreadsheet
• How to use a set of tools that will be invaluable in the analysis of economic modelswith more than two variables, particularly when checking the second-order conditions
of optimization problems
Conditions for the existence of the matrix inverse
In Chapter 5, it was explained that in a system of linear simultaneous equations the basicrule for a unique solution to exist is that the number of unknowns must equal the number
of equations, and linear dependence between equations must not be present As long asthese conditions hold then matrix analysis can be used to solve for any number of unknownvariables Since the number of unknown variables must equal the number of equations the
matrix of coefficients A must be square, i.e the number of rows equals the number of columns.
Also, if we know the values for A and b and wish to find x using the formula x = A−1b
then we first have to establish whether the inverse matrix A−1 can actually be determined,
because in some circumstances it may not exist
Before we can define what we mean by the inverse of a matrix we need to introduce
the concept of the identity matrix This is any square matrix with each element along the
diagonal (from top left to bottom right) being equal to 1 and with all other elements being
Trang 16zero For example, the 3× 3 identity matrix is
There are several instances when the inverse of a matrix may not exist:
Firstly, the zero, or null matrix, which has all its elements equal to zero There are
zero matrices corresponding to each possible order For example, the 2× 2 zero matrixwill be
0= 00 00
Just as it is not possible to determine the inverse of zero in basic arithmetic, the inverse of the
zero matrix 0 cannot be calculated However, if we were trying to solve a set of simultaneous
equations, we would be unlikely to start of with a matrix of coefficients that were all zero asthis would not tell us very much!
Secondly, linear dependence of two or more rows (or columns) of a matrix will prevent its
inverse being calculated Linear dependency means that all the terms in one row (or column)are the same scalar multiple of the corresponding elements in another row (or column) Thereason for this will become obvious when we have worked through the method for findingthe inverse, but we can illustrate the problem with a simple example
Consider the two simultaneous equations
Trang 17All the values of (2) are 0.5 of the values in (1) Clearly this pair of simultaneous equations
cannot be solved by row operations to find the unknowns x and y If (2) was multiplied by 2
and subtracted from (1) then we would end up with zero on both sides of the equation, whichdoes not tell us anything This linear dependency would also lead us down the same dead end
if we tried to solve using the matrix inverse
To actually find the inverse of a matrix, we first need to consider some special concepts
associated with square matrices, namely:
• The Determinant
• Minors
• Cofactors
• The Adjoint Matrix
These are explained in the following sections
Test Yourself, Exercise 15.4
1 Identify which of the following sets of simultaneous equations may be suitablefor solving by matrix algebra and then put them in appropriate matrix format:(a) 5x + 4y + 9z = 95 (b) 6x + 4y + 8z = 56
3 Are there obvious reasons why it may not be possible to derive an inverse for any
of the matrices below?
Trang 18If any sets of rows or columns of a matrix are linearly dependent then the determinant will
be zero and we have what is known as a singular matrix For example, if the second row is
twice the value of the corresponding element in the first row and
be non-singular, i.e the determinant must not be zero This condition applies to determinants
of any order
The determinant of a 3rd order matrix
For the general 3rd order matrix
Trang 19are deleted from the original matrix A is employed This can help make the calculations easier
if it is possible to expand along a row or column with one or more elements equal to zero, as
in the example below
However, there are rules regarding the sign of each term, which must be followed These are
explained for the general case in the next section For a 3rd order determinant it is sufficient
to remember that the first term will be positive if you expand along the 1st or 3rd row orcolumn and the first term will be negative if you expand along the 2nd row or column Thesigns of the subsequent terms in the expansion will then alternate
For example, another way of finding the determinant of the matrix in Example 15.11above is to expand along the 3rd row, which includes a zero and will therefore require lesscalculation
Trang 20Test Yourself, Exercise 15.5
1 Evaluate the following determinants:
15.6 Minors, cofactors and the Laplace expansion
The Laplace expansion is a method that can be used to evaluate determinants of any order.Before explaining this method, we need to define a few more concepts (some of which wehave actually already started using)
Minors
The minor|Mij | of matrix A is the determinant of the matrix left when row i and column j
have been deleted
For example, if the first row and first column are deleted from matrix
The minor|M31| is the determinant of the matrix remaining when the 3rd row and 1st column
have been eliminated from matrix A Therefore
Trang 21Using this definition of a minor, the formula for the determinant of a 3rd order matrix expandedacross the first row could specified as
The cofactor|C22| is the determinant of the matrix remaining when the 2nd row and 2nd
column have been eliminated It will have the sign (−1)4since i + j = 4 The solution is
Although this looks very similar to the formula for|A| in terms of its minors, set out above,
you should note that the sign of the second term is positive This is because the cofactor itselfwill have a negative sign
The Laplace expansion
For matrices of any order n, using the Laplace expansion, the determinant can specified as
|A| =
i,j=n
i,j=1
a ijCij
Trang 22where the summation from 1 to n can take place across the rows (i) or down the columns (j ) If you check the formula (1) above for determinant of a 3rd order matrix in terms of its
cofactors, you will see that this employs the Laplace expansion
If the original matrix is 4th order or greater, then the first set of cofactors derived byusing the Laplace expansion will themselves be 3rd order or greater Therefore, the Laplaceexpansion has to be used again to break these cofactors down This process needs to continueuntil the determinant is specified in terms of 2nd order cofactors which can then be evaluated.With larger determinants this method can involve quite a lot of calculations and so it isusually quicker to use a spreadsheet for numerical examples But first let us work through
an example by doing the calculations manually to make sure that you understand how thismethod works