Matrix multiplication
Suppose A and B can be multiplied to form a matrix C
n
Then AB C , where cik a
m 1
b
im mk
cik is the inner product of
the i-th row from A and
the k-th column from B
Matrix multiplication: Example
Ex: a11 a12 b11 b12 c11 c12
a b
21 a 22 21 22 21 22
b c c
Matrix multiplication 2
cik is defined only if the 2 vectors have the same
dimension
==>
Conformability: A and B can be multiplied to form AB
only if
column dimension of A = row dimension of B
Ex: b11 b12
a11 a12 a13
b21 b22
a a
21 22 a23
b31 b32
Matrix multiplication 3
If
A is of dimension m x n
B is of dimension n x p
==> C = AB is an m x p matrix
Plan for Today
Matrix multiplication – examples
Matrices vs vectors
Special matrices:
Identity matrix
Null matrix
Idempotent matrix
Rules of matrix algebra
Transpose of a matrix?
Matrix multiplication - Example
C = AB =
Matrix multiplication – Example
BA =
Matrix multiplication - Example
Note: AB and BA are different things!
in AB, we pre-multiply B by A
in BA, we post-multiply B by A
Matrices and Systems of Equations
Back to
Matrix multiplication - Matrices & Vectors
Recall: Vectors can be viewed as special types of
matrices
Matrix multiplication - Matrices & Vectors
However: If x is a column matrix and a y’ is a row
matrix, then matrix product xy’ ≠ inner product xꞏy’ !
1
Ex 1: x y ' 3 5
4
x∙y’ =
xy’ =
Matrix multiplication - Matrices & Vectors 2
1
Ex 2: u v' 3 5 2
4
u∙v’ =
uv’ =
Matrix multiplication - Matrices & Vectors 3
Ex 3: Find u’u if u ' 3 2 5 .
More generally, if u ' u1 u2 ... un , then
u’u =
Length of a vector
The length of a vector u’ is denoted as ||u||
Can be written as u u'u
Special matrices
Special matrices: Identity Matrix
In scalar algebra, multiplying by 1 changes nothing:
(1)k = k(1) = k
In matrix algebra, a similar role is played by identity
matrix, I:
IA = AI = A
How does I look like?
1 0 0
1 0
I2 I 3 0 1 0
0 1 0 0 1
Identity Matrix 2
a b
c d by I
Ex: Post-multiply and pre-multiply A
e f
Identity Matrix 3
Some implications:
1) Inserting or deleting I does not affect the matrix
product:
AIB = (AI)B = AB
2) Multiplying In by itself:
InIn = (In)2 = In
The Null Matrix
The null matrix (or zero matrix) is a matrix whose
elements are all zero
Denoted 0
Properties:
A+0=0+A=A
0A = 0
A0 = 0
Note: 0 on the right side of = may have a different
dimension in 0A than in A0
Idempotent Matrix
I and (square) 0 are examples of Idempotent
Matrices
Def: If A2 = A then matrix A is said to be idempotent.
Used frequently in econometrics
1 0
Another example: A
0 0
Idempotent Matrix 2
Q: Can a non-square matrix be idempotent?
Matrices vs Scalars
Matrices do not always behave like scalars
1) For scalars, ab = 0 ==> either a=0 or b=0 (or both).
NOT true for matrices.
2 4 - 2 - 4
Ex: A B
1 2 1 2
Matrices vs Scalars 2
2) For scalars, ab = ac (with a ≠ 0) ==> b = c.
NOT true for matrices.
2 3 1 1 - 2 1
Ex: A B C
6 9 1 2 3 2
Rules of matrix
algebra
Commutative, Associative, and
Distributive Laws
In ordinary scalar algebra, addition and multiplication
obey the following laws:
Commutative law of addition: a+b=b+a
Commutative law of multiplication: ab = ba
Associative law of addition: (a+b)+c = a+(b+c)
Associative law of multiplication: ab(c) = a(bc)
Distributive law: a(b+c) = ab + ac