Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

MT127 – Linear Algebra I

Lecture 3 – 2016/2017

Idrissa S. A.

Department of Mathematics - UDSM

October 30, 2016


Matrix Operations

Dot Product
The dot product or inner product of the vectors
   T
a = a1 a2 . . . an and b = b1 b2 . . . bn is defined as
n
X
a.b = a1 b1 + a2 b2 + . . . + an bn = ai bi
i=i

Example 1
 
2
   3
The dot product of u = 1 −2 3 4 and v=
−2 is

u.v = 1 × 2 + −2 × 3 + 3 × −2 + 4 × 1 = −6

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix Operations

Matrix Multiplication
If A = [aij ] is an m × p matrix and B = [bij ] is an p × n, then the product
of A and B, denoted by AB, is the m × n matrix C = [cij ], defined by

cij = ai1 b1j + ai2 b2j + . . . + aip bpj


p
X
= aik bkj (1 ≤ i ≤ m, 1 ≤ j ≤ n)
k=1

It says the i,j th element of AB is the dot product of the ith row,
rowi (A), and the jth column, colj (B) of B

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix Operations

Matrix Multiplication
 
a11 a12 ...
a1p
 a21 a22 ...
a2p 
 
  b11 b12 . . . b1j . . . b1n
 .. .. ..  b
 . . .  21 b22 . . . b2j . . . b2n 
  .. .. ..

.. 
 ai1 ai2 . . . aip   . . . . 


 .. .. ..  b
 . . .  p1 b p2 . . . b pj . . . bpn
am1 am2 . . . amp
 
c11 c12 . . . c1n
 c21 c22 . . . c2n 
= .
 
.. .. 
 .. . cij . 
cm1 cm2 . . . cmn
Pp
=⇒ cij = rowi (A).colj (B) = k=1 aik bkj

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix Operations

Example 2
 
  −2 5
1 2 −1
Let A = and B =  4 −3. Find AB
3 1 4
2 1
Solution

 
row1 (A).col1 (B) row1 (A).col2 (B)
AB =
row2 (A).col1 (B) row2 (A).col2 (B)
 
(1)(−2) + (2)(4) + (−1)(2) (1)(5) + (2)(−3) + (−1)(1)
=
(3)(−2) + (1)(4) + (4)(2) (3)(5) + (1)(−3) + (4)(1)
 
4 −2
=
6 16

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix Operations

Example 3
   
1 −2 3 1 4
Let A = 4 2 1 and B =  3 −1. Compute
0 1 −2 −2 2
1 the (3, 2) entry of AB

2 the second column of AB.


Solution. Let C = AB, then
   T
c32 = row3 (A).col2 (B) = 0 1 −2 . 4 −1 2 = −5
    
1 −2 3 4 12
col2 (C ) = Acol2 (B) = 4 2 1 −1 =  16
0 1 −2 2 −5

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix Operations

Example 4
Given any 
two non zero
 matrices
 whose product is a zero matrix.
1 2 4 −6
A= , B=
2 4 −2 3
Note: AB = 0 does not imply A = 0 or B = 0

Example 5
     
1 2 2 1 −2 7
If A = , B= , C=
2 4 3 2 5 −1
 
8 5
Then AB = AC = , but B 6= C
16 10

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix Operations

The matrix–vector product


Let the matrix A is m × n and c is an n × 1 matrix given by
   
a11 a12 . . . a1n c1
 a21 a22 . . . a2n   c2 
A= . ..  and c =  .. 
   
.. ..
 .. . . .  .
am1 am2 . . . amn cn

The matrix product Ac is m × 1 matrix


    
a11 a12 . . . a1n c1 row1 (A).c
 a21 a22 . . . a2n  c2   row2 (A).c 
Ac =  . ..   ..  = 
    
.. .. ..
 ..

. . .  .   . 
am1 am2 . . . amn cn rowm (A).c

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


The matrix-vector product cont.

       
a11 c1 + a12 c2 + . . . + a1n cn a11 a12 a1n
 a21 c1 + a22 c2 + . . . + a2n cn   a21   a22   a2n 
 =c1  ..  + c2  ..  + . . . + cn  .. 
       
 ..
 .   .   .   . 
am1 c1 + am2 c2 + . . . + amn cn am1 am2 amn
=c1 col1 (A) + c2 col2 (A) + . . . + cn coln (A)

Linear combination!
Example 5
Repeat example 3 above to verify the results
       
1 −2 3 12
col2 (AB) = Acol2 (B) = 4 4 − 1  2 + 2  1 =  16
0 1 −2 −5

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


The matrix-vector product cont.
Power of a matrix
Suppose that A is a square matrix. If p is a positive integer, then we
define the powers of a matrix as follows

Ap = A.A.A
| {z. . . A}
p factors

Power zero
If A is n × n, we also define A0 = In

Power rules
For nonnegative integers p and q
1 Ap Aq = Ap+q
2 (Ap )q = Apq
3 (AB)p 6= Ap B p for square matrix in general
ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017
Matrix properties
Theorem (properties of matrix addition)
Let A, B, C and D be m × n matrices
1 A + B = B + A (commutative property)
2 A + (B + C ) = (A + B) + C (associative property)
3 There is a unique m × n matrix O such that A + O = A for any
m × n matrix A. The matrix O is called the m × n additive identity
or zero matrix.
4 For each m × n matrix A, there is a unique matrix D such that

A+D =O

we shall write D as −A, so that

A + (−A) = O

The matrix −A is called the additive inverse or negative of A.


ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017
Matrix properties Cont.

Proof
We are going to prove part 1 and 3. The rest are left as exercise
Proof:
1) Let A = [aij ] and B = [bij ] be m × n matrices, then

A + B = [aij ] + [bij ] = [aij + bij ] = [bij + aij ] = [bij ] + [aij ] = B + A

3) Let A = [aij ] and U = [uij ] be m × n matrices, then

A + U = A ⇐⇒ aij + uij = aij

which holds if and only if uij = 0. Thus U is the m × n matrix all of


whose entries are zero; U is denoted by O.

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix properties Cont.

Theorem (Matrix multiplication)


If A, B and C are of appropriate sizes, then
1 A(BC ) = (AB)C (associative)
2 A(B + C ) = AB + AC (distributive)
3 (A + B)C = AC + BC (distributive)
4 If A is m × n matrix, then

Im A = AIn = A

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix properties Cont.

Proof
Let us prove part 3. Let A and B be m × n matrices, and C be n × p.
First observe that (A + B)C and AC + BC are both m × p.
We only need to show equality of corresponding entries.
Let Q = A + B, where Q = [qij ],
(A + B)C = QC , the rsth entry of QC is given by
n
X n
X n
X n
X
qrk cks = (ark + brk )cks = ark cks + brk cks
k=1 k=1 k=1 k=1
= AC + BC

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix properties Cont.

Theorem
If A and B are m × n matrices and C is an n × p matrix, then:
1 (A + B)T = AT + B T
2 (AC )T = C T AT
3 (AT )T = A

Proof
We prove part 2. First observe that both (AC )T and C T AT are p × m
matrices.
We then need to show equality of corresponding entries.
The ijth element of (AC )T is the jith element of AC , (AC )T is
n
X
ajk cki
k=1

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017


Matrix properties Cont.

Proof cont.
The ijth element of C T AT is the dot product of

Rowi (C T )colj (AT )


= [c1i , c2i , . . . , cni ].[aj1 , aj2 , . . . , ajn ]
= c1i aj1 + c2i a21 + . . . + cni ajn
Xn
= cki ajk
k=1
Pn Pn
Since k=1 ajk cki = k=1 cki ajk , it follows that

(AC )T = C T AT

ISA MT127 – Linear Algebra I Lecture 3 – 2016/2017

You might also like