06 (A) Linear Algebra (Row Operation) SC
06 (A) Linear Algebra (Row Operation) SC
Octavius Yap
[email protected]
Chapter 6(a): Linear Algebra 1
Contents
1 Introduction 4
2 Matrices 5
3 Algebra of matrices 5
3.1 Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3 Scalar multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4 Matrix multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4.1 Method to find the matrix product . . . . . . . . . . . . . . . 7
3.5 Powers of a square matrix . . . . . . . . . . . . . . . . . . . . . . . . 8
3.6 Equal matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.7 Zero matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.8 Identity matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.9 Diagonal matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.10 Transpose of a matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.11 Further properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5 Determinants 17
5.1 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7 Inverse of a matrix 28
7.1 Matrix inverse of 2 × 2 matrix . . . . . . . . . . . . . . . . . . . . . . 28
7.2 Matrix inverse of 3 × 3 matrix . . . . . . . . . . . . . . . . . . . . . . 29
10 Tutorial questions 44
(ii) Anthony and Biggs (1996) parts of Chapters 14, 15, 16, 17, 18, 19 and 20
Further reading
(i) Simon and Blume (1994) parts of Chapters 6, 7, 8, 9, 10 and 23
(iv) To see how to diagonalise a matrix using its eigenvalues and eigenvectors
1 Introduction
Definition 1.1. A vector is an ordered list of numbers.
Each vector is enclosed in brackets. The numbers in each vectors are called entries
(or components).
Note:
(ii) Two vectors x and y are equal, denoted x = y if and only if xi = yi for all
1 ≤ i ≤ n.
(iv) A scalar is a purely numerical quantity with a unit. Given a scalar α, we can
multiply a vector x by the scalr α to obtain a new vector, denoted by αx, by
multiplying every component of the vector by the scalar i.e.
x1 αx1
αx = α x2 = αx2
x3 αx3
2 Matrices
Definition 2.1. A matrix is a rectangular array of numbers arranged in rows and
columns.
1 2 3
For example,
−1 −3 2
Note:
(ii) The numbers forming a matrix are called the entries of the matrix.
(v) A matrix in which the number of rows is the same as the number of columns
is called a square matrix.
3 7
(a) B = is a second order square matrix.
0 2
2 3 6
(b) C = 3 4 5 is a third order square matrix.
6 5 9
3 Algebra of matrices
If two matrices are of the same order, then we can do addition and subtraction of
those matrices.
3.1 Addition
To add two matrices, add the elements in the corresponding places
Example 1
1 2 3 0
Let A = 3 5 and B = −1 −2, then
0 −2 4 8
1 2 3 0 4 2
A + B = 3 5 + −1 −2 = 2 3 .
0 −2 4 8 4 6
3.2 Subtraction
To subtract a matrix B from a matrix A, subtract the elements of B from the
corresponding elements of A.
Example 2
5 7 3 2 3 −6
Let A = and B = , then
1 2 4 4 1 3
5 7 3 2 3 −6 3 4 9
A−B= − = .
1 2 4 4 1 3 −3 1 1
Example 3
1 3 1 3 3 6
Suppose A = , then 3A = 3 =
2 4 2 4 6 12
the number of columns first matrix A=the number of rows of the second matrix B.
Example 4
Suppose A is a 2 × 3 matrix and B is a 3 × 4 matrix. Then AB exists and AB will
be a 2 × 4 matrix.
To find AB,
(1) Multiply the elements of the first row of A by the corresponding elements of the
first column of B and add the products and write the resultant sum of products
in the first column place of the matrix AB.
(2) Multiply the elements of the first row of A by the corresponding elements of
the second column of B and add the products and write the resultant sum of
products in the second column place of the matrix AB.
(3) Multiply the elements of the first row of A by the corresponding elements of
the third column of B and add the products and write the resultant sum of
products in the third column place of the matrix AB.
(4) Similarly, multiply the second row of A by the first, second and third columns
of B and write the resultant sums of products in the second row first, second
and third column places respectively of AB.
Example 5
The matrix AB is as follows
1 2 2 0 1
AB =
0 3 3 1 2
(1 × 2) + (2 × 3) (1 × 0) + (2 × 1) (1 × 1) + (2 × 2)
=
(0 × 2) + (3 × 3) (0 × 0) + (3 × 1) (0 × 1) + (3 × 2)
8 2 5
=
9 3 6
A2 = AA and
A3 = A(A)2 = (A)2 A
Example 6
2 −1
Suppose A =
1 3
A2 = AA
2 −1 2 −1
=
1 3 1 3
(2 × 2) + (−1 × 1) (2 × −1) + (−1 × 3)
=
(1 × 2) + (3 × 1) (1 × −1) + (3 × 3)
3 −5
=
5 8
Example 7
1 2 a b
Suppose A = and B = and if A = B,
3 4 c d
then
a = 1 , b = 2 , c = 3 and d = 4.
(1) A + 0 = A
(2) A0 = 0A = 0
for any matrix A, provided the conditions for addition and multiplication are satis-
fied.
(2) A + (B + C) = (A + B) + C
Ax = b
where
a1,1 a1,2 · · · a1,n
a2,1 a2,2 · · · a2,n
A = .. .. is the coefficient matrix
.. ...
. . .
am,1 am,2 · · · am,n
x1
x2
x = .. is the column vector of variables
.
xn
b1
b2
b = .. the column vector of constants on the right-hand side.
.
bn
Example 8
Write the following system of linear equations in matrix form:
(a)
2x + 3y = 3
x − 3y = 6
Solution:
2 3 x 3
1 −3 y 6
(b)
3x + y − 2z = 3
4x − 5z = −2
8x − 3y + 4z = 17
(c)
x − 2y − z = 4
−2x − 3y + 5z = −9
3x + y + z = 2
(d)
a + b + c = −5
2a + b − c = −1
14a + 9b + (6 ln 2)c = 6 ln 2 − 24
(2) Write the augmented matrix that corresponds to the system of equations. For
the above system, the augmented matrix is:
a11 a12 a13 b1
a21 a22 a23 b2
a31 a32 a33 b3
(3) Use row operations to transform the first column so that the first element
is 1 and the other elements are zero.
(4) Use row operations to transform the second column so that the second ele-
ment is 1 and the element below it are zero.
(5) Use row operations to transform the third column so that the third element
is 1 .
which is called the row-echolon form. Notice in the row-echolon form, all the
elements in the main diagonal are equal to 1 and there is a triangle of zeroes
below the main diagonal.
(7) Then convert the reduced augmented matrix to equation form (which is equiv-
alent to the given system of equations) and use backward substitution method
(i.e. start from the bottom of the system and substitute in the equations to the
top step by step)to find the values of the variables x, y and z.
Example 9
Use Gaussian elimination method to solve the following equation simultaneously.
x + 2y = 5
2x + y = −2
y=4
x + 2y = 5
x + 2(4) = 5
⇒ x = −3
Example 10
Use Gaussian elimination method to solve the following equation simultaneously.
3x + 2y − z = −16
6x − 4y + 3z = 12
3x + 3y + z = −11
3 2 −1 −16
R3 ↔ R2 ⇒ 0 1 2 5
0 −8 5 44
3 2 −1 −16
R3 + 8R2 ⇒ 0 1 2 5
0 0 21 84
3 2 −1 −16
1
R3 ⇒ 0 1 2 5
21
0 0 1 4
Changing to equation form and performing backward substitution:
z=4
y + 2z = 5
y = 5 − 2(4)
⇒ y = −3
3x + 2y − z = −16
3x = −16 − 2(−3) + 4
⇒ x = −2
The solution is x = −2, y = −3, z = 4
Example 11
Use Gaussian elimination method to solve the following equation simultaneously.
x + y + 2z = 9
2x + 4y − 3z = 1
3x + 6y − 5z = 0
Answers: x = −1, y = 2, z = 3
Example 12
Use Gaussian elimination method to solve the following equation simultaneously.
3a − 7b + 4c = 10
−a − 2b + 3c = 1
a + b + 2c = 8
answers: a = 3, b = 1, c = 2
5 Determinants
A square arrangement of numbers enclosed by straight lines is called a determinant.
The following are
Example 13
2 3
(i) is a second order determinant.
5 5
2 0 1
(ii) 1 2 3 is a third order determinant.
2 4 5
a b
det(A) = A = = ad − bc
c d
For larger matrices, we break the determinant down into smaller determinants and
keep doing this until we end up finding the determinants of some 2 × 2 matrices
using the formula above. To do so, we need to introduce two terminology for a n × n
matrix A.
(−1)i+j Mi,j
for each 1 ≤ i, j ≤ n.
5.1 Properties
(1) Determinants have values.
(2) A third order determinant can be evaluated along any row and column.
Example14
1 2 3
Let A = 0 1 1
−1 3 1
Solution: We need to determine the minors and their cofactor. The signs
of the cofactor are given by the following table:
+ − +
− + − ← (−1)2+3
(−1)1+3 →+ − +
0 1
M1,3 = = (0)(3) − (1)(−1) = 1
−1 3
1 2
M2,3 = = (1)(3) − (2)(−1) = 5
−1 3
0 1 1 2 1 2
det(A) = (3) − (1) + (1)
−1 3 −1 3 0 1
= (3)(1) − (1)(5) + (1)(1)
= −1
Example 15
Find the value of the determinant of the diagonal matrix
c1 0 0
D = 0 c2 0
0 0 c3
Example 16
2 −1 5
Find the value of the determinant of the square matrix M = −3 6 2 using
−1 0 4
cofactor expansion.
answer: 68
Example 17
1 1 2
Find the value of the determinant of the square matrix B = 2 4 −3 using
3 6 −5
cofactor expansion.
answer: −1
Example 18
3 −7 4
Find the value of the determinant of the square matrix −1 −2 3 using cofactor
1 1 2
expansion.
answer: −52
Example 19
1 1 1 −1
2 2 3 0
Given that A = 0
, find the value of the determinant of A using
1 2 1
1 0 −1 2
cofactor expansion
Solution: Expanding along the 4th row and noting the signs of the cofactor are
−, +, −, +
1 1 −1 1 1 −1 1 1 1
det(A) = −(1) 2 3 0 + 0 − (−1) 2 2 0 + (2) 2 2 3
1 2 1 0 1 1 0 1 2
1 1 −1
2 3 1 1
2 3 0 = (−1) − (0) + (1)
1 2 2 3
1 2 1
= (−1)[4 − 3] + (1)[3 − 2]
=0
1 1 −1
2 2 1 1
2 2 0 = (−1) − 0 + (1)
0 1 2 2
0 1 1
= (−1)[2 − 0] − (2)[2 − 2]
= −2
1 1 1
2 3 1 1
2 2 3 = (1) − (2) +0
1 2 2 3
0 1 2
= (1)[4 − 3] − (2)[3 − 2]
= −1
a11 x + a12 y = b1
a21 x + a22 y = b2
b1 a12 a b
∆x = and ∆y = 11 1 .
b2 a22 a21 b2
Example 20
Solving the following equations simultaneously using Cramer’s rule.
2x + y = 5
5x − 2y = 8
Solution:
2 1
∆=
5 −2
= −4 − 5
=9
5 1
∆x =
8 −2
= −10 − 8
= −18
2 5
∆y =
5 8
= 16 − 25
= −9
∆x −18
⇒x= = =2
∆ −9
∆y −9
⇒y= = =1
∆ −9
Therefore, the solution is x = 2, y = 1.
Example 21
Solving the following equations simultaneously using Cramer’s rule.
x − y + 2z = −1
4x + y + z = 13
5x − y + 8z = 5
where
1 −1 2
∆= 4 1 1
5 −1 8
1 1 4 1 4 1
=1 − (−1) +2
−1 8 5 8 5 −1
= (8 + 1) + (32 − 5) + 2(−4 − 5)
= 18
−1 −1 2
∆x = 13 1 1
5 −1 8
1 1 13 1 13 1
= −1 − (−1) +2
−1 8 5 8 5 −1
= (−1)(8 + 1) + (1)(104 − 5) + 2(−13 − 5)
= 54
1 −1 2
∆y = 4 13 1
5 5 8
13 1 4 1 4 13
=1 − (−1) +2
5 8 5 8 5 5
= (1)(104 − 5) + (1)(32 − 5) + 2(20 − 65)
= 99 + 27 − 90
= 36
1 −1 −1
∆z = 4 1 13
5 −1 5
1 13 4 13 4 1
=1 − (−1) −1
−1 5 5 5 5 −1
= (1)(5 + 13) + (1)(20 − 65) − 1(−4 − 5)
= −18
∆x 54
⇒x= = =3
∆ 18
∆y 36
⇒y= = =2
∆ 18
∆z −18
⇒y= = = −1
∆ 18
Example 22
Solving the following equations simultaneously using Cramer’s rule.
x + y + 2z = 9
2x + 4y − 3z = 1
3x + 6y − 5z = 0
Example 23
Solving the following equations simultaneously using Cramer’s rule.
x + 2y + 3z = 11
y+z =5
−x + 3y + z = 12
7 Inverse of a matrix
Given a square matrix A, if there exist another square matrix B (of the same order
as A) such that
AB = BA = I,
then B is called the inverse of A and is denoted by A−1 . Therefore
AA−1 = A−1 A = I
Note:
(2) Not all square matrices have inverses. The matrix whose determinant is zero
does not have an inverse. Such a matrix is called a singular matrix.
Example 24
3 2
Find the inverse of matrix A =
5 1
Solution:
3 2
det(A) =
5 1
= 3(1) − 2(5)
= −7 (6= 0)
−1 1 1 −2
A =
−7 −5 3
1 2
− 7 7
= 5
3
−
7 7
So, we find M11 , M12 , M13 , M21 , . . . , M33 as described above. Then, we form the
matrix called the adjugate of A, denoted by the symbol adj (A), as given below:
+M11 −M12 +M13
adj (A) = −M21 +M22 −M23 .
+M31 −M32 +M33
Example
25
−2 1 3
Given 0 −1 1, find A−1 .
1 2 0
−1 1 1 3 1 3
det(A) = (−2) − (0) + (1)
2 0 2 0 −1 1
= (−2)(0 − (−2)) + (1)(1 − (−3))
=4+4
=8
−1 1 0 1 0 −1
M11 = = −2 M12 = = −1 M13 = =1
2 0 1 0 1 2
1 3 −2 3 −2 1
M21 = = −6 M22 = = −3 M23 = = −5
2 0 1 0 1 2
1 3 −2 3 −2 1
M31 = =4 M32 = = −2 M33 = =2
−1 1 0 1 0 −1
(3)attach correct signs for all Mij ,
+ − +
− + − ← (−1)2+3
(−1)1+3 →+ − +
Example 26
1 1 2
Find the inverse of the following matrix A = 2 4 −3.
3 6 −5
Example 27
1 2 3
Find the inverse of the following matrix A = 0 1 1.
−1 3 1
2 −7 1
−1 −4
answer: A = 1 1
−1 5 −1
x + 3y = 5
3x − 2y = 4
Ax = b · · · · · · (1)
x
And we want to find the vector x = . Premultiply both sides of the equation
y
(1) by A−1
A−1 Ax = A−1 b
Ix = A−1 b
x = A−1 b
x
⇒ = A−1 b
y
Example 28
Using the inverse you have found in example 26, solve the system of linear equations
x + y + 2z = 9
2x + 4y − 3z = 1
3x + 6y − 5z = 0
Solution:
1 1 2 x 9
The equation in matrix form is 2 4 −3 y = 1.
3 6 −5 z 0
−1
1 1 2 2 −17 11
From example 26, 2 4 −3 = −1 11 −7.
3 6 −5 0 3 −2
Ax = b
A−1 Ax = A−1 b
2 −17 11 9
x = −1 11 −7 1
0 3 −2 0
x 2 × 9 − 17 × 1 + 0
y = −1 × 9 + 11 × 1 + 0
z 0+3×1+0
x 1
y = 2
z 3
Therefore,
x = 1, y = 2, z = 3
Example 29
Using the inverse you have found in example 26, solve the system of linear equations
x + 2y + 3z = 11
y+z =5
−x + 3y + z = 12
answer: x = −1, y = 3, z = 2
(1) no solution, or
(1) consistent it it has either (a) one solution or (b) infinitely many solutions;
h i
(2) inconsistent if it has no solution, that is, there exist some row S c is of the
h i
form 0 0 . . . 0 c , with c 6= 0.
Figure 1: Two cases where three planes have no common point of intersection;
inconsistent system
Example 30
Each of the following is an augmented matrix of a system of linear equations. De-
termine whether the system is consistent. If it is, determine the gerneral solution.
1 2 −1 2
(a) 0 1 3 4
0 0 0 −5
Solution:
Since the bottom row is of the form 0 = −5, it is inconsistent
1 0 0 2
(b) 0 0 1 3
0 0 0 0
The system is consistent. Let x2 = t. Rewriting the system,
x3 = 3
x1 = 2
x1 2
x2 = t
x3 3
x1 2 0
∴ x2 = 0 + t 1 , t ∈ R
x3 3 0
1 0 1 0 1
(c) 0 1 1 1 2
0 0 0 1 3
The system is consistent. Let x3 = s. Rewriting the system,
x4 = 3
x2 + s + 3 = 2
x2 = −1 − s
x1 + s = 1
x1 = 1 − s
x1 1−s
x2 −1 − s
=
x3 s
x4 3
x1 1 −1
x2 −1 −1
∴ x3 = 0 + s 1 , s ∈ R
x4 3 0
Example 31
Each of the following is an augmented matrix of a system of linear equations. De-
termine whether the system is consistent. If it is, determine the gerneral solution.
1 1 −1 3 1
(a) 0 0 2 1 3
0 0 0 1 −2
19
2
x1 −1
x2 0 1
= + µ , µ∈R
5
x3
0
x4 2 0
−2
1 0 1 −1 0
0 1 0 0 0
(b)
0
0 0 0 0
0 0 0 0 0
x1 −1 1
x2 0 0
∴ = s + t
, s, t ∈ R
x3 1 0
x4 0 1
Example 32
Solve each of the following systems by back-substitution and write the general
solution in standard form.
(a)
x − 3y = 5
y=4
Solution:
x − 3(4) = 5
x = 17
x 17
∴ =
y 4
(b)
x + 2y − z = 7
z=6
Solution:
From last equation, z = 6.
Let y = t.
x + 2y − z = 7
x + 2t − 6 = 7
x = 13 − 2t
x 13 − 2t
y = t
z 6
x 13 −2
∴ y = 0 +t 1 , t∈R
z 6 0
(c)
x + 3y − 2z = 4
y + 5z = 2
z=2
x 32
answers: ∴ y = −8
z 2
(d)
x − 2y + z + 4w = 7
y − w = −3
z+w =2
x −1 −1
y −3
= + t 1 , t ∈ R
answer:
z 2 −1
w 0 1
Example 33
Each of the matrices is an augmented matrix of a system of linear equations.
Determine the values of a, b, c and d for which the systems are consistent. If a
system is consistent, determine whether the system has a unique solution.
2 4 −3 6
(a) 0 b 7 2
0 0 a a
−3
2 4 −3 6
2 4 6
a
0 0 7 2 R2 − R3 0 0 7 2
7 5a
0 0 a a 0 0 0
7
Hence the system is inconsistent
(4) if a = 0 and b = 0, the system is consistent and x2 is a free variable, so
the solution is not unique.
1 −1 4 −2 5
0 1 2 3 4
(b)
0 0 d 5
7
0 0 0 cd c
10 Tutorial questions
1. Write down the equations in matrix form. Use a matrix method to find the
numbers x, y and z that satisfy them.
(a)
2x − 3y − z = 0
2x + 3y + z = 8
x − 2y + 3z = 3
(b)
x − y + z = −3
−3x + 4y − z = 2
x − 3y − 2z = 7
(c)
x − 2y + 10z = 5
2x + y − 2z = 4
x + 3y + 4z = 7
(d)
4x + y − 2z = 4
2x + 3y − 2z = 4
2x + 5y + 2z = 8
(e)
−3x + y + z = 1
−x + y − z = −1
−5x + y + z = 3
3. Solve the systems of linear equations in Question 1 by using the inverse of the
coefficient matrix.
Q = aP 2 + bP + c ,
5. Three goods are sold in the same market. If their prices are x1 , x2 , x3 , then
their demand quantities y1 , y2 , y3 and the supply functions z1 , z2 , z3 are given
by the following equations.
Non-negative numbers x∗1 , x∗2 , x∗3 are said to be equilibrium prices if, when the
prices are x1 = x∗1 , x2 = x∗2 and x3 = x∗3 , then the supply and demand quantities
for each of the good are equal; that is y1 = z1 , y2 = z2 and y3 = z3 . Using
matrix methods, find the equilibrium prices.
3x1 − 5x2 = 2
x1 + 2x2 = 4
(b)
x1 + 2x2 + x3 = 5
2x1 − 3x2 + 2x3 = 6
(c)
x1 + 2x2 − 3x3 = 8
x1 + 3x2 − 5x3 = 11
2x1 + 5x2 − 8x3 = 19
(d)
(e)
x1 + 2x2 − x3 = 4
2x1 + 5x2 + x3 = 10
4x1 + 9x2 − x3 = 19
(f)
x1 + 2x2 − 3x3 = −5
2x1 + 4x2 − 6x3 + x4 = −8
6x1 + 13x2 − 17x3 + 4x4 = −21
7. Using matrix methods, find the values of the numbers a and b if the following
system of equations for infinitely many solutions. Find also, when a and b take
these values, all the solutions of the system.
x+y+z+w =4
x + 3y − z + 5w =8
2x − y + 3z − w =3
2x + 3y + az − 5w =b
8. Use a matrix method to determine the value of the constant, c, for which the
system of equations
x+y+z =6
x + 2y − z =2
x − y + 2z =5
x + 3y − z =c
is consistent. For this values of c, find all of the solutions to this system and say
whether you have found an unique solution or an infinite number of solutions.
2. Refer to Question 1
3. Refer to Question 1
4. a = 4, b = 2, c = 4
If P = 4, the quantity supplied is Q = 76
2 0
7. a = b = 7
x 3 −2
+ t −1/2 , t ∈ R
y 3/2
=
z −1/2 3/2
w 0 1
8. c = 4, x = 1, y = 2, z = 3