You are on page 1of 29

3.

1 Matrix Operations

A matrix is a rectangular array of numbers


called the entries, or elements, of the matrix.

The size of a matrix: a matrix is called m × n


if it has m rows and n columns.
 
" # 2
2 1 −5
, −2
 
3 −2 4
3

• A 1 × n matrix is called a row matrix (or


row vector).

• A m × 1 matrix is called a column matrix


(or column vector).

1
The double subscript notation refers to the en-
tries of the matrix A: the entry of A in row i
and column j is denoted by aij .

 
a11 a12 . . . a1n
a a22 . . . a2n 
A = [aij ]m×n =  21
 
 ... ... ... ... 

am1 am2 . . . amn

If a1, a2, . . . an are the columns of A then


h i
A = a1 a2 . . . an

If A1, A2, . . . Am are the rows of A then


 
A1
A 
A =  ..2 
 
 . 
Am

2
• A square matrix:
 an m × n matrix with
2 3 4
m = n. eg. 4 −1 0 
 
1 1 −5

• The diagonal entries of a square matrix


A are the entries a11, a22, a33, . . ..

• A diagonal matrix: a square matrix with



2 0 0
zero nondiagonal entries. eg. 0 −3 0 
 
0 0 −1

• A scalar matrix: a diagonal matrix


" with
#
−2 0
the same diagonal entries. eg.
0 −2

• 
An identity
 matrix: a 1 scalar matrix. eg.
1 0 0
0 1 0
 
0 0 1

3
Two matrices are equal if they have the same
size and if their corresponding entries are equal
i.e.
A = [aij ]m×n = B = [bij ]r×s
if and only if

m = r, n = s, aij = bij for all i, j

4
Matrix addition and scalar multiplication

If A = [aij ] and B = [bij ] are both m × n matri-


ces, then their sum A + B is the m × n matrix
obtained by adding the corresponding entries,
i.e.
A + B = [aij + bij ]

Example
   
2 1 0 3 −4 3 5 1
If A = −1 0 2 4 and B =  2 2 0 −1
   
4 −2 7 0 3 2 −4 5
 
−2 4 5 4
then A + B =  1 2 2 3.
 
7 0 3 5
" #
3 2
If C = , then C + A =?
1 6

5
If A = [aij ] is a m × n matrix and c is a scalar,
then the scalar multiple cA is the m×n matrix
obtained by multiplying each entry of A by c,
i.e.,
cA = [caij ]

Example
" # " #
2 3 4 0 2 7
Let A = and B = .
1 3 1 −1 3 −5
" # " #
4 6 8 0 −2 −7
Then 2A = and (−1)B = .
2 6 2 1 −3 5

It is common practice to denote (−1)B by −B


and it is called the negative of B.

6
If A = [aij ] and B = [bij ] are both m × n matri-
ces, then their difference A − B is the m × n
matrix obtained by adding A and the negative
of B, i.e.
A − B = A + (−B)

Example
   
2 1 0 3 −4 3 5 1
Let A = −1 0 2 4, B =  2 2 0 −1
   
4 −2 7 0 3 2 −4 5
" #
3 2
and C =
1 6
 
6 −2 −5 2
Then A − B = −3 −2 2 5 .
 
1 −4 11 −5
C − B =?.

7
A matrix all of whose entries are zero is called
a zero matrix and is denoted by O (Om×n if
the size is important).

If A is any matrix and O is the zero matrix of


the same size, then

A+O =A=O+A

A − A = O = −A + A

8
Example
" # " #
3 −1 0 1 −1 1
Let A = , B = and
1 2 −4 −2 0 6
" #
1 0 −2
C= . Compute A + B − C.
3 1 1

Example
" #
3 −1 4
Solve for a, b, c, d, e and f if A = ,
2 0 6
" # " #
a b c 7 −7 14
B= and 3A − 2B = ,
d e f 6 −6 14

9
Matrix multiplication

If A is an m × n matrix and B is an n × r matrix,


then the product C = AB is an m × r matrix.
The (i, j) entry of the product is computed as
follows: cij = ai1b1j + ai2b2j + · · · + ainbnj

Some remarks:

• The number of columns of A MUST equal


the number of rows of B to be able to
calculate AB.

10
The (i, j) entry of the matrix AB is the dot
product of the ith row of A and the j th column
of B:
n
X
cij = aik bkj
k=1

 
a a12 . . . a1n 
 11

b . . . b1j . . . b1r
 ... ... ... ... 
  11
  b21 . . . b2j . . . b2r 
a ai2 . . . ain 

 i1   ...

. . . ... . . . ... 
 ... ... ... .
.
. 
 

bn1 . . . bnj . . . bnr
am1 am2 . . . amn

11
Example
 
3 0 " #
4 −1
Let A = −1 2 and B = Compute
 
0 2
1 1
AB and BA if possible.

12
Example Compute the following products

" #" #
3 1 2 −1
1.
5 2 −5 3

 
" 3 #
5 0 −7  
2.  1 
1 5 9
−1

 
h i 3 0
3. 1 3 −3 −2 1
 
0 6

 
1 h i
4.  1  4 0 1
 
−3

13
Note that a system

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

can be written in the form

    
1 2 −1 x 5
 −1 −1 1  y  = −2
    
2 1 −2 z 1
or
Ax = b

14
Theorem 1 (Theorem 3.1) Let A be an n ×
m matrix; ei a 1 × n standard unit vector; ej an
m × 1 standard unit vector. Then

• eiA is the ith row of A

• Aej is the jth column of A

    
1 2 3 0 2
4 5 6 1 = 5
    
7 8 9 0 8
 
h i 1 2 3 h i
0 0 1 4 5 6 = 7 8 9
 
7 8 9

15
Partitioned Matrices

Let A be m × n and B be n × r
If we hpartition B in terms ofiits column vectors:
B = b1 ... b2 ... · · · ... br , then

AB = A b1 ... b2 ... · · · ... br


h i

Ab1 ... Ab2 ... · · · ... Abr


h i
=
This is called the matrix-column representa-
tion of AB.

16
Example (Example
" #
3.9) " #
3 0 4 −2 1
Let A = and B = . Com-
−1 5 0 2 3
pute AB using the matrix-column representa-
tion of the product.

17
Using the matrix-column representation we can
write the columns of AB as a linear combina-
tion of the columns of A:
" # " #
3 0 4 −2 1
Let A = and B = . Then
−1 5 0 2 3

Ab1 ... Ab2 ... · · · ... Abr


h i
AB =
where
" #" # " # " #
3 0 4 3 0
Ab1 = =4 +0
−1 5 0 −1 −5
" #" # " # " #
3 0 −2 3 0
Ab2 = = −2 +2
−1 5 2 −1 −5
" #" # " # " #
3 0 1 3 0
Ab3 = =1 +3
−1 5 3 −1 −5

18
Let A be m × n and B be n × r.
If we partition
 A in terms of its row vectors,
A1
···
 
 A2 
 
 
A = ···

 then
 ... 
 
···
 

Am
   
A1 A1 B
···  ··· 
   
 A2   A2 B 
   
   
AB =  · · · B =  ··· 
 ...   ... 
   
   
···  ··· 
   

Am Am B
This is called the row-matrix representation
of AB.

19
Example (Example
" #
3.10) " #
3 0 4 −2 1
Let A = and B = . Com-
−1 5 0 2 3
pute AB using the row-matrix representation
of the product.

20
Using the row-matrix representation we can
write the rows of AB as a linear combination
of the rows of B:
" # " #
3 0 4 −2 1
Let A = and B = . Then
−1 5 0 2 3
 
A1 B
 ··· 
 
 A2 B 
 
 
AB =  · · · 
 ... 
 
 
 ··· 
 

Am B
where
h i h i h i
A1B = 3 0 B = 3 4 −2 1 + 0 0 2 3
h i h i h i
A2B = −1 5 B = −1 4 −2 1 + 5 0 2 3

21
Let A be m × n and B be n × r. If we partition
A into columns and B into rows then
 
B1
· · ·
 
B
 
i  2

a1 ... a2 ... · · · ... a
h 
AB = n · · ·

 ... 

 
· · ·
 

Bn

= a1B 1 + a2B 2 + · · · + anB n


This is called the outer product expansion
of AB and the products aiB i are called outer
products.

22
Example (Example
" #
3.11) " #
3 0 4 −2 1
Let A = and B = . Com-
−1 5 0 2 3
pute the outer product expansion of AB.

23
Partitioned conformably for block multipli-
cation
.
 
 .
.
 2 3 .. 0
1 −1 . 0 0  ... 0 
 0 .
.  −1 1 
1 . 0 0    .
.

AB =  · · · · · · . · · ·

.
 · · · · · · .. · · · · · ·  
 
.
 
. 0 0 .. 1 
0 0 .. 2 3  
0 0 ... 1

 .
.
A11 . A12

B11 ... B 
12
=  · · · ... · · ·   · · · ... · · · 
  

A21 ... A22 B21 ... B
22

" #
A11B11 + A12B21 A11B12 + A12B22
=
A21B12 + A22B21 A21B12 + A22B22

24
Matrix Powers

If A is a square matrix we define A2 = AA and


in general, for a positive integer k we define
Ak = AA| {z· · · A}.
k factors

Theorem 2 If A is a square matrix and r and


s are nonnegative integers, then

1. Ar As = Ar+s

2. (Ar )s = Ars

25
Example (Example 3.13)

" #
1 1
• Let A = . Compute A2 and A3.
1 1

" #
1 0
• Find An if A = .
−1 1

26
The Transpose of a Matrix

The transpose of a m×n matrix A is the n×m


matrix AT obtained by interchanging the rows
and columns of A. That is, the ith column of
AT is the ith row of A for all i.

If A = [aij ] then AT = [aT


ij ] = [aji]

Example (Example 3.14)


Find the transposeof the matrices
2 1 0 3 " #
4 −2 1
A = −1 0 2 4, B = and C =
 
0 2 3
4 −2 7 0
h i
3 5 2

27
A square matrix A is symmetric if AT = A,
i.e., if A is equal to its own transpose.

A square matrix A is symmetric if and only if


Aij = Aji for all i and j.
Example  
1 3 2
The matrix A = 3 5 0 is symmetric.
 
2 0 4

28
Exercises

1. Find a matrix A such that


" # " #
1 3 2 0 −1 1
A =
0 −1 1 2 6 4

2. Find a matrix B such that


" # " #
1 3 2 3 4
B=
0 −1 1 −1 0

29

You might also like