Matrix 2
Matrix 2
1 Introduction 2
2 Matrix Transpose 4
3 Type of Matrix 5
5 Operation on Matrices 7
5.1 Addition and Subtraction . . . . . . . . . . . . . . . . . . . . . . . . 7
5.2 Multiplication with Scalar . . . . . . . . . . . . . . . . . . . . . . . . 8
5.3 Multiplication of Two Matrices . . . . . . . . . . . . . . . . . . . . . 8
6 Determinant 9
6.1 Sign Chart and Cofactor . . . . . . . . . . . . . . . . . . . . . . . . . 9
7 Determinant of 2 × 2 matrix 10
7.1 Determinant of 3 × 3 matrix . . . . . . . . . . . . . . . . . . . . . . . 10
8 Inverse Matrix 11
11 Rank 20
1
Matrix
Learning Objectives
1. Determinant
1 Introduction
Matrix is a very powerful tool. In mathematics, matrix is studied in linear algebra,
where we study about solving linear system that is then applied in system of differen-
tial equations and in graph theory. Inventing new numerical method is also done by
studying the environment and properties of matrix. In real life application, matrix is
used in image processing, cryptography, train and flight schedule optimisation, and
in networking mapping.
For this course, the main purpose of studying matrix is to solve system of linear
equations using several classical methods, that are still applied to this day.
2
In addition, we will also study on how to find the eigenvalue and eigenvectors of a
matrix.
Matrix is a rectangular array of real numbers enclosed in bracket or parentheses.
The size/order is m × n, m rows by n columns. We usually denote matrix using
capital letters.
Example of matrix
4 2 1
0 2 5
A=
7 9 4
0 0 3
The size of matrix A is 4×3. The numbers inside the matrix are called entry/element.
The notation for entry or element is aij , that is i-th row and j-th column. For example
in matrix A, the coordinate/notation for the element :
Another important parts of matrix is leading entry = first nonzero element, read from
the left of i-th row. Usually denoted as Pi . From example matrix A,
P1 = 4, P2 = 2, P4 = 3.
3
Example 1
Given !
1 0 2 3
A= .
0 2 5 4
Find
2 Matrix Transpose
Matrix A of m × n is transposed by rewriting the entries, but interchange the rows
and columns of A. Matrix transpose is denoted by AT or A0 .
Example 2
Transpose the following matrix
!
1 −1 4 3 2 4
(c) C =
(a) A = 3 −2 1 −1 0 1
4 5 −2
2 −1 5 2 2
(b) B = 0 3 (d) D = 1 0 0
1 4 0 2 1
4
3 Type of Matrix
Row matrix
Matrix with size 1 × n.
Example :
B= 1 3 2 3 5
Column matrix
Matrix with size m × 1.
Example:
1
3
C=
4
−2
6
Square matrix
Matrix with size n × n.
Example:
! 1 2 3
1 1
D= , E = 3 0 −2
3 4
4 0 9
Diagonal matrix
Square matrix where all elements are zero except at least one of the diagonal.
Example :
! 1 0 0 2 0 0
1 0
F = , G = 0 3 0 , H = 0 0 0
0 4
0 0 9 0 0 −1
Upper Triangular matrix
A square matrix which the element satisfies
0, for i > j,
aij =
k, for i ≤ j
5
! 3 −2 7
1 3
J= , K = 0 5 9
0 2
0 0 1
Lower Triangular matrix
A square matrix which the element satisfies
0, for i < j,
aij =
k, for i ≥ j
Identity matrix
A diagonal matrix where every diagonal elements are strictly 1.
0, for i 6= j,
aij =
1, for i = j
Denoted by I2×2 for 2 × 2 identity matrix and so on. The letter I is reserved for
identity matrix and cannot be used to represent other matrix.
Example:
! 1 0 0
1 0
I2×2 = , I3×3 = 0 1 0
0 1
0 0 1
6
4 Two Equal Matrices
Two matrices, A and B, are equal if all the entries are the same, the size of the
matrices are the same.
Example 3
5 Operation on Matrices
5.1 Addition and Subtraction
We can add/subtract two matrices A and B to get a new matrix C just like doing
usual arithmetic, provided that the size of the matrices A and B must be the same.
The resultant matrix C will also have the same size.
Example 4 Simplify the following if possible.
(a) (c)
1 2 4 4 1 4
! 4 1
2 6 5 + 0 1 0
1 4 3
+ 0 1
4 5 2 0 2 4 2 0 9
0 2
(b)
1 2 4 4 1 (d)
! !
1 1 6 + 0 1 1 4 3 1 7 5
−
4 8 10 0 2 2 0 9 4 6 8
7
5.2 Multiplication with Scalar
Given any number or scalar λ and a matrix A = aij . Then λA is produced by
multiplying every element of matrix A with λ such that λA = λaij .
Example 5 Simplify the following
(a) !
0 1 −3
3
2 −2 4
(b) If ! !
1 −2 1 1
A= , B= ,
5 7 0 2
Find 2A − 3B.
(c) Let
4 −1 3
A = 6 0 2 , λ = 2
2 5 −4
and I is identity matrix. Find A − λI.
(a) The number of columns of matrix A must be equal to the number of rows of
matrix B.
See that the number of columns of A = row of B = r that enable the matrix A
multiplied with B. If it is not the same, A cannot multiply B.
Important note :
8
Example 6 Simplify the following if applicable
(a) 1 2 3 4 5 6 1 −1 4 3
(e) 3 2 1 1
4 3 4 −5 2 2
(b) 1 2 3 5 −2
1 0
! ! (f) Find (x, y, z)T if
1 3 1 1 2
(c)
2 1 3 4 5
x 1 0 3 2
! !
1 1 2 1 3 y = 2 1 1 1
(d)
3 4 5 2 1 z 3 4 5 3
6 Determinant
Determinant is a real number associated with a square matrix.
! Determinant of matrix
3 1 3 1
A is denoted by ‘det A’ or |A|. For example, if A = , then |A| = .
5 2 5 2
+ − +
+ − + − + ...
− + − + − ...
Sign chart for n × n matrix + − + − +
. The sign chart follows the
...
.. .. .. .. .. ..
. . . . . .
i+j
formula (−1) for i-th row and j-th column.
Calculating Cofactor and determinant will use the sign chart. The formula for the
cofactor is given by
Cij = (−1)i+j Dij , (2)
9
7 Determinant of 2 × 2 matrix
!
a11 a12 a11 a12
Let A = . Then |A| = = a11 a22 − a12 a21 .
a21 a22 a21 a22
Example 7 Find the determinant for the following matrix
!
2 1
(a)
−4 2
!
−1 1
(b)
−3 4
This method of finding determinant is called cofactor expansion. We can use pick
any column and row to find determinant as it will give same answer.
Example 8 Find the determinant of the following matrix
1 2 3 1 −2 4 2 −2 3
(a) 3 1 2 (b) 2 −7 5 (c) 0 3 4
2 1 3 −1 3 1 0 2 4
Properties of determinant :
The vertical symbol here |A| does not mean absolute value.
10
8 Inverse Matrix
For a square matrix A, there is an inverse matrix denoted as A−1 such that
AA−1 = I
To find the inverse matrix, the method is known as adjoint method, and the procedure
is
5 1 2 1 0 2 2 1 2 4 1 −2
11
9 Solving System of Linear Equation using Matrix
Method
System of linear equation is linear equation(SLE) that is more than equation, and has
to be solved simultaneously. A very effective way is solving ig using matrix method.
There are few matrix methods that can be used, but in this course we will learn
about:
Firstly, we will learn about Cramer’s Rule and Inverse Matrix Method. Elementary
Row Operation (ERO) is a bit tedious but more powerful compared to the other
two, so will learn ERO on different section. For your course, focus on 3 × 3 matrix.
Ideally if we have three unknowns, we need three equations to solve for the unknown
variables.
First we need to learn how to change a SLE with three unknowns, into matrix equa-
tion. Let a SLE given by
b3
contains the right hand side of the equation.
12
x
Technically what we want to find is the value of y that can satisfy equation
z
3 simultaneously. Sometimes the SLE is written in terms of (x1 , x2 , x3 ) instead of
(x, y, z).
TIPS : Always find the solution using your calculator first by solving 3 simultaneous
equations. By knowing the solution ahead, so you would know whether your final
answer is right or wrong. If the solution is ‘Math error’, or ‘undefined’, it means that
it falls into category of “no solution” or “many solution”, in which we will discuss in
section 12.
The idea is to find x, we replace the first column of A with b, find the determinant
of this new matrix, and divide it with the original determinant of A. To find y and
z, the step is repeated but replacing b correspondingly on column of A.
13
9.2 Inverse Matrix Method
The formula is given as
x = A−1 b. (6)
14
10 Elementary Row Operation
ERO is an operation that we can use on matrix, to solve the system of linear equations
and to find inverse matrix.
If we want to solve for SLE, we combine/augment the matrix with the right hand side.
If we want to find the inverse matrix, we combined coefficient matrix with identity
matrix. For example here on the left is coefficient matrix A augmented with right
hand side b, while on the right is the augmented matrix of A with I. Augmented
matrix :
1 2 3 1 1 2 4 1 0 0
A|b = 0 1 4 3 , A|I = 0 3 4 0 1 0
0 0 1 5 0 0 1 0 0 1
When SLE is converted to an augmented matrix, each equation becomes row.
There are only three operations that can be applied on using ERO:
9 0 1 5 6 7
9 0 1 9 0 1
1 0 7
15
possible.
But what is the aim of doing ERO? We do not just do ERO on a matrix without any
direction. So technically the aim of doing ERO is to change the coefficient matrix,
into a row echelon form.
The procedure to solve system of linear equation(SLE) is described as
Perform ERO back substitution
SLE ⇒ Augmented A|b ========⇒ Row Echelon form ==========⇒ Solution of SLE
The first non-zero element in each row, called the leading entry, is 1.
Each leading entry is in a column to the right of the leading entry in the previous
row(below leading entry, must be all 0).
Rows with all zero elements, if any, are below rows having a non-zero element.
16
A matrix is in reduced row echelon form (rref) when it satisfies the following condi-
tions.
The matrix is in row echelon form (i.e., it satisfies the three conditions listed
above).
The leading entry in each row is the only non-zero entry in its column.
∗ ∗ ∗
where * refers to any real number, for this context, let say integers or natural number.
From the rule of thumb, the guide to reduce the matrix into echelon form is as
following :
∗ ∗ ∗
Usually, the first step is multiply(divide) r1 with a constant. Remember, that
we want to avoid fraction at the early procedure, if the division would result
other element in row 1 to be fraction, try to ABORT this step. Another step is,
interchanging row, r1 with r2 or r3 , where usually one of r2 and r3 has already
a pivot 1. Other step is doing subtraction(addition) of r1 with other rows.
(Step 2) Once we get the form in (1), the next thing is to get
1 ∗ ∗
0 ∗ ∗
0 ∗ ∗
17
To get this is now become easy, we should always use r1 and having it in form
of (1) earlier is really useful. We usually add(subtract) r2 and r3 with r1 after
multiplying it with necessary constant. For eg : r2 − 2r1 or r3 − 3r1 .
0 ∗ ∗
Starting from (2), there are many ways for that to achieve (3), but remember,
at this point you should not link it with r1 anymore. One way, you can multi-
ply(divide) r2 with its coefficient to get 1. Another way is to link it up with r3 ,
you can add(subtract) with r3 after multiplying it with constant if necessary.
For eg: you can do 2r2 − 3r3 or r2 − 2r3 whichever that is neat.
0 0 ∗
Easy, just like in (2). Since we already have the form in (3), we can add(subtract)
with r2 after we multiply it with necessary constant. Just remember only to
link it with r2 , not r1 .
0 0 1
(Step 6) To continue, if we want to get identity matrix or reduced echelon form, we first
need to get the form
1 0 ∗
0 1 ∗
0 0 1
It is better to settle with r1 first, and the RIGHT WAY to get the form above
is to link it with r2 .
18
(Step 7) Then we work on r1 one more time to obtain
1 0 0
0 1 ∗
0 0 1
0 0 1
Example 12 Solve the following system of linear equation using Gauss elimination.
Example 13 Find the inverse of the following matrix using elementary row operation
1 1 1 3 −1 0 0 1 1
(a) 2 3 3 (b) −2 2 −1 (c) 5 1 −1
3 4 5 −1 −1 1 2 −3 −3
19
11 Rank
Rank of a matrix is the number of row that is non zero in that echelon matrix.
Knowing rank, can tell us about the description of the solution of the linear system.
Notation
rank of matrix A: p(A).
rank of matrix A augmented with b : p(A|b)
Remember that you can only determine the rank only if the matrix is in echelon form.
For example :
1 2 3
The rank of A here is 3, or p(A) = 3. 0 1 4
0 0 1
1 2 3 2
The rank of A augmented with b here is 3 or p(A|b) = 3. 0 1 4 3
0 0 1 1
1 2 3
The following matrix has rank p(A) = 2. 0 1 4
0 0 0
1 2 3 2
Here, p(A) = 2 while p(A|b) = 3. 0 1 4 3
0 0 0 1
(a) p(A) = p(A|b) =the number of variables =⇒ the system has a unique solution.
(b) p(A) = p(A|b) <the number of variables =⇒ the system has infinitely many
solution.
(c) p(A) < p(A|b) =the number of variables =⇒ the system has no solution.
20
1 2 3 2 1 2 3 2
Unique solution : 0 1 4 3 Many solution : 0 0 0 0 (plane)
0 0 1 1 0 0 0 0
1 2 3 2 1 2 3 2
No solution : 0 1 4 3 No solution : 0 0 0 3
0 0 0 1 0 0 0 0
1 2 3 2
Many solution : 0 1 4 3 (line)
0 0 0 0
No solution :
Many solution
Example 14
(a) Solve the following system of linear equations by using Gauss elimination method.
x1 + x2 − x 3 = 3
−x1 + x2 + x3 = 2
x1 + 3x2 − x3 = 6.
21
(b) Given the system of linear equations
x+y−z =2
x + 2y + z = 3
x + y + (k 2 − 5)z = k
Find the values of k such that the system (a)does not have any solution, (b)
has many solution, and (c) has a unique solution.
4x + 6y + kz = p
x + 2y − 3z = 4
3x + 5y + 6z = 10.
Find the values of k and p such that the system (a)does not have any solution,
(b) has many solution, and (c) has a unique solution.
22
13 Eigenvalues and Eigenvectors
It is known that if we multiply n × n matrix A with n × 1 vector x, we will get a new
vector back as shown in the equation below.
Ax = y. (7)
Ax = λx. (8)
We are looking for value of x, such that when we multiply A with x, we will obtain
x back, but with some scale change measured by λ.
This is possible but only for certain value of λ and x. We call λ as an eigenvalue for
A and x is the corresponding eigenvector.
In order to find eigenvalue and eigenvector, in equation (8) and notice that if x = 0
then equation (8) is going to be true for any value of λ. We are not interested with
this solution, so we are going to make the the assumption that x 6= 0. So from (8)
Ax − λx = 0
Ax − λIx = 0
(A − λI)x = 0 (9)
When we factored out x, we added the appropriately sized identity matrix, which
is equivalent to multiply things by 1. We need this to avoid to have the difference
matrix of A and λ.
Now we need to solve equation (9) and we have assumed that x 6= 0, therefore we
will have many nonzero solutions. We will only get this if the matrix on the system
is singular. Therefore we need to determine the values of λ, for which we get
|A − λI| = 0. (10)
Equation (10) is also known as characteristic equation. To find λ just solve this using
your calculator, because for 3 × 3 matrix, the characteristic equation will be a cubic
equation.
Once we obtained the eigenvalues, we can get the corresponding eigenvector by sub-
stituting back λ into equation (9), and solve the system of linear equations using ERO
by looking for it’s row reduced echelon form(rref).
23
Important Tips :
Expand the characteristic equation and then just use your calculator scientific
to solve the cubic equation. Do not waste time factoring manually.
Example 15 Find the eigenvalues and eigenvectors for the following matrix
!
−2 7 2 −2 1
(a)
−1 6 (e) −1 3 1
! 2 −4 1
1 2
(b)
3 2
1 1 2
0 1 1 (f) 0 2 2
(c) 1 0 1
−1 1 3
1 1 0
−2 −4 2 1 −1 −1
(d) −2 1 2 (g) 0 1 3
4 2 5 0 3 1
24