Вы находитесь на странице: 1из 10

CS 335

Graphics and Multimedia

Matrix Algebra Tutorial


Properties of Vector Cross Product
Cross product of parallel vectors
r
V1 ×V2 = V2 ×V1 = 0 iff V1 parallelto V2
Anti-commutative
V1 ×V2 = −(V2 ×V1 )
Not associative
V1 × (V2 ×V3 ) ≠ (V1 ×V2 ) ×V3
Distributive with respect to vector addition
V1 × (V2 + V3 ) = (V1 ×V2 ) + (V1 ×V3 )
Basic Definitions
„ Scalar – a number
„ e.g. 3.1, 2.9, 10.7e5
„ Vector – a column (or a row) of scalars
⎡a ⎤
⎡ ⎤
3 ⎢b ⎥
V = [u , v, s, t ], V = ⎢⎢4⎥⎥, V = ⎢ ⎥
⎢c ⎥
⎢⎣7 ⎥⎦ ⎢ ⎥
⎣d ⎦
„ Matrix – an array of numbers (or a collection of
vectors) ⎡a b c d⎤
⎡3.2 9.4⎤
M =⎢ ⎥ , N = ⎢⎢ e f g i ⎥⎥
⎣ 5 7.1⎦ ⎢⎣ x y z w⎥⎦
Vector Math
„ Add „ Scale
⎡ x1 ⎤ ⎡ x2 ⎤
⎡ax⎤
V1 = ⎢⎢ y1 ⎥⎥,V2 = ⎢⎢ y2 ⎥⎥ aV = ⎢⎢ay⎥⎥
⎢⎣ z1 ⎥⎦ ⎢⎣ z2 ⎥⎦ ⎢⎣az⎥⎦
⎡ x1 + x2 ⎤ „ Transpose
V1 + V2 = ⎢⎢ y1 + y2 ⎥⎥ ⎡ x⎤
T

⎢⎣ z1 + z2 ⎥⎦ ⎢ ⎥
V = ⎢ y⎥ = [x
T
y z]
⎢⎣ z ⎥⎦
Vector Math
„ Dot product V2

V1 ⋅V2 = V1 V2 cosθ
θ V1
where θ is the angle |V2| cos θ
between the two vectors

V1 ⋅ V2 = V1 xV2 x + V1 yV2 y + V1 zV2 z


V1 ⋅ V2 = V2 ⋅ V1 = 0 if and only if V1 ⊥ V2
V1 ⋅ (V2 + V3 ) = V1 ⋅ V2 + V1 ⋅ V3
Vector Product (cross product)
Multiplication of two vectors to produce another vector.
V1 ×V2 = u V1 V2 sinθ
Where u is a unit vector that is perpendicular to both V1 and V2
V 1× V 2 (Vector Notation)

u V2 ⎛V1yV2 z −V1zV2 y ⎞
⎜ ⎟
V1 ×V2 = ⎜V1zV2 x −V1xV2 z ⎟
⎜ ⎟
⎜V V −V V ⎟
V1 ⎝ 1x 2 y 1 y 2 x ⎠

cross product gives a vector in a


direction perpendicular to the V1 ×V2 = (V1yV2 z −V1zV2 y ,V1zV2 x −V1xV2 z ,V1xV2 y −V1yV2 x )
two original vectors (u) and with
a magnitude equal to the area of
the shaded parallelogram Nice applet demo at:
http://physics.syr.edu/courses/java-suite/crosspro.html
Matrix Algebra Watch the
dimensions!!

„ Scale
⎡a b ⎤ ⎡x y ⎤
M =⎢ ⎥ ,N = ⎢ ⎥
⎣c d ⎦ ⎣ z w⎦ ⎡ sa sb ⎤
sM = ⎢ ⎥
„ Matrix + Matrix (add)
⎣ sc sd ⎦
⎡a + x b + y ⎤ „ Matrix * Matrix
M +N =⎢ ⎥
⎣ c + z d + w ⎦
(multiplication)

„ Transpose ⎡ax + bz ay + bw⎤


MN = ⎢ ⎥
⎡a c ⎤ ⎣ cx + dz cy + dw⎦
M =⎢
T

⎣b d ⎦
Matrix Inverse
„ M’s inverse, denoted as M-1, is a matrix such
that
⎡1 0 0 0 ⎤
⎢0 1 0 0 ⎥
MM −1 = M −1M = I = ⎢ ⎥
⎢ ... ⎥
⎢ ⎥
⎣0 0 0 1 ⎦
Matrix Algebra
„ Matrix * Vector

⎡a b ⎤ ⎡ x⎤
M =⎢ ⎥ , V =⎢ ⎥
⎣c d ⎦ ⎣ y⎦

⎡ax + by ⎤
MV = ⎢ ⎥
⎣ cx + dy ⎦
Take-home Exercise
⎡a b ⎤ ⎡1 2 0 ⎤ ⎡3 0 2⎤ ⎡ x⎤
A = ⎢⎢0 c ⎥⎥, M = ⎢⎢0 4 8 ⎥⎥, N = ⎢⎢1 2 4⎥⎥, V = ⎢⎢ y ⎥⎥
⎢⎣1 0⎥⎦ ⎢⎣4 1 2⎥⎦ ⎢⎣0 0 1 ⎥⎦ ⎢⎣ 1 ⎥⎦
compute :
MN =
( AM ) N = ( AT M ) N =
AT ( MN ) =
NV =, VTN =
VV T = V TV =