2. What is the Matrix?
• A matrix is a set of elements, organized
into rows and columns
rows
a b
c d
columns
3. Matrix Operations
f a e b f
a b e
c d g c g d h Just add elements
h
f a e b f
a b e
c d g c g d h Just subtract elements
h
f ae bg af bh
a b e Multiply each row
ce dg
c d g cf dh by each column
h
4. Vector Operations
• Vector: 1 x N matrix
a
• Interpretation: a line
in N dimensional
v b
space
• Dot Product, Cross
c
Product, and
Magnitude defined
y
on vectors only
v
x
5. Vector Interpretation
• Think of a vector as a line in 2D or 3D
• Think of a matrix as a transformation on
a line or set of lines
x a b x'
y c d y '
6. Dot Product
• Interpretation: the dot product measures
to what degree two vectors are aligned
A
A+B = C
(use the head-to-tail
B method to combine vectors)
C
B
A
7. Dot Product
d
a b abT a b c e ad be cf Think of the dot product
as a matrix multiplication
f
The magnitude is the dot
a aaT aa bb cc
2
product of a vector with itself
The dot product is also related to
a b a b cos( )
the angle between the two
vectors – but it doesn’t tell us the
angle
8. Cross Product
• The cross product of vectors A and B is a vector C
which is perpendicular to A and B
• The magnitude of C is proportional to the cosine of
the angle between A and B
• The direction of C follows the right hand rule – this
why we call it a “right-handed coordinate system”
a b a b sin( )
9. Inverse of a Matrix
• Identity matrix:
AI = A
• Some matrices have
1 0 0
an inverse, such that:
0 1 0
AA-1 = I
I
• Inversion is tricky:
(ABC)-1 = C-1B-1A-1
0 0 1
Derived from non-
commutativity
property
10. Inverse of a Matrix
1. Append the identity
matrix to A
2. Subtract multiples of the
a b c 1 0 0
other rows from the first
d e
f 0 1 0 row to reduce the
diagonal element to 1
g h i 0 0 1
3. Transform the identity
matrix as you go
4. When the original matrix
is the identity, the
identity has become the
inverse!
11. Determinant of a Matrix
• Used for inversion a b
A
• If det(A) = 0, then A c d
has no inverse
• Can be found using det( A) ad bc
factorials, pivots, and
cofactors! 1 d b
1
A
• Lots of ad bc c a
interpretations – for
more info, take 18.06
12. Determinant of a Matrix
ab c
f aei bfg cdh afh bdi ceg
de
gh i
ab ca b ca b c
Sum from left to right
de fd e fd e f Subtract from right to left
Note: N! terms
gh ig h ig h i
13. Homogeneous Matrices
• Problem: how to include translations in
transformations (and do perspective
transforms)
• Solution: add an extra dimension
1 x
1
y
x z 1
y
1 z
1 1
14. Ortho-normal Basis
• Basis: a space is totally defined by a set
of vectors – any point is a linear
combination of the basis
• Ortho-Normal: orthogonal + normal
• Orthogonal: dot product is zero
• Normal: magnitude is one
• Example: X, Y, Z (but don’t have to be!)
15. Ortho-normal Basis
x 1 0 0 x y 0
T
y 0 1 0 xz 0
T
z 0 0 1 yz 0
T
X, Y, Z is an orthonormal basis. We can describe any
3D point as a linear combination of these vectors.
How do we express any point as a combination of a
new basis U, V, N, given X, Y, Z?
16. Ortho-normal Basis
n1 a u b u c u
a 0 0 u1 v1
0 b 0 u n2 a v b v c v
v2
2
0 0 c u3 n3 a n b n c n
v3
(not an actual formula – just a way of thinking about it)
To change a point from one coordinate system to
another, compute the dot product of each
coordinate row with each of the basis vectors.