Introduction To Matrices
Introduction To Matrices
Introduction to Matrices
Fletcher Dunn
Ian Parberry
Valve Software
University of North
Texas
Word Cloud
Chapter 4 Notes
Section 4.1:
Chapter 4 Notes
Definitions
Algebraic definition of a matrix: a
table of scalars in square brackets.
Matrix dimension is the width and
height of the table, w x h.
Typically we use dimensions 2 x 2 for
2D work, and 3 x 3 for 3D work.
Well find a use for 4 x 4 matrices
also. Its a kluge. More later.
Chapter 4 Notes
Matrix Components
Entries are numbered by row and
column, eg. mij is the entry in row
i, column j.
Start numbering at 1, not 0.
Chapter 4 Notes
Square Matrices
Same number as rows as columns.
Entries mii are called the diagonal
entries. The others are called
nondiagonal entries
Chapter 4 Notes
Diagonal Matrices
A diagonal matrix is a square matrix
whose nondiagonal elements are
zero.
Chapter 4 Notes
Chapter 4 Notes
Vectors as Matrices
A row vector is a 1 x n matrix.
A column vector is an n x 1 matrix.
They were pretty much
interchangeable in the lecture on
Vectors.
Theyre not once you start treating
them as matrices.
Chapter 4 Notes
10
Transpose of a Matrix
The transpose of an r x c matrix M
is a c x r matrix called MT.
Take every row and rewrite it as a
column.
Equivalently, flip about the
diagonal
Chapter 4 Notes
11
Chapter 4 Notes
12
Transpose of a Vector
If v is a row vector, vT is a column
vector and vice-versa
Chapter 4 Notes
13
Multiplying By a Scalar
Can multiply a matrix by a scalar.
Result is a matrix of the same
dimension.
To multiply a matrix by a scalar,
multiply each component by the
scalar.
Chapter 4 Notes
14
Matrix Multiplication
Multiplying an r x n matrix A by an n
x c matrix B gives an r x c result AB.
Chapter 4 Notes
15
Multiplication: Result
Multiply an r x n matrix A by an n x
c matrix B to give an r x c result C
= AB.
Then C = [cij], where cij is the dot
product of the ith row of A with the
jth column of B.
That is:
Chapter 4 Notes
16
Example
Chapter 4 Notes
17
Chapter 4 Notes
18
2 x 2 Case
Chapter 4 Notes
19
2 x 2 Example
Chapter 4 Notes
20
3 x 3 Case
Chapter 4 Notes
21
3 x 3 Example
Chapter 4 Notes
22
Identity Matrix
Recall that the identity matrix I (or In) is a
diagonal matrix whose diagonal entries are all 1.
Now that weve seen the definition of matrix
multiplication, we can say that IM = MI = M for
all matrices M (dimensions appropriate)
Chapter 4 Notes
23
24
Chapter 4 Notes
25
Chapter 4 Notes
26
Chapter 4 Notes
27
Common Mistake
MvT (vM)T, but MvT = (vMT)T
compare the following two results:
Chapter 4 Notes
28
Vector-Matrix Multiplication
Facts 1
Associates with vector multiplication.
Let v be a row vector:
v(AB) = (vA)B
Let v be a column vector:
(AB)v = A(Bv)
Chapter 4 Notes
29
Vector-Matrix Multiplication
Facts 2
Vector-matrix multiplication
distributes over vector addition:
(v + w)M = vM + wM
That was for row vectors v, w.
Similarly for column vectors.
Chapter 4 Notes
30
Section 4.2:
Matrix a Geometric
Interpretation
Chapter 4 Notes
31
Chapter 4 Notes
32
Linear Transformations
Rotation
Scaling
Orthographic projection
Reflection
Shearing
More about these in the next chapter.
Chapter 4 Notes
33
A Movie Quote
Unfortunately, no-one can be told
what The Matrix is you have to see
it for yourself.
Actually, its all about basis vectors.
Look back to Chapter 3 if youve
forgotten about those.
Chapter 4 Notes
34
Axial Displacements
Can rewrite any vector v = [x y z] as a
sum of axial displacements.
V = [x y z]
= [x 0 0] + [0 y 0] + [0 0 z]
= x [1 0 0] + y [0 1 0] + z [0 0
1]
Chapter 4 Notes
35
Basis Vectors
Define three unit vectors along the
axes:
p = [1 0 0]
q = [0 1 0]
r = [0 0 1].
36
37
Chapter 4 Notes
38
Chapter 4 Notes
39
Chapter 4 Notes
40
Transformation by a Matrix
If we interpret the rows of a matrix
as the basis vectors of a coordinate
space, then multiplication by the
matrix performs a coordinate space
transformation.
If aM = b, we say that vector a is
transformed by the matrix M into
vector b.
Chapter 4 Notes
41
Conversely
See what M does to the original
basis vectors [1 0 0], [0 1 0], [0 0 1].
Chapter 4 Notes
42
43
2D Matrix Example
What does the following 2D matrix
do?
44
Chapter 4 Notes
45
Whats the
Transformation?
It moves the unit axes [1, 0] and [0,
1] to the new axes.
It does the same thing to all vectors.
Visualize a box being transformed
from one coordinate system to the
other.
This is called a skew box.
Chapter 4 Notes
46
Chapter 4 Notes
47
Befor
e
Chapter 4 Notes
After
3D Math Primer for Graphics &
Game Dev
48
Chapter 4 Notes
49
3D Transformation Example
After
Before
Chapter 4 Notes
50
Chapter 4 Notes
51
52
53
Chapter 4 Notes
54