You are on page 1of 23

Linear Algebra

A gentle introduction

What is a Vector ?

Think of a vector as a directed line


segment in N-dimensions! (has length
and direction)

Basic idea: convert geometry in higher


dimensions into algebra!
Once you define a nice basis along
each dimension: x-, y-, z-axis
Vector becomes a 1 x N matrix!
v = [a b c]T
Geometry starts to become linear
algebra on vectors like v!

a

v b
c
y
v
x

Vector Addition: A+B


A+B

A
B

C
B
A

A+B = C
(use the head-to-tail method
to combine vectors)

av(x1,2)(ax1,2)
Scalar Product: av

av

Change only the length (scaling), but keep direction fixed.


Sneak peek: matrix operation (Av) can change length,
direction and also dimensionality!

Vectors: Dot Product


d
A B AT B a b c e
f
2

ad be cf

A AT A aa bb cc

A B A B cos( )

Think of the dot product as


a matrix multiplication

The magnitude is the dot


product of a vector with itself

The dot product is also related to the


angle between the two vectors

.v.w
,(x1,2v).w
v
w
)y

.102
(
x
(|
yv1,w
x|co1sy

2.y
1
2
2)
Inner (dot) Product: v.w or wTv

The inner product is a SCALAR!

If vectors v, w are columns, then dot product is wTv

Bases & Orthonormal Bases

Basis (or axes): frame of reference

vs

Basis: a space is totally defined by a set of vectors any point is a linear


combination of the basis
Ortho-Normal: orthogonal + normal

x 1 0 0

T
[Sneak peek:
y 0 1 0
Orthogonal: dot product is zero
T

0
0
1
Normal: magnitude is one ]

x y 0
xz 0
yz 0

What is a Matrix?

A matrix is a set of elements, organized into rows and


columns
rows

columns

a b
c d

Basic Matrix Operations

Addition, Subtraction, Multiplication: creating new matrices (or functions)

a b e
c d g

f ae b f

h c g d h

a b e
c d g

f ae b f

h c g d h

a b
c d

e
g

f ae bg

h ce dg

af bh
cf dh

Just add elements

Just subtract elements

Multiply each row


by each column

l13211322N
L

M
l1323
m
13211322m
1323 n
13211322n
1323
Matrix Times Matrix

l12 m11n12 m12n22 m13n32

Matrix Operating on Vectors

Matrix is like a function that transforms the vectors on a plane


Matrix operating on a general point => transforms x- and ycomponents
System of linear equations: matrix is just the bunch of coeffs !

x = ax + by
y = cx + dy

a b x x'


c d y y'

Multiplication

a
c

Is AB = BA? Maybe, but maybe not!


b e
d g

ae bg

h
...

...
...

e
g

f a
h c

ea fc ...

d ...
...
b

Heads up: multiplication is NOT commutative!

Note: If A and B both represent either pure rotation or


scaling they can be interchanged (i.e. AB = BA)

Matrices: Scaling, Rotation, Identity

Pure scaling, no rotation => diagonal matrix (note: x-, y-axes could be scaled differently!)
Pure rotation, no stretching => orthogonal matrix O
Identity (do nothing) matrix = unit scaling, no rotation!

r1 0
0 r2

[0,1]T

[0,r2]T

scaling
[r1,0]T

[1,0]T

cos -sin
sin cos

[0,1]T

rotation
[1,0]T

[-sin, cos]T
[cos, sin]T

Scaling
P

r 0
0 r

dilation (r >1)
contraction (r <1)

Rotation
P
P

cos -sin
sin cos

P
'(xtx,yy)P
t
2D Translation
P

ty
y

tx

Example of a Linear System


Balances
Find the unknown masses h & c balanced as follows:

40h 15c 50 2

25c 25 2 50h

Example of a Linear System


Chemical Reaction
Toluene + Nitric acid Trinitrotoluene (TNT) + Water

x C7 H 8 y HNO3 z C7 H 5O6 N 3 w H 2O

C : 7x 7z
H : 8 x y 5z 2 w

N : y 3z
O : 3 y 6z w

C6 H 2 NO2 3 CH 3

Inverse of a Matrix

Identity matrix:
AI = A
Inverse exists only for square
matrices that are non-singular
Maps N-d space to another
N-d space
Some matrices have an
inverse, such that:
AA-1 = I
Inversion is tricky:
(ABC)-1 = C-1B-1A-1
Derived from noncommutativity property

1 0 0

I 0 1 0
0 0 1

Determinant of a Matrix

Used for inversion


If det(A) = 0, then A has no inverse

a b
A

c
d

det( A) ad bc

1 d b
A
ad bc c a
1

Vectors: 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 sin of the angle between


A and B

The direction of C follows the right hand rule if we are working in


a right-handed coordinate system

AB

B
A

A B A B sin( )

MAGNITUDE OF THE CROSS


PRODUCT

DIRECTION OF THE CROSS


PRODUCT

The right hand rule determines the direction of the


cross product

You might also like