Download Linear Algebra: Understanding Vectors, Matrix Operations, and Coordinate Systems and more Slides Advanced Computer Programming in PDF only on Docsity! Lecture 06: Linear Algebra, A Review, Part I Docsity.com Linear Algebra that you should know… 3D Coordinate Geometry 3D Points and Vectors dot products and cross products Vector and Matrix notations and algebra Properties of matrix multiplication (associative property, but NOT communicative property) Associative => (5 + 2) + 1 = 5 + (2 + 1) Commutative => 5 +2 + 1 = 1 + 2 + 5 Matrix operations (multiplication, transpose, inverse, etc.) Linear Algebra for 3D Graphics Docsity.com Vectors
b Denotes:
>» Magnitude
» Direction
>» NO POSITION!!
> In R¢, a vector can be defined as
an ordered d-tuple:
Vy ee ee net
V2 |
v= : 2s
Vd :
=
» Avector v is often written as v (
for clarity
® Docsity.com
— co
i
Vectors
>» Because a vector has no
position, one way to think of
Vy
a 2D vector v = E | isasan
y
“offset from the origin’.
> Such offset can be translated
(moved around)
Docsity.com
Find the length of the following vector: Vectors - Length Docsity.com Vectors — Scalar Multiple
> Examples of scalar multiples of the vector v = A
r
> These vectors are said to be parallel to the vector v.
> Question: What happens if a = 0?
® Docsity.com
Vectors — Unit Vector
If I don’t care about magnitude of the vector - that is,
all I care about is the direction, I can represent the
vector v such that: ||v|] = 1
> This vector v is said to be a “unit vector” (often
denoted as 7, called v-hat), and the process of making a
vector be of length = 1 is called “normalization”.
® Docsity.com
Vectors — Unit Vector
> Question: Given a vector v,
how do you find 0?
> Question: Can every vector | s
be normalized? | e
® Docsity.com
Vectors – Addition 6 7 8 9 10 6 7 8 9 10 1 2 3 5 4 1 2 3 4 5 v u v + u 6 7 8 9 10 6 7 8 9 10 1 2 3 5 4 1 2 3 4 5 v u u + v Docsity.com Vectors - Subtraction 1 2 3 4 5 -4 -3 -2 -1 1 2 3 4 5 -4 -3 -2 -1 v u -u -u Docsity.com Vectors – Basis 1.2 1.4 1.6 1.8 2 1.2 1.4 1.6 1.8 2 0.2 0.4 0.6 1 0.8 0.2 0.4 0.6 0.8 1 Docsity.com Vectors – Basis 6 7 8 9 10 6 7 8 9 10 1 2 3 5 4 1 2 3 4 5 Docsity.com Vector - Basis
> More formally, given a 2D vector w, we can express
it using two basis vectors u and v:
w= [fi] = aut bv = a fs] +0 [3] = [oa 2 ea
> Question: Can you think of two vectors that
CANNOT form basis vectors for a 2D space?
> (Hint: think linear independence)
® Docsity.com
Vector - Basis OK OK not OK not OK Docsity.com Vector — Cross Product
> The Cross Product of two vectors is a vector that is
perpendicular to both original vectors. That is, it is
normal to the plane containing the two vectors.
Vy U4
> Given two vectors v = a and u = a , the dot
V3 U3
product is written as v X u.
® Docsity.com
Vector — Cross Product
>» Important Note:
> Cross Product is not commutative. That is:
vxu #UuUXV
> In fact,
vxu=—(uxv)
axb
> The “Right Hand Rule” ‘
® Docsity.com
Vector — Cross Product
> Vx
> More formally: the cross product of v = bs and
Vz
Ux Vy Ux
u = |Uy| is written as: v X u = s X |Uy |, and is
uz Vz uz
defined as:
Vy Ux VyUz — VzUy
Vy x Uy = | VZUy — Vx Uz
Vz Uz
® Docsity.com
Deriving the cross product… For a simple 2D Case: Vector – Cross Product Docsity.com Vector — Cross Product
>» When the axes are x and y, we get:
areary,y) = A,By — B,Ay
> We could have easily labeled the axes as y and z, or z
and x, and we would get:
areary,z) = AyB, — ByA;
aredarz,x) = A,B, — BA
> In other words, if we take two 3D vectors, and project
them down to the (x,y), (y,z), and (z,x) planes, we could
get the areas of the parallelogram in each of the planes.
® Docsity.com
Vector — Cross Product
> Since we can think of the (x,y) plane as defined by a
0
unit vector Z = [| at the origin (0, 0, 0). Meaning
1
that we can think of the relationship as: Z = X x 9,
we can rewrite the previous equations as:
area, y) = (AyBy — ByAy)Z
> Similarly:
aredyy7) = (AyB, — ByAz)xX
areaczx) = (A,B, — BrAy)V
® Docsity.com
Vector — Cross Product
> Vy Ux
> Given two v = |Vy| and u = |Uy|, we can rewrite
Vz uz
each as a sum of its components in the i, j, k basis,
such that:
v = (v,xi + vyj + vk), and u = (uxt + uyj + uzk)
>Sovxu=
(v,i + vyj + v,k) x (ui + uyj + u,k) =
VyUxl XUF VyUyl XJ tee =
(vyu, — vzUy )it (vu, — VyUz)j + (Vy~Uy — VyU, )k
Docsity.com
Vector — Cross Product
>» One More Thought:
> For those of you who are ninja’s in linear algebra.
You might have already noticed that:
ij ok
vxXu=det|% Vy WY
> Recall that the determinant of a matrix is:
VyUzl — VzUyl + VzUyj — VyUzj + VyUyk — vyuyk
Docsity.com
Vector — Cross Product
> Recall that the determinant of a matrix is:
VyUzl — VzUyl + VzUyj — VyUzj + VyUyk — vyuyk
> Organize the terms a little bit, and you get:
Vy Ux VyUz — VzUy
® Docsity.com
Vector — Dot Product
> As it turns out, if u and v are two non-zero vectors:
usv = |lullllvl| cos(@)
® Docsity.com
Vector — Dot Product
} This is important because if I want to know the angle
between two vectors, I can trivially compute:
uv = |lulll|vl] cos(@)
uUu:v
cos(@) =
() = Toile
6 = cos 1( ui? )
ello
>» Note that if both wu and v are unit vectors, then:
6 = cos 1(u:v)
> Note that 6 will be in radians (that is, 0 < 0 < 7)
Docsity.com
Other useful things with dot products What are the results? Vector – Dot Product Docsity.com Vector – Dot Product 1 2 3 4 5 1 2 3 4 5 -5 -4 -3 -1 -2 Docsity.com Vector — Dot Product
> More use of the Dot Product: Finding the length
of a projection
> If wis a unit vector, then v - u is the length of the
projection of v onto the line containing u
Recall dot product:
v:u=|v||u| cos @
If |u| = 1, then
v:u=|v|cos@ = |u’|
Docsity.com
Vector – Dot Product |v| sin(θ) |v| cos(θ) radius = ||v|| Docsity.com