Академический Документы
Профессиональный Документы
Культура Документы
Matrices
Week 6
12 October 2016
Matrix Definitions, Notation
and Operations
A matrix is another name for a table which can
include data or other information.
A matrix comprises n rows and m columns.
A 3 x 4 matrix would therefore have 3 rows and
4 columns.
A 1 x 4 matrix would have 1 row and 4 columns
and would be referred to as a row vector.
A 4 x 1 matrix would have 4 rows and 1 column
and would be referred to as a column vector.
Vectors are usually denoted by underlining the
letter of the matrix and convention dictates that a
lower case letter is used.
2
Adding and Subtracting
Matrices
Matrices can be added or subtracted together
simply by adding or subtracting the matching
entries.
Addition or subtraction is only possible if the
matrices are of the same order, i.e. they have the
same number of rows and columns.
So in general if:
a11 .. .. .. a1n b11 .. .. .. b1n
.. .. .. .. .. ..
A .. .. .. ; B .. .. ..
.. .. .. .. .. ..
n1
a .. .. .. a nn n1
b .. .. .. b nn
3
Adding and Subtracting
Matrices
Then we can represent the addition of the two
matrices by:
a11 b11 .. .. .. a1n b1n
.. .. ..
AB .. .. ..
.. .. ..
an1 bn1 .. .. .. ann bnn
5
Scalar Multiplication
of Matrices
Scaling a matrix means multiplying each element
by a certain factor.
The factor can be positive, negative, fractional or
whole.
For example if we have the matrix:
a11 a12
A
a21 a22
And we want to find kA where k is the scalar then
we multiply each element by k:
k a11 k a12
kA
k a21 k a22
6
Scalar Multiplication
of Matrices
Examples of scalar multiplication
3 7 6
1 0 2
X ;Y ; Z 4 7 3
0 1 2 5 2 7
Find:
2X
3Y
0.5Z
7
Scalar Multiplication
of Matrices
2 1 2 0 2 0
2 X ;
2 0 2 1 0 2
32 6
3Y ;
3 2 6
0 .5 3 0 .5 7 0 .5 6 1 .5 3 .5 3
0 .5 Z 0 .5 4 0 .5 7 0 .5 3 2 3 .5 1 .5
0.5 5 0.5 2 0.5 7 2.5 1 3.5
8
Transposing Matrices
Transposition really means switching around. If:
a b c
A d e f
g h i
Then the transpose of A, denoted AT is shown as:
a d g
A b e h
c f i
Note that after the transposition the dimensions of the matrix
will change. That is, a matrix with n rows and m columns will
have m rows and n columns. E.g. A 2 x 4 becomes a 4 x 2 after
transposition.
9
Matrix Multiplication
11
Matrix Multiplication
Having determined that it is possible to undertake
matrix multiplication we then must follow the
procedure to multiply two matrices.
For example if:
a11 a12 b11 b12
A and B
a21 a22 b21 b22
And we want to calculate AB we take the first row
of A and multiply each element against the
corresponding element of the first column of matrix
B and add together.
So AB is:
a11 b11 a12 b21 a11 b12 a12 b22
AB
a21 b11 a22 b21 a21 b12 a22 b22
12
Matrix Multiplication:
Examples
2 3 2 1
Let A ; B
4 5 1 1
2 2 3 1 2 1 3 ( 1) 7 1
AB
4 2 5 1 4 1 5 ( 1) 13 1
1 4 2
Let C 2 6 3 ; D 5 0 6
1 7 9
CD 2 1 6 5 3 ( 1) 2 4 6 0 3 7) 2 2 6 6 3 9
29 29 67
13
Matrix Multiplication:
Examples
1 2
1 2 3 4 3 7
X ;Y
5 6 7 8 0 3
5 2
1 1 2 3 3 0 4 5 1 2 2 7 3 3 4 2
XY
5 1 6 3 7 0 8 5 5 2 6 7 7 3 8 ( 2)
27 17
XY
63 57
14
Matrix Inversion
Unfortunately inverting a matrix is slightly more
cumbersome than simply inverting a number. For
example if we invert 4 we get . Moreover it is more
cumbersome to invert a 3x3 matrix as opposed to a
2x3 matrix. a b
Starting with the 2x2 matrix, A = c d
If we wish to find the inverse of A, A-1, we must
follow the following steps:
1. Swap elements a and d.
2. Change the signs of elements b and c.
3. Multiply the matrix we now have by the
determinant, 1/[ad bc]
15
Inversion of a 2x2 Matrix
Example.
1 4
Consider the 2x2 matrix, A =
0 3
1 4 1 4
1 1 ( 4) 0 1 ( 4 3 ) ( 4) ( 13 ) 1 0
3
1
0 3 0 3 0 1 3 0 0 ( 3 ) (3 ) ( 3 ) 0 1
4 1
17
Determinant of a Matrix
The term (ad-bc) is known as the determinant of
the matrix, denoted det(A).
Note that if (ad-bc) is zero we cannot work out the
inverse of the matrix.
Note:
(ad-bc) = 0 then the matrix is a singular matrix
and cannot be inverted.
(ad bc) 0 then the matrix is non-singular and
can be inverted.
18
Applications of 2x2 Matrices
and Inversions
We can use the previous technique of inverting 2 x 2
matrices to solve simultaneous equations problems.
Consider the economic data below concerning two
commodities, tea and coffee.
An economist finds that:
4P1 P2 = 1
-2P1 + 3P2 = 12
Where P1 denotes the price of tea and P2 denotes
the price of coffee.
It is possible to utilise matrices to find the equilibrium
values for P1 and P2.
19
Applications of 2x2 Matrices
and Inversions
Writing the system of equation in matrix form,
Ax=z.
Where:
4 1 P1 1
A , x , z
2 3 P2 12
1 1 3 1 3 10 1
A 10
3 4 1 2 2 4 15 2
5
3 10 1
1 3 10 1210 3 2
10
2 12 1 24
15 5 5 5 5
24
Inversion of a 3x3 Matrix
Co-factor associated with the element in row 1,
column 1.
Delete column 1 and row 1.
25
Inversion of a 3x3 Matrix
Co-factor associated with the element in row 1,
column 1.
Delete column 1 and row 1.
26
Inversion of a 3x3 Matrix
Find the determinant of the resultant 2x2 matrix.
a22 a23
a32 a33
27
Inversion of a 3x3 Matrix
Find the determinant of the resultant 2x2 matrix.
a22 a23
a32 a33
28
Inversion of a 3x3 Matrix
a22 a23
a32 a33
1 2 3
A 2 1 0
1 1 1
30
Inversion of a 3x3 Matrix
Minor of a11 = 1x1 0 x (-1) = 1
Minor of a12 = 2 x1 0 x 1 = 2
Minor of a13 = 2 x (-1) 1 x 1 = -3
Minor of a21 = -2 x 1 3 x (-1) = 1
Minor of a22 = 1 x 1 3 x 1 = -2
Minor of a23 = 1 x (-1) (-2) x 1 = 1
Minor of a31 = -2 x 0 3 x 1 = -3
Minor of a32 = 1 x 0 3 x 2 = -6
Minor of a33 = 1 x 1 (-2) x 2 = 5
31
Inversion of a 3x3 Matrix
The matrix of minors is then:
1 2 3
1 2 1
3 6 5
1 2 3
1 2 1
3 6 5
32
Inversion of a 3x3 Matrix
The next step is to create the adjoint matrix of A, adj(A),by
transposing each of the elements of the matrix of co-factors.
Applying this to our example:
1 2 3 1 1 3
1 2 1 adj ( A) 2 2 6
3 6 3 1 5
5
33
Inversion of a 3x3 Matrix
The next step is find the determinant of matrix A.
There are a number of ways of doing this but since we have
already obtained the co-factors we can multiple these by the
original elements of matrix A and add them together to find
the determinant.
1 2 3 1 2 3
A 2 1 0 matrix of co-factors = 1 2 1
1 1 1 3 6 5
1 1 3
adj ( A) 2 2 6
Det(A) = -4
3 1 5
37
Applications of 3x3 Matrices
and Inversions: Cramers Rule
38
Cramers Rule
Writing the system of equation in matrix form,
Ax=z.
Here x is the vector of unknowns.
Cramers rule tells us that if we want to find a
certain x variable, let us call it xi, then we can find
it as follows. det( Ai )
xi
det( A)
The matrix Ai above is formed by substituting the ith
column of the original matrix A with the column
vector, z.
39
Cramers Rule: Example
To illustrate the similarities between the matrix
inversion approach and the Cramers rule
approach we will again consider the following
system of equations.
2P1 P2 + P3 = 5
P1 -3P2 + 2P3 = 2
2P1 + P2 +4P3 = -3
Hence:
2 1 1 P1 5
A 1 3 2 , x P2 , z 2
2 1 4 P 3
3
40
Cramers Rule: Example
The first step is to find the determinant of A.
Expanding by row 1 we get:
3 2 1 2 1 3
det( A) 2 ( 1) 1
1 4 2 4 2 1
2 12 2 1( 4 4) 1(1 6)
2( 14) 0 7 21
42