Topic 1
Matrix
1
What Is A Matrix?
A matrix is a rectangular collection of
like objects, usually numbers. We are
primarily interested in matrices
because they can be used to solve
systems of linear equations (covered
in week 3 & 4).
3 5 2
A= 7 8 6
1 5 4
2
What Is A Matrix? (cont.)
Other examples:
3
What Is A Matrix? (cont.)
Many notations to represent matrices:
In this class, we will use this notation:
4
Order Of A Matrix
The order AKA size of a matrix is the
number of rows and columns.
column
3 5 2
row 7 8 6
row column
1 5 4
the order of this example is 3 X 3
Read “3 by 3” 5
Square Matrix
A matrix is called a square matrix if
it has the same numbers of rows as
columns. 8 5 2
3 5 2 5 6 9
7 8 6 3 7 9
1 5 4 1 2 1
3X3 4X3
it is a square matrix it is NOT a square matrix
6
Column and Row Matrix
Column Matrix
A matrix that has only one column.
8
2
3
Row Matrix
A matrix that has only one row.
6 2 7
7
Zero Matrix
A zero matrix is a matrix where all the
elements are zeros.
0 0 0
0 0 0
0 0 0
8
Identity Matrix
The identity matrix is a matrix that has
one's on the diagonal, and zeros everywhere
else.
1 0 0
0 1 0
0 0 1
The identity matrix is usually written as "I".
9
Diagonal Of A Matrix
The diagonal of a matrix are the
elements that have identical row and
column numbers
e.g. matrix 2 X 2, 3 X 3, etc.
A diagonal matrix is one that has
non-zero elements only on the
diagonal. 8 0 0
0 6 0
0 0 7
10
Block Diagonal Matrix
A block diagonal matrix is like a diagonal
matrix, except that elements exist in
the positions arranged as blocks.
* 0 0 0 0 0 0 0
0 * * 0 0 0 0 0
0 * * 0 0 0 0 0
(Where,
* means a non-zero element.)
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 * *
11
Band Matrix
A Band Matrix has numbers near the
diagonal of the matrix, and nowhere
else. The width of the band is called
the band width of the matrix.
* * * 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 * * *
12
Transpose Of A Matrix
The transpose of a matrix is
obtained by interchanging the rows
and columns of matrix.
Example: 2 6 3 4 5
A 3 1 B 2 1 0
5 3 1 6 2
2 3 5 3 2 1
A
T
B T 4 1 6
6 1 3
5 0 2
13
Orthogonal Matrix
If a matrix M has the property that
MTM = I than the matrix is called an
Orthogonal matrix.
14
Symmetric Matrix
A symmetric matrix is a square
matrix equal to it's transpose, A = AT.
1 2 -3 3 4 5
A= 2 4 5 B= 2 1 0
-3 5 6 1 6 2
1 2 -3 3 2 1
AT = 2 4 5 BT = 4 1 6
-3 5 6 5 0 2
A is a symmetric matrix B is not symmetric matrix
15
Triangular Matrix
A matrix with entries only below the
diagonal, or with entries only above
the diagonal, is called a (lower, upper)
triangular matrix.
If the diagonal in those cases
consists only of 1's, then the matrix
is unit triangular.
16
Triangular Matrix (cont.)
Upper Triangular Lower Triangular
* * * * * * 0 0 0 0
0 * * * * * * 0 0 0
0 0 * * * * * * 0 0
0 0 0 * * * * * * 0
0 0 0 0 * * * * * *
Upper Unit Triangular Lower Unit Triangular
1 * * * * 1 0 0 0 0
0 1 * * * * 1 0 0 0 * Represents
0 0 1 * * * * 1 0 0 any numbers
0 0 0 1 * * * * 1 0
0 0 0 0 1 * * * * 1
17
Mathematical Operations
involving a Matrix and a Scalar
We can apply the following operations
where one operand is a scalar (number) and
one is a matrix:
Multiplication (x)
Division (/)
18
Mathematical Operations involving a
Matrix and a Scalar: Multiplication
Just multiply the scalar times each
element in the matrix. This operation
is commutative (the arrangement of
matrixes can be switched)
19
Mathematical Operations involving a
Matrix and a Scalar : Division
Division only has meaning when a
matrix is divided by a scalar.
Division of a scalar by a matrix is not
defined.
20
Mathematical Operations on Two
Matrices
Only three binary mathematical
operations are defined:
Addition
Subtraction
Multiplication
21
Mathematical Operations on Two
Matrices : Addition
Addition is only defined for two
matrices with the same order/size.
Add the corresponding elements.
Matrix addition is commutative.
22
Mathematical Operations on Two
Matrices : Subtraction
Subtraction is just addition with
unary inversion of the second matrix.
Subtraction is not commutative - the
order matters.
Must be in the same order/size.
23
Mathematical Operations on Two
Matrices :Multiplication
Matrix multiplication is only defined
when the second matrix has the same
number of rows as the first matrix
has columns.
The resulting matrix has the same
number of rows as the first matrix
and the same number of columns as
the second matrix.
24
Mathematical Operations on Two
Matrices :Multiplication (cont.)
Here are some examples with matrices of
various orders.
Loosely speaking, multiplication is defined when
the middle numbers match.
25
Basic Rules for Matrix
Arithmetic
Addition, Subtraction, Multiplication & Division:
a and b are scalars and A, B, and C are matrices.
26
Basic Rules for Matrix
Arithmetic (cont.)
Zero Matrix
A is a matrix and 0 is the zero matrix sized appropriately for
the indicated operation to be valid.
Transpose
A and B are matrices and c is any scalar
27
Example : Multiplication
4 2 1 1 ,
Given A = and B =
0 2 3 3
5
Compute AB
28
Example : Multiplication
AB = 4 2 1 1 4(1) (2)(3) (1)(5)
=
0 2 3 3 0(1) (2)(3) (3)(5)
5
= 465 = 3
0 6 15 21
29
Exercise 1
For the following matrices perform the indicated
operation, if possible
1. A + B 2 -4 -10
11 11 17
4
4
-2 -4 -4 0
2. B – A 13 -5 -3 14
Can’t be done. Because of different sizes
3. A + C
30
Exercise 2
Given the matrices
Compute
15 55/2
-7 -22/3
0
4
31
Exercise 3
Compute AC and CA for the following two matrices,
if possible.
13 -53 17
AC= -56 -23 81
CA= can’t be done, because of
the sizes
32
Exercise 4
Determine the transpose of these matrices:
33
The Identity Matrix
The identity matrix is a square
matrix with ones along the main
diagonal and zeros everywhere else.
Here are the first few identity
matrices:
34
The Identity Matrix
The identity matrix can be multiplied by any
square matrix and it leaves that matrix unchanged.
Multiplication by the identity matrix is always
commutative.
Here is an example.
35
Exercise 5
What is the answer?
Both will produce
itself
36
The Determinant
The determinant is a scalar value
assigned to a square matrix.
Therefore, non square matrices do
not have a determinant.
The determinant of a (1x1) matrix is
just it's value, e.g. |5| = 5.
37
The Determinant of 2 X 2
The determinants of (2x2)
a b
if A , then det A ad - bc
c d
Example: Find the determinants for the
given matrix. -2 1
A=
4 -2
det A (- 2 )(-2 ) - 1( 4 )
Solution: 4-4
0 38
The Determinant of 3 X 3
To find determinant of 3 X 3, copy the first and
second columns of matrix to form fourth and fifth
columns.
a b c a b
d e f d e
g h i g h
the formula to calculate the determinant is
aei + bfg + cdh – gec – hfa - idb
39
The Determinant of 3 X 3
Example: Find the determinants for the
given matrix. 2 0 1
A = 1 -1 2
Solution: 3 1 0
2 0 1 2 0
1 -1 2 1 -1
3 1 0 3 1
det A= 2(-1 )( 0 ) + 0( 2 )( 3 ) + 1( 1 )( 1 ) - 3(-1 )( 1 )-1( 2 )( 2 )-0( 1 )( 0 )
= 0 + 0 + 1 -(-3 ) - 4 - 0
=0 40
Exercise 6
Find the determinant of these matrices
A = 33
B = -467
C=0
41
The Determinant & Singular
Matrix
Higher order determinants are calculated
recursively using the determinants of
smaller submatrices (discuss in Topic 3).
A matrix with whose determinant has value
zero is called a singular matrix. If the
determinant is not zero, the matrix is non-
singular.
Exercise: Determine which matrices is
singular and non-singular in the previous
exercise A, B = non-singular
C = singular 42
The Matrix Inverse
DEFINITION:
If A is a n x n matrix and an inverse of A is an n x n
matrix A-1, such that
AA-1= A-1A = I where I is the identity matrix.
then we call A invertible (non-singular) and we say
that A-1 is an inverse of the matrix A.
If we can’t find such a matrix A-1 we call A a
singular matrix (det A = zero).
43
The Matrix Inverse of 2 X 2
An inverse of 2 X 2 matrix:
a b
if A =
c d
-1
-1
a b 1 d -b
then A = =
c d ad - bc - c a
44
The Matrix Inverse of 2 X 2
Example: Find the inverse of the given matrix (if
it exists) 1 2
A=
3 7
Solution:
Find its determinant = ad - bc =1(7) – (2)(3)
=1
-1 1 7 -2
A =
1 -3 1
7 -2
=
-3 1 45
Exercise 7
1. Find the determinant of this matrix.
Determine if the following matrix is singular,
based from its determinant.
determinant= 0,
therefore is
singular
2. Find the determinant of this matrix
and find its inverse. .
determinant=
inverse =-1/2
-10,
-1/5
1/2 2/5
46
The Matrix Inverse of 3 X 3
If a b c
A= d e f
g h i
Then steps to find A-1 are:
1. Find determinant of 3X3
2. Find minor
3. Find Cofactor
4. Find Adjoint
5. Replace results in formula -1 1
A = adj(A)
A
47
The Matrix Inverse of 3 X 3 :
Find Minor
If a b c then a minor bminor c minor
A= d e f A minor = d minor e minor f minor
g h i g minor hminor i minor
Where a b c
a b c
a minor = d e f = ei - fh bminor = d e f = di - fg
g h i g h i
a b c a b c
c minor = d e f = dh - eg d minor = d e f = bi - ch
g h i g h i 48
The Matrix Inverse of 3 X 3 :
Find Minor
a b c a b c
e minor = d e f = ai - cg f minor = d e f = ah - bg
g h i g h i
a b c a b c
g minor = d e f = bf - ce hminor = d e f = af - cd
g h i g h i
a b c
i minor = d e f = ae - bd
g h i 49
The Matrix Inverse of 3 X 3 :
Find Cofactor
add –ve value to the circled element
in the minor matrix
a minor bminor c minor
A minor = d minor e minor f minor
g minor hminor i minor
a minor - (bminor ) c minor
Cofactor = - (d minor ) e minor - (f minor )
g minor - (hminor ) i minor
50
The Matrix Inverse of 3 X 3 :
Find Adjoint
Transpose the cofactor to obtain the
adjoint matrix
a minor - (bminor ) c minor
Cofactor = - (d minor ) e minor - (f minor )
g minor - (hminor ) i minor
a minor - (d minor ) g minor
Adjoint = - (bminor ) e minor - (hminor )
c minor - (f minor ) i minor
51
The Matrix Inverse of 3 X 3 :
Example
Find the inverse of the matrix 1 -1 0
A= 1 0 -1
-6 2 3
Solution: Step 1: Find the Determinant
1 -1 0 1 -1
1 0 -1 1 0
-6 2 3 -6 2
det A=1( 0 )( 3 ) + (-1 )(-1 )(-6 ) + 0( 1 )( 2 ) - (-6 )( 0 )( 0 ) - 2(-1 )( 1 ) - 3( 1 )(-1 )
= 0 + (-6 ) + 0 -0 -(-2 ) - (-3 )
=-6 +2 + 3
= -1 52
The Matrix Inverse of 3 X 3 :
Example
Solution: Step 2: Find the Minor 1 -1 0
a minor bminor c minor
A minor = d minor e minor f minor A= 1 0 -1
g minor hminor i minor -6 2 3
1 -1 0
a minor = 1 0 -1 = 0(3) -(-1)(2) = 0- (-2) = 2
-6 2 3
1 -1 0
bminor = 1 0 -1 = 1(3) -(-1)( - 6) = 3- (6) = - 3
-6 2 3 53
The Matrix Inverse of 3 X 3 :
Example
1 -1 0
c minor = 1 0 -1 = 1(2) -(0)( - 6) = 2- 0 = 2
-6 2 3
1 -1 0
d minor = 1 0 -1 = - 1(3) -(0)(2) = -3- 0 = -3
-6 2 3
1 -1 0
e minor = 1 0 -1 = 1(3) -(0)( - 6) = 3- 0 = 3
-6 2 3
1 -1 0
f minor = 1 0 -1 = 1(2) -(-1)(-6) = 2- 6 = -4
-6 2 3 54
The Matrix Inverse of 3 X 3 :
Example
1 -1 0
g minor = 1 0 -1 = - 1( - 1) -(0)(0) = 1- 0 = 1
-6 2 3
1 -1 0
hminor = 1 0 -1 = 1( - 1) -(0)(1) = -1- 0 = -1
-6 2 3
1 -1 0
i minor = 1 0 -1 = 1(0) -( - 1)(1) = 0- ( -1) = 1
-6 2 3
a minor bminor c minor 2 -3 2
A minor = d minor e minor f minor = -3 3 -4
g minor hminor i minor 1 -1 1
55
The Matrix Inverse of 3 X 3 :
Example
Solution: Step 3: Find the Cofactor
a minor - (bminor ) c minor
Cofactor = - (d minor ) e minor - (f minor )
g minor - (hminor ) i minor
2 -(-3) 2
Cofactor = -(-3) 3 -(-4)
1 -(-1) 1
2 3 2
=3 3 4
1 1 1 56
The Matrix Inverse of 3 X 3 :
Example
Solution: Step 4: Find the Adjoint
a minor - (d minor ) g minor
Adjoint = - (bminor ) e minor - (hminor )
c minor - (f minor ) i minor
2 3 2T 2 3 1
Adjoint = 3 3 4 = 3 3 1
1 1 1 2 4 1
57
The Matrix Inverse of 3 X 3 :
Example
Solution: Step 5: Replace results in formula
-1 1
A = adj(A)
A
2 3 1
1
A -1 = 3 3 1
-1
2 4 1
-2 -3 -1
= -3 -3 -1
-2 -4 -1
58
Exercise 8
Compute the inverse of the following matrix:
15/154 -5/154 -6/77
3/22 -1/22 1/11
26/77 17/77 10/77
59