Lesson 5
Lesson 5
A matrix is a rectangular array of numbers. A matrix with m rows and n columns is called an
m n matrix.
A matrix that has the same number of rows as columns is called a square matrix.
Two matrices are equal, if they have the same number of rows and same number of columns
and the corresponding entries in every position are equal.
1
The ith row of A is the 1 n matrix ai1 ai 2 ain . The jth column of A is the n1
a1 j
a2 j th
matrix . The (i, j) element or entry of A is the element aij .
anj
Let A aij and B bij be n m matrices. The sum of A and B, is the n m matrix that
has aij bij as its (i, j)th element. Thus A B aij bij .
Example 5.2.1
1 0 4 1 3 5
A 1 2 2 B 2 2 3
0 2 3 2 3 0
0 3 9
A B 1 0 1
2 5 3
a11 a12 ... a1n b11 b12 ... a1n c11 c12 ... c1n
a b c
21 a22 ... a2n 21 b22 ... b2n 21 c22 ... c2n
Let A and B . AB
am1 am2 ... amk bk1 bk 2 ... bkn cm1 cm2 ... cmn
where
2
c11 a11b11 a12b21 a13b31 a1k bk1
c12 a11b12 a12b22 a13b32 a1k bk 2
c13 a11b13 a12b23 a13b33 a1k bk 3
Example 5.2.2
1 3 3
3 1 4
A B 4 1 2 . Find AB.
1 2 3 23 2 4 1 33
Solution:
AB should be a 2 3 matrix.
c11 (3)(1) (1)(4) (4)(2) 15
c12 (3)(3) (1)(1) (4)(4) 24
c13 (3)(3) (1)(2) (4)(1) 3
c21 (1)(1) (2)(4) (3)(2) 13
c22 (1)(3) (2)(1) (3)(4) 7
c23 (1)(3) (2)(2) (3)(1) 10
15 24 3
Thus AB
13 7 10
Matrix multiplication is not commutative. That is if A and B are two matrices, it is not
necessarily true that AB and BA are the same.
Example 5.2.3
1 1 2 1
A B 1 1 . Does AB BA ?
2 1
Solution :
3 2 4 3
AB and BA .
5 3 3 2
Hence AB BA
3
5.2.3 Algorithm for Matrix Multiplication
The below algorithm computes the product of two matrices, where A is an m k matrix and
Example 5.2.4
How many additions of integers and multiplications of integers are used by Algorithm 1 to
multiply two n n matrices?
Solution:
There are n2 entries in the product of A and B. To find each entry requires a total of n
multiplications and n-1 additions. Hence a total of n3 multiplications and n2 (n-1) additions
are used.
Self-Assessment Exercises:
1 3 0 1 1 2 3
1. Let A 1 2 2 B 1 0 3 1 . Find AB .
2 1 1 3 2 0 2
4
5.2.4 Transpose and Powers of Matrices
Powers of matrices
If A is a n n square matrix,
A0 I n , Ar AAA A
r times
5
Zero-One matrices
A matrix with entries that are either 0 or 1 is called a zero-one matrix.
This arithmetic is based on the Boolean operations and which operate on pairs of bits,
defined by
1 if b1 b2 1
b1 b2
0 otherwise
1 if b1 1 or b2 1
b1 b2
0 otherwise
Let A aij and B bij be m n zero-one matrices. The join of A and B is the zero-one
matrix with (i, j) th entry aij bij . The join of A and B is denoted by A B . The meet of A and
B is the zero-one matrix with (i, j) th entry aij bij . The meet of A and B is denoted by A B .
Example 5.2.4
Find the join and meet of the zero-one matrices
1 0 1 0 1 0
A , B 1 1 0
0 1 0
Solution:
We find that the join of A and B is
1 0 0 1 1 0 1 1 1
A B
0 1 1 1 0 0 1 1 0
6
Self-Assessment Exercises:
1. Let A and B be two n n matrices. Show that
a) ( A B)t At Bt
b) ( A B)t Bt At
c) ( At )t A
1 0 1 0 1 1
2. Let A 1 1 0 , B 1 0 1
0 0 1 1 0 1
Find a) A B b) A B c) A3
Suggested Reading:
Chapter 3: Section 3.8, Kenneth Rosen, (2011) Discrete Mathematics and Its Applications, 7th
Edition, McGraw-Hill Education