0% found this document useful (0 votes)
14 views44 pages

Matrices

The document discusses matrices, their historical development, and various applications in solving linear systems. It defines matrices, their dimensions, elements, and types, including row, column, and square matrices, among others. Additionally, it explains how to represent systems of linear equations using augmented matrices.

Uploaded by

aistcream
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views44 pages

Matrices

The document discusses matrices, their historical development, and various applications in solving linear systems. It defines matrices, their dimensions, elements, and types, including row, column, and square matrices, among others. Additionally, it explains how to represent systems of linear equations using augmented matrices.

Uploaded by

aistcream
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Module 2

Matrices and its


Applications

A matrix is an indispensable tool in solving large linear systems. Although


Babylonian civilization shows the first evidence in solving linear systems, it was
the ancient Chinese who introduced a method in solving linear systems using
the idea of a matrix which can be found in a mathematics book entitled "Nine
Chapters on the Mathematical Art". This so-called matrix may not be totally
the same to the modern day matrix as taught in the academe. As it was, only
in the early 1800s that the idea of a matrix reappeared and the development
really got underway. In 1850, the term matrix which means womb in Latin and
derived from the word "mater" which means mother was coined by an English
mathematician named James Joseph Sylvester and the use of modern bracket
notation for matrices was introduced in 1913 by another English mathemati-
cian named Cuthbert Edmund Cullis. There are also other mathematicians
who made various contributions through their work using matrices like Cayley,
Frobenius, Gauss, Jordan, and among others. These numerous works pave way
for its applications to our modern day society. Matrices were used in cryptog-
raphy, regression analysis, digital images, robotics and automation, and many
others.

2.1 Introduction to Matrices


Learning Objectives
• Describe the parts of a matrix.
• Determine the dimensions of a matrix.
• Write linear systems into a matrix.
• Solve different kinds of linear systems using matrices.

39
40 MODULE 2. MATRICES AND ITS APPLICATIONS

• Identify different types of matrices.

In this section, a discussion of matrix definition and matrix terminologies will


be presented. This also includes illustrations of these terms through worked
exercises.

2.1.1 Matrix
A matrix (plural matrices) is a rectangular array of numbers, symbols, or ex-
pressions, arranged in m rows and n columns is called an m × n matrix or m
by n matrix, where m and n are called the matrix dimensions. Also, we can
denote a matrix using a capital letter usually from the English alphabet. Below
is an illustration of an m × n:

column1 column2 ... columnn


 
row1 a11 a12 ··· a1n
row2  a21
 a22 ··· a2n 
..  .. .. .. .. 
.  . . . . 
rowm am1 am2 ··· amn

Figure 2.1: m × n matrix

Matrix Dimensions
The dimensions of a matrix tells its size based on the number of rows and
columns of the said matrix. For example, the size of the matrix above is m × n.
Just remember that when working with matrix dimension it should be rows ×
columns.
Example 1. What are the dimensions of matrix A?
 
1 2 3
A=
0 5 6

Solution:
The number of rows and columns of matrix A are 2 and 3, respectively. Thus,
matrix A is a 2 × 3 matrix.

Example 2. What are the dimensions of matrix B?


 
1 2
0 5
B=  1 −2

−1 3
2.1. INTRODUCTION TO MATRICES 41

Solution:
The number of rows and columns of matrix B are 4 and 2, respectively. Thus,
matrix B is a 4 × 2 matrix.

Matrix Elements
The entries that appear in the rows and columns of a matrix are called elements
of a matrix. Each element in a matrix is identified by naming the row (i) and
column (j) in which it appears.
Example 3. Consider the matrix C, identify the element in a13 .
 
1 2 4
C = 0 5 1
1 −2 0

Solution:
The element in a13 is the entry in the 1st row and 3rd column, i.e. i = 1 and
j = 3. Thus, a13 = 4.
Example 4. Consider a 3 × 2 matrix D and a21 = 4. Construct the matrix
that satisfies the given conditions.
Solution:
The matrix D is a 3 × 2 matrix then it must have two rows and three columns.
Also, the matrix must have an entry of 4 in the 2nd row and 1st column,
a21 = 4. Thus, it may correspond to the matrix below:
 
1 0 2
C=
4 5 1
(Note: There could be infinitely many matrices that can satisfy the given
conditions in this example.)

Types of Matrices
Some of the types of matrices that will be enumerated here will be discussed in
a more detailed manner in the succeeding topics in this reference.

1. Row Matrix
A matrix having only one row is called a row matrix. Generally the size
of this matrix is 1 × n as illustrated below:

 
a11 a12 a13 ··· a1n

2. Column Matrix
A matrix having only one column is called a column matrix. Generally
the size of this matrix is m × 1 as illustrated below:
42 MODULE 2. MATRICES AND ITS APPLICATIONS

 
a11
 a21 
 
 a31 
 
 .. 
 . 
am1

3. Zero/Null Matrix
A matrix whose entries or elements are all zero is called zero or null
matrix. Zero matrices play a similar role in operations with matrices
as the number zero plays in operations with real numbers. Also, zero
matrices is usually denoted by O from the English alphabet. Below is an
illustration of general form for a zero matrix:
 
011 012 ··· 01n
 021 022 ··· 02n 
Omn = .
 
.. .. .. 
 .. . . . 
0m1 0m2 ··· 0mn

4. Singleton Matrix
A matrix with only one element or entry is called a singleton matrix. The
size of this matrix is 1 × 1 as illustrated below

 
a11

5. Vertical Matrix
An m × n matrix is called a vertical matrix if the number of rows ex-
ceeds the number of columns, i.e. m > n. An example of this matrix is
illustrated below:
 
1 0
4 5
2 3

6. Horizontal Matrix
An m × n matrix is called a horizontal matrix if the number of columns
exceeds the number of rows, i.e. m < n. An example of this matrix is
illustrated below:
 
1 0 1
4 5 2

7. Square Matrix
A matrix with the same number of rows and columns, i.e. m = n is called
2.1. INTRODUCTION TO MATRICES 43

a square matrix. Further, a square matrix is also called an n × n matrix.


Below is an illustration of the general form for a square matrix:

 
a11 a12 ··· a1n
 a21
 a22 ··· a2n 

 .. .. .. .. 
 . . . . 
an1 an2 ··· ann

8. Diagonal Matrix
A square matrix where all the entries outside the main diagonal are all
zero, i.e. aij =0 for i 6= j, is called a diagonal matrix. Below is an
illustration of the general form for a diagonal matrix:

 
a11 0 ··· 0
 0
 a22 ··· 0 

 .. .. .. .. 
 . . . . 
0 0 ··· ann

9. Scalar Matrix
A diagonal matrix where all the entries in the main diagonal are equal,
i.e. a11 = a22 = a33 = · · · = ann , is called a scalar matrix. An example
of a scalar matrix is illustrated below:

 
2 0 0
0 2 0
0 0 2

10. Unit/Identity Matrix


A diagonal matrix where all the entries in the main diagonal are all equal
to 1 is called an identity or unit matrix. Also, identity matrices is usually
denoted by I from the English alphabet.

 
111 0 ··· 0
 0 122 ··· 0 
Inn = .
 
.. .. ..
 ..

. . . 
0 0 ··· 1nn

11. Upper Triangular Matrix


A square matrix is called an upper triangular matrix if all entries below
the main diagonal are all zero, i.e. aij = 0, ∀ i > j. A general form of an
upper triangular matrix is illustrated below:
44 MODULE 2. MATRICES AND ITS APPLICATIONS

 
a11 a12 ··· a1n
 0
 a22 ··· a2n 

 .. .. .. .. 
 . . . . 
0 0 ··· ann

12. Lower Triangular Matrix


A square matrix is called a lower triangular matrix if all entries above the
main diagonal are all zero, i.e. aij = 0, ∀ i < j. A general form of an
upper triangular matrix is illustrated below:
 
a11 0 ··· 0
 a21
 a22 ··· 0 

 .. .. .. .. 
 . . . . 
an1 an2 ··· ann

13. Equal Matrices


Equal matrices are those matrices which are equal in terms of their di-
mensions and corresponding elements are identical.

14. Singular Matrix


A square matrix whose determinant is equal to zero, |A| = 0, is called
a singular matrix. This means that the inverse of the matrix does not
exists.

15. Nonsingular Matrix


A square matrix whose determinant is equal to zero, |A| 6= 0, is called a
nonsingular matrix. This means that the inverse of the matrix exists.

16. Symmetric Matrix


A square matrix A is said to be symmetric if AT = A, i.e. aij = aji .

17. Skew-Symmetric Matrix


A square matrix A is said to be skew-symmetric if AT = −A, i.e. aij =
−aji .

18. Orthogonal Matrix


A square matrix is said to be orthogonal if the product of the said matrix
and its transpose is equal to the identity matrix, i.e. AAT = AT A = I.

19. Idempotent Matrix


A square matrix A is said to be idempotent if A2 = AA = A.

20. Involutory Matrix


A square matrix A is said to be involutory if A2 = AA = I, where
A−1 = A.
2.1. INTRODUCTION TO MATRICES 45

21. Nilpotent Matrix


A nilpotent matrix is a square matrix such that for the least positive
integer p, Ap = O.

2.1.2 Representing Systems of Linear Equations with


Augmented Matrices
A system of linear equations can be represented in matrix form using a coef-
ficient matrix, a variable matrix, and a constant matrix. Consider the linear
system,
x − 2y = 2 (eq. 1)
3x − y = −1 (eq. 2)
First, identify the coefficients for each variable and the constant term in each
equation. We have, 1 for x, −2 for y, and 2 as a constant term in the first
equation. In the second equation, we have 3 for x, −1 for y, and −1 as a
constant term. Based on the data gathered, we will now write them in a matrix.
Now, the coefficient matrix for the above system is
 
1 −2
.
3 −1

The variables we have in the linear system are x and y . So we can write the
variable matrix as  
x
.
y
Finally, the constant matrix whose elements are the constant terms is
 
2
.
−1

Now, the system can be represented as


    
1 −2 x 2
= .
3 −1 y −1
To check whether we got the correct representation, we need to simplify the
equation above.
        
1 −2 x (1)x + (−2)y x − 2y 2
= = =
3 −1 y (3)x + (−1)y 3x − y −1
Hence,    
x − 2y 2
=
3x − y −1
Equating the corresponding entries of the two matrices above, we have
46 MODULE 2. MATRICES AND ITS APPLICATIONS

x − 2y = 2
3x − y = −1
Augmented Matrix
An augmented matrix is a matrix form obtained by joining the columns of two
or more matrices having the same number of rows. In this, section we will
use an augmented to solve linear systems by joining the coefficient matrix and
constant matrix. To illustrate,
 
1 −2 2
3 −1 −1
is the augmented matrix by joining the coefficient matrix and constant matrix
of the linear system
x − 2y = 2
3x − y = −1
Example 1. Write the linear system below as an augmented matrix.
2x − 2y + z = 2
3x − y − z = −1
x + 2y + 3z = 5

Solution:
First, let us build for the coefficient matrix and constant matrix. We have the
coefficient matrix below:
 
2 −2 1
3 −1 −1
1 2 3
and the constant matrix is
 
2
−1 .
5
Finally, we have the augmented matrix below by joining the two matrices above:
 
2 −2 1 2
 3 −1 −1 −1  .
1 2 3 5

Example 2. Write the linear system below as an augmented matrix.


x+z =1
3x − y = −1
−x + 2y − 3z = 2
2.1. INTRODUCTION TO MATRICES 47

Solution:
To give us a clearer picture of the linear system, let’s rewrite the system to
show each of the coefficients clearly.

x + 0y + z = 1
3x − y + 0z = −1
−x + 2y − 3z = 2

Next, let us build for the coefficient matrix and constant matrix. We have the
coefficient matrix below:
 
1 0 1
 3 −1 0 
−1 2 −3

and the constant matrix is


 
1
−1 .
2

Finally, we have the augmented matrix below by joining the two matrices above:
 
1 0 1 1
 3 −1 0 −1  .
−1 2 −3 2

2.1.3 Elementary Row Operations


In the previous chapter, the three operations that produce equivalent systems
of linear equations were presented. These are:

1. Interchange the two equations in the linear system.

2. Multiply an equation by a nonzero constant.

3. Add a multiple of an equation to another equation.

In the context of a matrix, these three operations correspond to elementary row


operations. Further, two matrices are said to be row-equivalent when one can
be obtained from the other by a finite sequence of elementary row operations.
48 MODULE 2. MATRICES AND ITS APPLICATIONS

Elementary Row Operations

Each of these operations performed on a matrix convert it into its row-


equivalent matrix.
1. Interchange two rows.
2. Multiply a row by a nonzero constant.
3. Add a multiple of a row to another row.

Note: The elementary operations listed above can also be applied to


the columns of a matrix. However, in this reference we will only apply
the elementary operations to the rows of a matrix.

Example 1. Consider the matrix,


 
1 0 1
 3 −1 0
−1 2 −3

and perform the following operations in the given matrix:


1. Interchange the first equation and second equation.
2. Multiply the first row by −1 to produce a new first row.
3. Add 3 times the first row to the third row to produce a new third row.

Solution:
1. Interchange the first equation and second equation.
 
3 −1 0
1 Notation
0 1
R1 ↔ R2
−1 2 −3

2. Multiply the first row by −1 to produce a new first row.


 
−1 0 −1
Notation
3 −1 0 0
−1R1 = R1
−1 2 −3

3. Add 3 times the first row to the third row to produce a new third row.
 
1 0 1
Notation
3 −1 0 0
3R1 + R3 = R3
2 2 0
2.1. INTRODUCTION TO MATRICES 49

Example 2. Using elementary row operations, solve the linear system below:
4a + 2b − 6c = 4
2a + b − 3c = 2
a+b−c=1

Solution:
First, let us set-up the augmented matrix from the given linear system. We
have,  
4 2 −6 4
 2 1 −3 2 
1 1 −1 1
Now, apply a finite sequence of elementary row operations starting from the
augmented matrix above.
 
1 1 −1 1
 2 1 −3 2  R1 ↔ R3
4 2 −6 4
 
1 1 −1 1 0

 0 −1 −1 0  −2R1 + R2 = R20
0 −2 −2 0 −4R1 + R3 = R3
 
1 1 −1 1
0
 0 1 1 0  −1R2 = R2
0 −2 −2 0
 
1 0 −2 1 0

 0 2R2 + R3 = R3
1 1 0  0

0 0 0 0 −1R2 + R1 = R1

We get a result of 0 = 0 as observed in row 3, this implies that we have


infinitely many solutions for the given linear system. From the last matrix we
get a linear system:
a − 2c = 1 (eq. 1)
b+c=0 (eq. 2)
To solve for the general solution, we need to let c = t where t is any real
number.Thus, we have the general solution of the given linear system below:
a = 1 + 2t
b = −t
Let t = 0, to solve for a particular solution to the given system. We have,
a=1
b=0
50 MODULE 2. MATRICES AND ITS APPLICATIONS

Therefore, a particular solution for the given linear system is a = 1, b = 0, and


c = 0.
Example 3. Using elementary row operations, solve the linear system below:
4x + 2y − 6z = 5
2x + y − 3z = 2
x+y−z =1

Solution:
First, let us set-up the augmented matrix from the given linear system. We
have,
 
4 2 −6 5
 2 1 −3 2 
1 1 −1 1
Now, apply a finite sequence of elementary row operations starting from the
augmented matrix above.
 
1 1 −1 1
 2 1 −3 2  R1 ↔ R3
4 2 −6 5
 
1 1 −1 1 0

 0 −1 −1 0  −2R1 + R2 = R20
0 −2 −2 1 −4R1 + R3 = R3
 
1 1 −1 1
0
 0 1 1 0  −1R2 = R2
0 −2 −2 1
 
1 0 −2 1 0

 0 2R2 + R3 = R3
1 1 0  0

0 0 0 1 −1R2 + R1 = R1
We get a result of 0 = 1 from row 3 which is false, this implies that the given
linear system has no solution.
Example 4. Using elementary row operations, solve the linear system below:
x+y+z =6
2y + 5z = −4
2x + 5y − z = 27

Solution:
First, let us set-up the augmented matrix from the given linear system. We
have,
2.1. INTRODUCTION TO MATRICES 51

 
1 1 1 6
 0 2 5 −4 
2 5 −1 27
Now, apply a finite sequence of elementary row operations starting from the
augmented matrix above.
 
1 1 1 6
 0 2 5 −4  − 2R1 + R3 = R30
0 3 −3 15
 
1 1 1 6
 0 2 5 −4  1 R3 = R30
3
0 1 −1 5
 
1 1 1 6
 0 1 −1 5  R2 ↔ R3
0 2 5 −4
 
1 0 2 1 0

 0 1 −1 −1R2 + R1 = R1
5  0

0 0 7 −14 −2R2 + R3 = R3
 
1 0 2 1
1 0
 0 1 −1 5  R3 = R3
0 0 1 −2 7
 
1 0 0 5 0

 0 1 R3 + R2 = R2
0 3  0

0 0 1 −2 −2R3 + R1 = R1

Thus, the solution the system is x = 5, y = 3, and z = −2. Specifically, the


procedure that we used in solving the linear system above is called the Gauss-
Jordan Elimination Method. However, if we stop applying the elementary
row operations and finally, get the matrix below:
 
1 0 2 1
 0 1 −1 5 
0 0 1 −2
and use back-substitution after converting the matrix into a linear system is
called the Gaussian Elimination Method. In addition, using either of the
two methods will come up with same result.
Furthermore, the matrix
 
1 0 2 1
 0 1 −1 5 
0 0 1 −2
52 MODULE 2. MATRICES AND ITS APPLICATIONS

is in row echelon form. On the other hand, the matrix below:


 
1 0 0 5
 0 1 0 3 
0 0 1 −2
is in reduced row echelon form.

Row Echelon Form

A matrix is in row echelon form (ref) when it satisfies the following


conditions:
1. Rows with all zero elements, if any, are at the bottom of the matrix.
2. The leading entry of each nonzero row is 1.

3. The leading entry of a nonzero row is in a column to the right of


the leading entry in the previous row.
Note: A matrix in row echelon form is said to be in reduced row
echelon form if the leading entry in each row is the only nonzero entry
in its column.

Example 5. For each of the following matrices, determine whether it is in


row echelon form, reduced row echelon form, or neither.
     
1 2 3 1 2 0 0 0 0 0
1. 0 1 1 3. 0 −1 1 5.  0 1 −1 5 
0 0 0 0 0 1 0 0 1 −2
   
1 2 0 1 2 0 2
2. 0 0 1 4.  0 1 −1 5 
0 0 0 0 0 0 0

Solution:

1. This matrix is in row echelon as it satisfies all its conditions. However,


having a leading entry of 1 in row 2 and it is not the only nonzero in its
column, then the matrix is not eligible to be called a reduced row echelon
form.

2. The given matrix is in reduced row echelon form as it satisfies all its
conditions. Thus, it is also a row echelon form.

3. This matrix is neither row echelon form nor reduced row echelon form as
it does not satisfy a condition that all leading entries must be 1 as seen
in row 2.
2.1. INTRODUCTION TO MATRICES 53

4. Similar to number 1, this matrix is in row echelon form as it satisfies all


its conditions but not in reduced echelon form.
5. This matrix is neither row echelon form nor reduced row echelon form
because a row with all elements equal to zero is not at the bottom of the
given matrix.

Exercises
A. Consider the matrices below:
 
  1 2 0  
1 2 −1 1 2
A= B =3 −1 7 C=
2 −11 5 2 −1
11 0 5
   
2 3 12 5 1
D =  8 1 E =  2 −1 −3
−1 4 7 −6 4
Identify the following ij-entries:
1. a11 , a13 , a22
2. b13 , b21 , b32
3. c12 , c21 , c22
4. d11 , d22 , d32
5. e12 , e22 , e23
B. True or False. Write T if the statement is true, otherwise write F. If you
answered false, justify your answer.
1. If there are t rows and s columns in the matrix then order of matrix is
s × t.
2. A matrix in which number of rows and number of columns are equal is
said to be a square matrix.
3. The individual quantities like a11 , a21 , a13 , · · · , amn are called the coeffi-
cients of the matrix.
4. The matrix is denoted by small letters like a, b and c.
5. All identity matrices are also scalar matrices.
6. A matrix in which there is only one column and any number of rows is
said to be a column matrix.
7. An n × n matrix is called upper triangular if aij = 0 when i < j.
8. If all the elements of matrix are 1 is known as a unit matrix.
54 MODULE 2. MATRICES AND ITS APPLICATIONS

9. A 3 × 4 matrix has four columns and three rows.


10. Two matrices are said to be equal only if the number of rows in both
matrices are equal.
C. Determine whether the following matrices is in row echelon form, reduced
row echelon form, or neither. Justify your answer.
     
1 0 0 1 2 0 0 0 0 0
1. 0 1 −1 3. 0 0 1 5.  0 1 −1 5 
0 0 0 0 1 0 0 0 0 0
   
1 2 0 1 0 0 2
2. 0 0 −1 4.  0 1 −1 5 
0 0 0 0 0 0 0

D. Computations. Solve the following linear systems completely and show all
necessary solutions.
  
 x1 − 3x2 − 5x3 = −1
 −2a − 4b + c = −2
  x + 4y − z = 2

1. 3x1 − x3 = −2 3. 2a + 2b − c = 4 5. 2x − 2y + 3z = 3
  
−x1 − 2x2 − 3x3 = 1 a − 3b − 2c = 1 x − y + 2z = 1
  

3w − 3x − 4y − 2z

 =2
 x1 − 3x2 + 5x3 = −1


 −w + 2x − 3y + 3z

=0
2. 2x1 − x2 − 3x3 = 2 4.
  2w − 2x + y − 2z =1
−x1 − 2x2 + 3x3 = 1
 

+ y − 2z = −1

w

Challenge Yourself
Is row echelon form of a matrix unique? Justify your answer and give an
example to support your explanation.

2.2 Operations on Matrices


Learning Objectives
• Perform the matrix operations of addition, multiplication and scalar mul-
tiplication.
• Prove the different properties of matrix addition, matrix multiplication,
and scalar multiplication.
• Recognize when matrix addition and multiplication are defined.
In this section, a discussion of elementary matrix arithmetic and its properties
will be presented. This also includes illustrations of these terms through worked
exercises and proofs.
2.2. OPERATIONS ON MATRICES 55

2.2.1 Matrix Addition


The matrix addition on two matrices is only defined when both matrices have
the same dimensions or of the same sizes. If A and B are both m × n matrices,
then the sum C, A + B = C, is also an m × n matrix and is defined to have each
element the sum of the corresponding elements of A and B, i.e. aij + bij = cij
where aij , bij , and cij are real numbers.

Example 1. Use the following matrices:


     
1 2 1 2 0 1 2
A = 2 −11 B =  2 −1 1 C =  2 −1
0 3 11 0 1 11 0
   
1 2 0 1 0 1
D = 3 0 1 E = 2 1 −3
0 −1 4 1 −1 4

Compute the following, if possible:


1. (B + D) + E
2. B + (D + E)
3. A + C
4. C + A
5. B + C

Solution:
     
1 2 0 1 2 0 1 0 1
1. (B + D) + E =  2 −1 1  +  3 0 1  +  2 1 −3 
11 0 1 0 −1 4 1 −1 4
 
(1 + 1) + 1 (2 + 2) + 0 (0 + 0) + 1
=  (2 + 3) + 2 (−1 + 0) + 1 (1 + 1) + (−3)
(11 + 0) + 1 [0 + (−1)] + (−1)] (1 + 4) + 4
   
2+1 4+0 0+1 3 4 1
=5+2 −1 + 1 2 + (−3) =  7 0 −1 .
11 + 1 −1 + (−1) 5+4 12 −2 9

Thus, the sum of (B + D) + E is


 
3 4 1
7 0 −1 .
12 −2 9
56 MODULE 2. MATRICES AND ITS APPLICATIONS
     
1 2 0 1 2 0 1 0 1
2. B + (D + E) =  2 −1 1  +  3 0 1 + 2 1 −3 
11 0 1 0 −1 4 1 −1 4
 
1 + (1 + 1) 2 + (2 + 0) 0 + (0 + 1)
=  2 + (3 + 2) −1 + (0 + 1) 1 + [1 + (−3)]
11 + (0 + 1) 0 + [(−1) + (−1)] 1 + (4 + 4)

   
1+2 2+2 0+1 3 4 1
=2+5 −1 + 1 1 + (−2) =  7 0 −1 .
11 + 1 0 + (−2) 1+8 12 −2 9

Thus, the sum of B + (D + E) is

 
3 4 1
7 0 −1 .
12 −2 9

3.
       
1 2 1 2 (1 + 1) (2 + 2) 2 4
A+C = 2 −11+ 2 −1 =  (2 + 2) −11 + (−1) =  4 −12
0 3 11 0 (0 + 11) (3 + 0) 11 3

Thus, the sum of A + C is

 
2 4
4 −12 .
11 3

4.
       
1 2 1 2 (1 + 1) (2 + 2) 2 4
C+A =  2 −1+2 −11 =  (2 + 2) −1 + (−11) =  4 −12
11 0 0 3 (11 + 0) (0 + 3) 11 3

Thus, the sum of A + C is


 
2 4
 4 −12 .
11 3

5. The two matrices have different dimensions, i.e. B is a 3 × 3 matrix while


C is a 3 × 2 matrix. Thus, B + C is not possible under matrix addition.
2.2. OPERATIONS ON MATRICES 57

Properties of Matrix Addition

Let A, B, and C be m × n matrices.

1. A + B = B + A
2. A + (B + C) = (A + B) + C
3. There is unique m × n matrix O such that

A+O =O+A=A

for any matrix A. The m × n matrix O is called the zero matrix.


4. For each m × n matrix A = [aij ], there is a unique m × n matrix
D such that

A+D =D+A=O

where, D = [−aij ]. We say, matrix D is the negative of A.

Proof.

1. Let A = [aij ] and B = [bij ]. Further, let A + B = C = [cij ] and B + A =


D = [dij ]. Show C = D. By matrix addition, the elements in matrix C
is the sum of the corresponding elements of A and B, i.e. aij + bij = cij .
Similarly, bij + aij = dij are the elements in matrix D. Since aij and bij
are elements of real numbers, aij +bij = bij +aij by commutative property
of addition on real numbers. Thus, cij = dij . This further implies that C
and D are equal matrices, i.e. C = D.

2. Let A = [aij ], B = [bij ] and C = [cij ]. Further, let A+(B+C) = D = [dij ]


and (A + B) + C = E = [eij ]. Show that D = E. Notice that for each
ij-entry in matrix addition, dij = aij + (bij + cij ) = (aij + bij ) + cij = eij
by associative property of addition on real numbers. Hence, D = E.

The proofs for 3 and 4 are left as an exercise.

2.2.2 Matrix Multiplication


The matrix multiplication on two matrices A and B, written AB, is not the
same when dealing with real numbers. Assume A = [aik ] and B = [bkj ] such
that the number of columns of matrix A is equal to the number of rows of matrix
B, i.e. A is an m × p matrix and B is a p × n matrix. So, AB = C = [cij ] is an
m × n matrix whose ij-entry is obtained by multiplying the ith row of matrix A
p
P
by the jth column of B. Thus, cij = ai1 b1j + ai2 b2j + · · · + aip bpj = aik bkj .
k=1
58 MODULE 2. MATRICES AND ITS APPLICATIONS
 
  0 −1
1 2 0
Example 1. Given A = and B = 3 1 , find: (1) AB,
3 0 −1
1 −1
(2) BA.
Solution:
1. A is a 2 × 3 matrix and B is a 3 × 2 matrix, then AB is defined and is a
2 × 2 matrix. To obtain the entries in the first column of AB, multiply
the rows of A by the first column of B. Also to obtain the entries in the
second column of AB, multiply the rows of A by the the second column
of B. We have,
 
  0 −1  
1 2 0 1(0) + 2(3) + 0(1) 1(−1) + 2(1) + 0(−1)
AB =  3 1 = 
3 0 −1 3(0) + 0(3) + (−1)(1) 3(−1) + 0(1) + (−1)(−1)
1 −1
 
6 1
=
−1 −2
 
6 1
Thus, AB = .
−1 −2
2. B is a 3 × 2 matrix and B is a 2 × 3 matrix, then BA is defined and is a
3 × 3 matrix. We have,
   
0 −1   0(1) + (−1)(3) 0(2) + (−1)(0) 0(0) + (−1)(−1)
1 2 0
BA = 3 1  =  3(1) + 1(3) 3(2) + 1(0) 3(0) + 1(−1) 
3 0 −1
1 −1 1(1) + (−1)(3) 1(2) + (−1)(0) 1(0) + (−1)(−1)
 
−3 0 1
=  6 6 −1
−2 2 1
 
−3 0 1
Thus, BA =  6 6 −1.
−2 2 1
     
1 2 1 2 −1
Example 2. Let A = , B= and C= . Solve,
3 0 1 1 3
(1) (A + B)C, (2) C(A + B).
Solution:
1. A and B are both 2 × 2 matrices, then A + B is defined and is a 2 × 2
matrix also. Since C is 2 × 1 matrix, (A + B)C is defined and is a 2 × 1
matrix. First, we need to solve for A + B. We have,
       
1 2 1 2 1+1 2+2 2 4
A+B = + = =
3 0 1 1 3+1 0+1 4 1
2.2. OPERATIONS ON MATRICES 59

Next,
      
2 4 −1 2(−1) + 4(3) 10
(A + B)C = = =
4 1 3 4(−1) + 1(3) −1
 
10
Thus, (A + B)C = .
−1
2. Both A and B are 2 × 2 matrices, then A + B is defined and is a 2 × 2
matrix. But C is a 2 × 1 matrix. Thus, C(A + B) is not defined under
matrix multiplication.

Properties of Matrix Multiplication

Let A, B, and C be matrices of appropriate sizes.

1. (AB)C = A(BC)
2. (A + B)C = AC + BC
3. C(A + B) = CA + CB

Proof.

1. Let A = [aij ], B = [bjk ], and C = [ckm ]. Further, AB = S = [sik ] and


u
P
BC = T = [tkm ]. The ik-entry of matrix S is sik = aij bjk and the
j=1
v
P
km-entry of matrix T is tjm = bjk ckm . Furthermore, the im-entry of
k=1
v
P v P
P u
SC is si1 c1m + si1 c1m + · · · + siv cvm = sik ckm = (aij bjk )ckm
k=1 k=1 j=1
u
P
and the im − entry of AT is ai1 t1m + ai2 t2m + · · · + aiu tum = aij tjm =
j=1
u P
P v
aij (bjk ckm ). This implies that corresponding elements in (AB)C
j=1 k=1
and A(BC) are equal. Therefore, (AB)C = A(BC).

Proofs for (2) and (3) are left as an exercise.

2.2.3 Scalar Multiplication of Matrices


If A = [aij ] is an m × n matrix and r is a real number, then the scalar multiple
of A by r is the m × n matrix rA, rA = [raij ]. This means rA is obtained by
multiplying each entry of matrix A by r.
Example 1. For the given matrices below, solve: (1) (2) 2A, −1B, and (3)
A − B.
60 MODULE 2. MATRICES AND ITS APPLICATIONS
   
1 2 0 1 2 0
A = 2 −1 1 and B = 2 −1 1
0 3 1 1 0 1

Solution:
     
1 2 0 2(1) 2(2) 2(0) 2 4 0
1. 2A = 2 2 −1 1 = 2(2) 2(−1) 2(1) = 4 −2 2
0 3 1 2(0) 2(3) 2(1) 0 6 2
     
1 2 0 −1(1) −1(2) −1(0) −1 −2 0
2. −1B = −1 2 −1 1 = −1(2) −1(−1) −1(1) = −2 1 −1
1 0 1 −1(1) −1(0) −1(1) −1 0 −1
3. From (2) −1B = −B,we have
   
1 2 0 −1 −2 0
A − B = A + (−B) = 2 −1 1 + −2 1 −1
0 3 1 −1 0 −1
   
1 + (−1) 2 + (−2) 0+0 0 0 0
= 2 + (−2) −1 + 1 1 + (−1) =  0 0 0
0 + (−1) 3+0 1 + (−1) −1 3 0

Properties of Scalar Multiplication

Let A, B, and C be matrices of appropriate sizes and r and s are real


numbers.
1. r(sA) = (rs)A
2. (r + s)A = rA + sA

3. r(A + B) = rA + rB
4. A(rB) = r(AB) = (rA)B

Proof.
1. Let A = [ai ] and r,s be any real numbers. Further, the ij-entry of sA is
saij . So, the ij-entry of r(sA) is r(saij ) and by the associative property of
real numbers (r(saij ) = (rs)aij , where (rs)aij is the ij − entry of (rs)A.
Thus, r(sA) = (rs)A.
2. Let A = [aij ] and r,s be any real numbers. Further, the ij-entry of
(r + s)A is (r + s)aij . By the distributive property of real numbers,
(r + s)aij = raij + saij , where raij + saij is the ij-entry of rA + sA.
Hence, (r + s)A = rA + sA.
2.2. OPERATIONS ON MATRICES 61

Proofs for the remaining scalar multiplication properties are left as an exercise.

Exercises
A. Let
   
1 2 1 −2 0  
1 2
A = 2 −11 B = 2 −1 1 C=
2 −1
0 3 1 0 1
   
1 2 0 1
D = 3 0 1 E =  0 
0 −1 4 −1

If possible, compute the following:

1 6. BA
1. BD − B
2
2. BE 7. DA + BA

3. DB 8. −3DE

4. B 2 + 2D 9. BE − DE

5. AC 3 10. E(B + D)

B. Suppose A and B are 3 × 3 matrices, where B is a diagonal matrix.

1. Describe the sum A + B. Illustrate your answer with examples.

2. Describe the product AB. Illustrate your answer with examples.

3. Describe the product BA. Illustrate your answer with examples.

4. How do the results in parts (2) and (3) change when the diagonal entries
of B are all equal?

5. Is it possible that AB = BA? Justify your answer.

Challenge Yourself
Show that no 2 × 2 matrices A and B exist that satisfy the matrix equation
 
1 0
AB − BA = .
0 1
62 MODULE 2. MATRICES AND ITS APPLICATIONS

2.3 Transpose of a Matrix


Learning Objectives
• Find the transpose of a matrix.
• Apply the different properties of the transpose of a matrix.
• Prove the different properties of the transpose of a matrix.
The transpose of a matrix A, denoted by AT , is the matrix obtained by writing
the rows of A, in order, as columns. For example,
 T
1 2  
4 1 4 3
1 =
2 1 1
3 1

In general, if A = [aij ] is an m × n matrix, then AT = [aji ] is the n × m matrix.


Example 1. Find the transpose of each matrix below:
 
1    
1 2 0 1 3
A= 2   B= C=
2 1 1 2 −1
0
 
  1 2
D= 1 2 0 E = 0 −1
1 −1

Solution:
 T
1  
1. AT = 2 = 1 2 0
0
 
 T 1 2
T 1 2 0
2. B = = 2 1
2 1 1
0 1
 T  
1 3 1 2
3. C T = =
2 −1 3 −1
 
 T 1
4. DT = 1 2 0 = 2
0
 T
1 2  
T 1 0 1
5. E = 0
 −1 =
2 −1 −1
1 −1
2.3. TRANSPOSE OF A MATRIX 63

Properties of Transpose of a Matrix

Let A and B be matrices of appropriate sizes and r is a scalar.

1. (AT )T = A
2. (A + B)T = AT + B T
3. (AB)T = B T AT
4. (rA)T = rAT

Proof.
1. Let A be an m × n matrix. The ij-entry of AT is the ji-entry of A, then
the ij-entry of (AT )T is the ji-entry of AT , which is the ij-entry of A.
Thus, (AT )T = A.
2. Let A and B be both m × n matrices. The ij-entry of AT + B T is the
sum of ij-entries of AT and B T , which are the ji-entries of A and B,
respectively. Thus, the ij-entry of AT + B T is the ji-entry of the sum
of A and B which is equal to the ij-entry of the transpose of A + B.
Therefore, (A + B)T = AT + B T .
Proofs for the remaining properties of the transpose of a matrix are left as an
exercise.

Example 2. Let
     
1 2 1 1 3
A= B= C=
−2 0 2 0 1

Solve:

1. (AB)T 3. 2B T
2. AT + C T 4. A + B T

Solution:
   T  T
T 1 2 1 5  
1. (AB) = = = 5 −2
−2 0 2 −2
 T  T      
1 2 1 3 1 −2 1 0 2 −2
2. AT + C T = + = + =
−2 0 0 1 2 0 3 1 5 1
 T
T 1    
3. 2B = 2 =2 1 2 = 2 4
2
64 MODULE 2. MATRICES AND ITS APPLICATIONS

4. A is a 2 × 2 matrix while B is a 2 × 1 matrix. Thus, B T is a 1 × 2 matrix.


Therefore, A + B T is not define under matrix addition.

Exercises
A. Consider s = 2, t = −1 and
     
1 2 3 1 1 3 1
A = −2 0 1  B = 2 C = 0 1 0 .
1 2 −1 3 2 1 −2

Solve:

1. (sAtB)T 3. stB T
2. sAT + tC T 4. A − C T

B. Let A and B be n × n matrices.


1. Show that A − AT is skew-symmetric.
2. Show that A + AT is symmetric.
3. Let A and B be skew-symmetric matrices. Show that A + B is skew-
symmetric.
4. Let A and B be symmetric matrices. Prove that the product AB is
symmetric if and only if AB = BA.
5. Show that if A is skew-symmetric, then the elements on the main diagonal
of A are all zero.

2.4 Inverse of a Matrix


Learning Objectives
• Find the inverse of a matrix, if possible.
• Apply the different properties of the inverse of a matrix.
• solve linear systems using an inverse matrix.
• Factor a matrix into a product of elementary matrices.
• Solve and apply the LU-factorization of a matrix to solve a linear system.
A square matrix A is said to be nonsingular or invertible, if there exists a square
matrix B such that AB = BA = I, where B is called the inverse of A, denoted
by A−1 . Otherwise, A is called singular or noninvertible.
2.4. INVERSE OF A MATRIX 65

Theorem 2.4.1. The inverse of a matrix A, if it exists, is unique.


Proof. Let B and C be inverses of A. It follows that AB = BA = I and AC =
CA = I. Show that B = C. Then B = BI = B(AC) = (BA)C = IC = C,
which proves that the inverse of a matrix is unique.

Example 1. Show that B is the inverse of A, where


   
2 5 3 −5
A= B=
1 3 −1 2

Solution:
Show that AB = I2 = BA. We have,
      
2 5 3 −5 2(3) + 5(−1) 2(−5) + 5(2) 1 0
AB = = = = I2
1 3 −1 2 1(3) + 3(−1) 1(−5) + 3(2) 0 1
      
3 −5 2 5 3(2) + (−5)(1) 3(5) + (−5)(3) 1 0
BA = = = = I2
−1 2 1 3 −1(2) + 2(1) −1(5) + 2(3) 0 1

Thus, B is the inverse of A.


 
1 1
Example 2. Find the inverse of A, A = .
2 1
Solution:
 
a b
Let X = be the inverse of A. To find the inverse of A, we need to
c d
solve the matrix equation AX = I2 for X. We have,
      
1 1 a b a+c b+d 1 0
AX = = =
2 1 c d 2a + c 2b + d 0 1

Equating corresponding entries, we obtain two systems of linear equations. We


have,

a+c=1 b+d=1
2a + c = 0 2b + d = 0

Using elimination method, we have


 a = −1, b = 1, c = 2, and d = −1. Thus,
−1 −1 1
the inverse of A is X = A = . To check,
2 −1
      
1 1 −1 1 1(−1) + 1(2) 1(1) + 1(−1) 1 0
AX = = = = I2
2 1 2 −1 2(−1) + 1(2) 2(1) + 1(−1) 0 1
      
−1 1 1 1 −1(1) + 1(2) −1(1) + 1(1) 1 0
XA = = = = I2
2 −1 2 1 2(1) + (−1)(2) 2(1) + (−1)(1) 0 1
66 MODULE 2. MATRICES AND ITS APPLICATIONS

Finding the Inverse of a Matrix by Gauss-Jordan Elimination

Let A be an n × n matrix.
 
1. Create a partitioned matrix A I , i.e. adjoining matrix I to
matrix A.
2. Perform Gauss-Jordan Elimination on the partitioned matrix with
the objective of converting the first part of the matrix to reduced
row echelon form. The result will be the matrix I A−1 . If
 

not possible, then matrix A is noninvertible or singular.


3. Check by multiplying, AA−1 = I = A−1 A.

 
1 2 1
Example 3. Find the inverse of A = 0 2 1.
1 1 0
Solution:

Using Gauss-Jordan elimination in finding the inverse of a matrix, we have


 
1 2 1 1 0 0
 0 2 1 0 1 0 
1 1 0 0 0 1
 
1 2 1 1 0 0
0
 0 2 1 0 1 0  −R1 + R3 = R3
0 −1 −1 −1 0 1
 
1 2 1 1 0 0
 0 2 1 0 1 0  −R3 = R30
0 1 1 1 0 −1
 
1 2 1 1 0 0
 0 1 1 1 0 −1  R2 ↔ R3
0 2 1 0 1 0
 
1 0 −1 −1 0 2 0
−2R2 + R1 = R1
 0 1 1 1 0 −1  0

0 0 −1 −2 1 2 −2R2 + R3 = R3
 
1 0 −1 −1 0 2
0
 0 1 1 1 0 −1  −R3 = R3
0 0 1 2 −1 −2
 
1 0 0 1 −1 0 0

 0 1 0 −1 1 −R3 + R2 = R2
1  0

0 0 1 2 −1 −2 R3 + R1 = R1
2.4. INVERSE OF A MATRIX 67
 
1 −1 0
Thus, A−1 = −1 1 1 . To check, we have
2 −1 −2
  
1 2 1 1 −1 0
AA−1 = 0 2 1 −1 1 1
1 1 0 2 −1 −2
 
1(1) + 2(−1) + 1(2) 1(−1) + 2(1) + 1(−1) 1(0) + 2(1) + 1(−2)
= 0(1) + 2(−1) + 1(2) 0(−1) + 2(1) + 1(−1) 0(0) + 2(1) + 1(−2)
1(1) + 1(−1) + 0(2) 1(−1) + 1(1) + 0(−1) 1(0) + 1(1) + 0(−2)
 
1 0 0
= 0 1 0
0 0 1
  
1 −1 0 1 2 1
A−1 A = −1 1 1  0 2 1
2 −1 −2 1 1 0
 
1(1) + (−1)(0) + 0(1) 1(2) + (−1)(2) + 0(1) 1(1) + (−1)(1) + 0(0)
=  −1(1) + 1(0) + 1(1) −1(2) + 1(2) + 1(1) −1(1) + 1(1) + 1(0) 
2(1) + (−1)(0) + (−2)(1) 2(2) + (−1)(2) + (−2)(1) 2(1) + (−1)(1) + (−2)(0)
 
1 0 0
= 0 1 0
0 0 1
 
1 −1 0
Indeed, A−1 = −1 1 1 .
2 −1 −2
 
−1 −2
Example 4. Find the inverse of B = .
1 2

Solution:
Using the Gauss-Jordan elimination method to solve for the inverse matrix of
B, we have
 
−1 −2 1 0
1 2 0 1
 
1 2 0 1
R1 ↔ R2
−1 −2 1 0
 
1 2 0 1 0
R1 + R2 = R2
0 0 1 1
68 MODULE 2. MATRICES AND ITS APPLICATIONS

Since the right side of the


 adjoinedmatrix is already in reduce row echelon form
and not in the form of I A−1 , the inverse of B does not exists.

Properties of Matrix Inverse

Let A and B be n × n invertible matrices, r is a nonzero scalar, and k


is a positive integer.
1. AB is nonsingular and (AB)−1 = B −1 A−1
2. (AT )−1 = (A−1 )T

3. (A−1 )−1 = A
4. (Ak )−1 = (A−1 )k
1 −1
5. (rA)−1 = A
r

Proof.

1. Obviously, (AB)(AB)−1 = I. Next, we have (AB)(B −1 A−1 ) = A(BB −1 )A−1 =


AIA−1 = AA−1 = I. Similarly, (B −1 A−1 )(AB) = B −1 (A−1 A)B =
B −1 IB = B −1 B = I. Thus, AB is nonsingular or invertible. Since the
inverse is unique, we can conclude that (AB)−1 = B −1 A−1 .

2. Since A is invertible, A−1 exists. Let B = A−1 such that AB = BA = I.


Also, claim that B T = (A−1 )T . Then (AB)T = I T = I and B T AT = I.
Thus, (B T AT )((AT )−1 ) = I(AT )−1 which can be simplified as: B T =
(AT )−1 . Hence, B T = (A−1 )T = (AT )−1 . Indeed, (AT )−1 = (A−1 )T .

Proofs for the remaining properties of matrix inverse are left as an exercise.

Theorem 2.4.2. Let A, B, and C be n × n invertible matrices.

1. If AC = BC, then A = B.

2. If CA = CB, then A = B.

Proof. 1.
AC = BC
(AC)C −1 = (BC)C −1
A(CC −1 ) = B(CC −1 )
AIn = BIn
A=B
2.4. INVERSE OF A MATRIX 69

2.
CA = CB
−1
C (CA) = C −1 (CB)
(C −1 C)A = (C −1 C)B
In A = In B
A=B

Theorem 2.4.3. If A is an n × n invertible matrix then the linear system


Ax = b has a unique solution x = A−1 b.
Proof.
Ax = b
−1
A (Ax) = A−1 b
(A−1 A)x = A−1 b
In x = A−1 b
x = A−1 b

Example 5. Use an inverse matrix to solve the linear system,


x + 2y + 4z = −1
2x + y + z = 2
x + y + 2z = 1

Solution:  
1 2 4
The coefficient matrix is A = 2 1 1. Using Gauss-Jordan elimination,
1 1 2
 
−1 0 2
A−1 =  3 2 −7 (Note: The solution in finding A−1 is left as an exer-
−1 −1 3
cise). Now,
      
−1 0 2 −1 −1(−1) + 0(2) + 2(1) 3
x = A−1 b =  3 2 −7  2  =  3(−1) + 2(2) + −7(1)  = −6
−1 −1 3 1 −1(−1) + −1(2) + 3(1) 2

Thus, x = 3, y = −6, and z = 2.

2.4.1 Elementary Matrix


A square matrix is said to be an elementary matrix when it can be obtained
from the identity matrix, In , by a single elementary row operation.
70 MODULE 2. MATRICES AND ITS APPLICATIONS

Example 1. Which of the following matrices are elementary?


   
0 0 1 1 0 0
1. 0 1 0 3. 0 0 0
1 0 0 0 0 1
   
0 1 0 1 0
2. 4.
1 0 0 0 −2

Solution:
1. The given matrix is elementary. To obtain the matrix from I3 , interchange
the first row and third row.
2. Since the given matrix is not a square, the given matrix is not elementary.
3. The given matrix is not elementary. The given matrix was obtained by
multiplying 0 to the second row. A row must be multiplied by a nonzero
scalar to obtain an elementary matrix.
4. The given matrix is elementary. To obtain the given matrix from I2 ,
multiply the second row by −2.
Theorem 2.4.4. Let E be an elementary matrix obtained by performing an
elementary row operation on In . If the same elementary row operation is per-
formed on an m × n matrix A, then the resulting matrix is equal to EA.

Row Equivalent Matrices

Suppose A and B are m × n matrices. Matrix B is said to be row


equivalent to matrix A when there exists a finite number of elementary
matrices E1 , E2 , · · · , Ek , where k is a positive integer, such that B =
Ek Ek−1 · · · E2 E1 A.

Theorem 2.4.5. If E is an elementary matrix, then E −1 exists and also an


elementary matrix.
Theorem 2.4.6. An n × n matrix A is said to be invertible or nonsingular if
and only if it can be written as the product of elementary matrices.
Theorem 2.4.7. If A is an n × n matrix, then the following statements are
equivalent:
1. A is invertible or nonsingular.
2. A is row equivalent to the identity matrix In .
3. A can be written as the product of elementary matrices.
2.4. INVERSE OF A MATRIX 71

Example 2. Find a sequence of elementary


 matrices thatcan be used to
1 0 −1 1
write the matrix A in row echelon form, A = 0 −1 2 1.
2 2 1 0

Solution:
   
1 0 −1 1 1 0 0
0
0 −1 2 1  − 2R1 + R3 = R3  0 1 0 = E1
0 2 3 −2 −2 0 1
   
1 0 −1 1 1 0 0
0
0 1 −2 −1 − R2 = R2 0 −1 0 = E2
0 2 3 −2 0 0 1
   
1 0 −1 1 1 0 0
0
0 1 −2 −1 − 2R2 + R3 = R3 0 1 0 = E3
0 0 7 0 0 −2 1
 

1 0 −1 1
 1 0 0
1
R3 = R3 0 1 0 = E
0 
0 1 −2 −1  4
7 1

0 0 1 0 0 0
7
Let B an m × n matrix, where B = E4 E3 E2 E1 A. We have
 
1 0 0 1 0

0 1 0 0

1

0 0 1 0 −1 1

0 1 0  0
B= 1 0 0 −1 0  0 1 0 0 −1 2 1
1

0 0 0 −2 1 0 0 1 −2 0 1 2 2 1 0
7
 
1 0 −1 1
= 0 1 −2 −1
0 0 1 0

Thus, the two matrices A and B are row equivalent.


Example 3. Find a sequence
 of
 elementary matrices whose product is the
1 3
nonsingular matrix A, A = .
1 2

Solution:
   
1 3 0 1 0
− R1 + R2 = R2 = E1
0 −1 −1 1
   
1 3 0 1 0
− R2 = R2 = E2
0 1 0 −1
72 MODULE 2. MATRICES AND ITS APPLICATIONS
   
1 0 0 1 −3
− 3R2 + R1 = R1 = E3
0 1 0 1

Thus, E3 E2 E1 A = I2 . To solve for A, we have E1−1 E2−1 E3−1 (E3 E2 E1 A) =


E1−1 E2−1 E3−1 I2 =⇒ A = E1−1 E2−1 E3−1 . We have the following inverses for each
elementary matrix:
     
1 0 1 0 1 3
E1−1 = , E2−1 = , E3−1 =
1 1 0 −1 0 1
     
1 0 1 0 1 3 1 3
Hence, A = = .
1 1 0 −1 0 1 1 2

2.4.2 LU Decomposition
If an n × n matrix A can be written as the product of a lower triangular matrix
L and an upper triangular matrix U , then A = LU is an LU decomposition of
A.
 
1 −3
Example 1. Find an LU decomposition of the matrix A, A = .
1 1

Solution:
We begin by applying elementary row operations to matrix A to find an upper
triangular matrix which is row equivalent to matrix A.
   
1 −3 0 1 0
− R1 + R2 = R2 = E1
0 4 −1 1
 
1 0
Thus, E1 A = U =⇒ A = E1−1 U , where L = E1−1 . Also, E1−1 =
1 1
(Note: Getting the inverse of E1 is left as an exercise). Therefore, the LU
decomposition of matrix A is
  
1 0 1 −3
A = LU = .
1 1 0 4
 
1 2 2
Example 2. Find an LU decomposition of the matrix B, B = 0 −1 2.
1 3 1

Solution:
We begin by applying elementary row operations to matrix B to find an upper
triangular matrix which is row equivalent to matrix B.
   
1 2 2 1 0 0
0
0 −1 2  − R1 + R3 = R3  0 1 0 = E1
0 1 −1 −1 0 1
2.4. INVERSE OF A MATRIX 73
   
1 2 2 1 0 0
0
0 −1 2 R2 + R3 = R3 0 1 0 = E2
0 0 1 0 1 1
    
1 2 2 1 0 0 1 0 0
We have now, U = 0 −1 2 and L = E1−1 E2−1 = 0 1 0 0 1 0 =
0 0 1 1 0 1 0 −1 1
    
1 0 0 1 0 0 1 2 2
0 1 0. Thus, B = LU = 0 1 0 0 −1 2.
1 −1 1 1 −1 1 0 0 1
Example 3. Solve the linear system below by LU decomposition.
x1 + 2x2 + 2x3 = 1
−x2 + 2x3 = −1
x1 + 3x2 + x3 = 1

Solution:
From Example 2 the LU decomposition of the coefficient matrix B,
  
1 0 0 1 2 2
B = LU = 0 1 0 0 −1 2. Now, let y = U x and solve the
1 −1 1 0 0 1
system Ly = b for y. We have,
    
1 0 0 y1 1
0 1 0 y2  = −1 From the matrix equation above, we have
1 −1 1 y3 1
y1 = 1
y2 = −1
y1 − y2 + y3 = 1
Using  substitution method, y3 = −1. Thus, the solution for Ly = b is
 back
1
y = −1. Next, solve the equation U x = y for x. We have,
−1
    
1 2 2 x1 1
0 −1 2 x2  = −1
0 0 1 x3 −1

Based on the above matrix equation, we have the linear system


x1 + 2x2 + 2x3 = 1
−x2 + 2x3 = −1
x3 = −1
74 MODULE 2. MATRICES AND ITS APPLICATIONS

Using back-substitution, x1 = 5, x2 = −1, and x3 = −1.

Exercises
1. Find theinverse of the matrix, if it exists.
   
1 2 2 1 0 −1
(a) 1 −1 0  (c) 2 0 1 
2 0 −1 1 0 2
 
  −1 1 −1
1 2 (d)  2 3 1 
(b)
4 −1 1 2 −2

2. Use an inverse matrix to solve each linear system.

(a) (c)
x + 2y + 2z = 1 −a + b + 2c = 2
x − y + 2z = −1 a − b + 3c = −3
x + 2y + z = 1 a − 2b + 4c = 1
(d)
(b)
a + 2b + 2c = 1 −x1 + x2 + 2x3 = 4
a − b + 2c = −1 x1 + x2 + 3x3 = −3
−2b + c = 1 x1 − x2 + 4x3 = 1

3. Determine whether the matrix is elementary. If it is an elementary matrix,


state the elementary row operation used to produce it.
   
−1 0 0 1 0 0
(a)  0 −1 0 (c) 0 1 0
0 0 0 0 −2 1
 
1 0 0
1
(d) 0 − 0
   
0 1 2
(b)
1 0 0 0 1

4. Find a sequence of elementary matrices that can be used to write the


matrix in row echelon form.
   
−1 2 −1 1 −1 1 1
(b)
(a)  0 −1 3 1 1 3 2
1 4 −1 2
2.4. INVERSE OF A MATRIX 75
   
1 3 1 1 1 3
(c) 1 −1 3 3
(d)  1 1
1

2 0 1 1 − 3
2

5. Solve each linear system using LU decomposition.

(a) (c)
3x + 2y + 2z = 1 −2x1 + x2 + 2x3 = 2
x − y + 2z = −1 x1 + x2 + 3x3 = −3
2x + 2y + z = 1 2x1 − 3x2 + 4x3 = 1

(b) (d)

2a + 3b + 2c = 1 −x1 + x2 + 2x3 = 4
a − 3b + 2c = −1 2x1 + x2 + 3x3 = −3
−2b − c = 3 x1 − x2 + 4x3 = 1

6. Write in sequence the steps in solving linear systems using LU decompo-


sition.

7. Is the product of two elementary matrices always elementary? Justify


your answer.
8. Prove the following:
(a) Show that the inverse of a symmetric invertible matrix is symmetric.
(b) If A is nonsingular and AB = O, then B = O.
(c) If A, B, and C are square matrices and ABC = I, then B is invertible
and B −1 = CA.
(d) If A is row equivalent to B and B is row equivalent to C, then A is
row equivalent to C.
(e) Let A be a nonsingular matrix. If B is row equivalent to A, then B
is also nonsingular.

Challenge Yourself
1. Find invertible matrices A and B such that A + B is singular.

2. Find singular matrices A and B such that A + B is invertible.


76 MODULE 2. MATRICES AND ITS APPLICATIONS

2.5 Matrix Applications


Learning Objectives

• Encode and decode messages using matrices.

• Find the least squares regression line for a given set of data.

2.5.1 Cryptography
Cryptography or cryptology is a method of securing information and communi-
cations through the use of codes. An encrypted message written using a secret
code is called a cryptogram. One method of making cryptogram is using matrix
multiplication. To begin, assign a number to each letter of the English alphabet
as shown below:

A B C D E F G H I J K L M
1 2 3 4 5 6 7 8 9 10 11 12 13
N O P Q R S T U V W X Y Z
14 15 16 17 18 19 20 21 22 23 24 25 26

Note: 0 is assigned for blank spaces


Example 1. Encode themessage "GOOD MORNING" using an invertible
1 0 1
matrix A, A = 2 −1 4.
3 0 2

Solution:
First, write the uncoded message in a 1 × 3 matrix based on the assigned
numbers for each letter in the English alphabet.

G O O D _ M O R N I N G
7 15 15 4 0 13 15 18 14 9 14 7

Next, we formed a 1 × 3 matrix based on the above table.


    
7 15 15 4 0 13 15 18 14 9 14 7

Now, multiply matrix A to each matrix above to make an encrypted message.


 
  1 0 1  
7 15 15 2 −1 4 = 82 −15 97
3 0 2
 
  1 0 1  
4 0 13 2 −1 4 = 43 0 30
3 0 2
2.5. MATRIX APPLICATIONS 77
 
  1 0 1  
15 18 14 2 −1 4 = 93 −18 115
3 0 2
 
  1 0 1  
9 14 7 2 −1 4 = 58 −14 79
3 0 2

The sequence of coded 1 × 3 matrices is


    
82 −15 97 43 0 30 93 −18 115 58 −14 79 .

Finally, removing the matrix notation produces the cryptogram. We have


82 -15 97 43 0 30 93 -18 115 58 -14 79 .
 
1 0 1
Example 2. Use the inverse of the matrix A, A = 2 −1 4 to decode
3 0 2
the cryptogram
82 -15 97 43 0 30 93 -18 115 58 -14 79 .

Solution:
First, use Gauss-Jordan elimination to find A−1 . We have
 
−2 0 1
A−1 =  8 −1 −2
3 0 −1
(Note: Finding the inverse of A is left as an exercise.)

Next, to decode the message, partition the message into groups of three to form
a 1 × 3 matrices.
    
82 −15 97 43 0 30 93 −18 115 58 −14 79 .

To obtain the decoded row matrices, multiply each coded matrix by A−1 .
 
  −2 0 1  
82 −15 97  8 −1 −2 = 7 15 15
3 0 −1
 
  −2 0 1  
43 0 30  8 −1 −2 = 4 0 13
3 0 −1
 
  −2 0 1  
93 −18 115  8 −1 −2 = 15 18 14
3 0 −1
78 MODULE 2. MATRICES AND ITS APPLICATIONS
 
  −2 0 1  
58 −14 79  8 −1 −2 = 9 14 7
3 0 −1

The sequence of decoded row matrices is


    
7 15 15 4 0 13 15 18 14 9 14 7

and the message is

G O O D _ M O R N I N G
7 15 15 4 0 13 15 18 14 9 14 7

2.5.2 Least Squares Regression Analysis


The method of least squares is a standard approach in regression analysis to
find the best fit for a set of data points by minimizing the sum of the squares
of the residuals made from the plotted curve. Further, least squares regression
is used to predict the behavior of dependent variables.

For a set of points (x1 , y1 ), (x2 , y2 ), · · · , (xn , yn ) the least squares regression
line is the linear function f (x) = a0 + a1 x that minimizes the sum of squared
error [y1 − f (x1 )]2 + [y2 − f (x2 )]2 + · · · + [yn − f (xn )]2 .

Matrix Form for Linear Regression

For the regression model Y = XA+E, the coefficients of the least squares
regression line are given by the matrix equation, A = (X T X)−1 X T Y
and the sum of squared error is E T E.

Example 1. Find the least squares regression line for the points (0, 1), (1, 2),
and (2, 2).

Solution:

The matrices X and Y are


   
1 0 1
X = 1 1 and Y = 2
1 2 2

Now,  
  1 0  
1 1 1  3 3
XT X = 1 1 =
0 1 2 3 5
1 2

and
2.5. MATRIX APPLICATIONS 79
 
  1  
1 1 1   5
XT Y = X = 2 =
0 1 2 6
2
 5 1

 6 2
Using Gauss-Jordan elimination, (X T X)−1 = . Now,
1 1
 

2 2
 5 1 7

 6 2 5 6
 
A = (X T X)−1 X T Y =   6 = 
  
1 1 1


2 2 2
7 1
So, the least squares regression line is f (x) = + x and the graph is shown
6 2
below:
2.5 y
f (x)

2 (1,2) (2,2)

1.5

1 (0,1)

0.5

x
−2 −1 1 2

Solving for the sum of squared error, we have

xi yi f (xi ) [yi − f (xi )]2


7 1
0 1
6 36
5 1
1 2
3 9
13 1
2 2
6 36

1 1 1 1
Thus, the sum of squared error is + + = ≈ 0.17.
36 9 36 6
Example 2. Find the least squares regression line for the points (0, 1), (1, 1),
(2, 2) and (3, 2).
80 MODULE 2. MATRICES AND ITS APPLICATIONS

Solution:
The matrices X and Y are
   
1 0 1
1 1 1
X= 1 2 and Y = 2
  

1 3 2

Now,  
  1 0  
T 1 1 1 1
1  1= 4 6
X X=
0 1 2 3 1 2 6 14
1 3

and
 
  1  
1 1 1 1 = 6
1  
XT Y = X =
0 1 2 3 2 11
2
 7 3

 10 10 
Using Gauss-Jordan elimination, (X T X)−1 =  . Now,
3 1
 

10 5
 7 3   9 

 10 10  6  10 
 
A = (X T X)−1 X T Y =   11 =  
  
3 1 2


10 5 5
9 2
So, the least squares regression line is f (x) = + x and the graph is shown
10 5
below:
2.5 y f (x)
(2,2)
2 (3,2)

1.5
(0,1)
1 (1,1)

0.5
x
−4 −2 2 4
−0.5

Solving for the sum of squared error, we have


2.5. MATRIX APPLICATIONS 81

xi yi f (xi ) [yi − f (xi )]2


9 1
0 1
10 100
13 9
1 1
10 100
17 9
2 2
10 100
21 1
3 2
10 100
1 9 9 1 1
Thus, the sum of squared error is + + + = ≈ 0.20.
100 100 100 100 5

Exercises
1. Encode the following messages:
(a) GOOD JOB
(b) GET WELL SOON
(c) SEE YOU SOON
(d) I LOVE YOU
(e) MEET ME AT CMALL
(f) GET WELL SOON
(g) HAPPY BIRTHDAY
(h) LET US MEET ON MONDAY
(i) THANK YOU
(j) BEST WISHES
2. Write down in sequence the steps in encoding the messages in number 1
and how to decode it.
3. Find the least squares regression line for the following set of points:
(a) (−1, 1), (0, 1), (1, 1), (3, 2)
(b) (−1, 1), (0, 1), (2, 1), (4, 2)
(c) (−1, 1), (0, 1), (1, 2), (2, 2), (3, 2)
(d) (−2, 1), (−1, 1), (0, 2), (1, 2), (3, 3)
(e) (−2, −1), (−1, 1), (0, −2), (1, 1), (2, 3)
(f) (2, −1), (3, 1), (4, −2), (5, 1), (7, 3)
82 MODULE 2. MATRICES AND ITS APPLICATIONS

(g) (10, 1), (11, 1), (14, 1), (15, 2)


(h) (0, 1), (1, 1), (2, 4), (4, 5), (7, 5)
(i) (0, 2), (1, 1), (2, 4), (5, 4), (7, 3)
(j) (0, 2), (1, 1), (2, 2), (3, 4), (5, 1)

4. Write down in sequence the steps in finding the least squares regression
line.

You might also like