Modified Gary Larson Far Side Cartoon
Modified Gary Larson Far Side Cartoon
Matlab
Linear
Algebra
Review
am1x1+am2x2++amnxn=bm
Whats
the
matrix
representa>on?
x1
a11 a12 ... a1n
x2
a21
a22
...
a2n
x=
A=
.
...
xn
am1 am2 ... amn
b1
b2
b=
.
bm
Ax = b
Vectors
Matrices
u11
u21
U
=
[umn]
=
um1
u12
u1n
u22
u2n
um2
umn
Transpose of a Matrix
Vector
Mul>plica>on
The
inner
product
or
dot
product
v w = (x1, x 2 ) (y1, y 2 ) = x1 y1 + x 2 y 2
In
Matlab:
>>a*b
ans
=
The
outer
product
of
vector
mul>plica>on
is
a
MATRIX
24
6
30
8
2
10
-12
-3
-15
Matrix
Mul>plica>on
The
inner
numbers
have
to
match
a21
a22
C*B
A(B+C)
=
AB
+
BC
(AB)C
=
A(BC)
>>a'*b
>>a*b
ans =
ans =
11
24
6
30
8
2
10
-12
-3
-15
(using
this
form
built
in
func>ons
-
dont
have
to
match
dimensions
of
vectors
can
mix
column
and
row
vectors
although
they
have
to
be
the
same
length)
>> a=[1 2 3];!
>> b=[4 5 6];!
>> c=dot(a,b)!
c =!
32!
>> d=dot(a,b)!
d =!
32!
Determinant of a Matrix
a b = a b sin
c
=
a2b3-a3b2
=
2*5
(-3)*1
=
13
(using
this
form
built
in
func>ons
-
dont
have
to
match
dimensions
of
vectors
can
mix
column
and
row
vectors
although
they
have
to
be
the
same
length)
>> a=[1 2 3];!
>> b=[4 5 6];!
>> e=cross(a,b)!
e =!
-3
6
-3!
>> f=cross(a,b)!
f =!
-3
6
-3!
>> g=cross(b,a)!
g =!
3
-6
3!
(one
of
the
dimensions
has
to
be
3
and
takes
other
dimension
as
addi>onal
vectors)
>> a=[1 2;3 4;5 6]!
a =!
1
2!
3
4!
5
6!
>> b=[7 8;9 10;11 12]!
b =!
7
8!
9
10!
11
12!
>> cross(a,b)!
ans =!
-12
-12!
24
24!
-12
-12!
Matrix Operators
+
Addi>on
-
Subtrac>on
*
Mul>plica>on
/
Division
\
Let
division
^
Power
'
Complex
conjugate
transpose
(
)
Specify
evalua>on
order
Array Operators
+
Addi>on
-
Subtrac>on
.*
Element-by-element
mul>plica>on
./
Element-by-element
division.
A./B:
divides
A
by
B
by
element
.^
Element-by-element
power
.'
Unconjugated
array
transpose
the
signs
of
imaginary
numbers
are
not
changed,
unlike
a
regular
matrix
transpose
+
+
*
.*
^
.^
\
/
.\
./
Mul>plica>on in Matlab
>>
w=x.*y
w
=
3
8
>>
z=x'*y
z
=
3
4
6
8
Division
in
Matlab
In
ordinary
math,
division
(a/b)
can
be
thought
of
as
a*1/b
or
a*b-1.
A
unique
inverse
matrix
of
B,
B-1,
only
poten>ally
exists
if
B
is
square.
And
matrix
mul>plica>on
is
not
communica>ve,
unlike
ordinary
mul>plica>on.
There
really
is
no
such
thing
as
matrix
division
in
any
simple
sense.
/
:
\
:
Inverse of a Matrix
the determinant
Linear Dependence
a b c
2a + 1b = c
Linear Independence
a
b
c
There
is
no
simple,
linear
equa>on
that
can
make
these
vectors
related.
Rank of a matrix
Acknowledgement
This
lecture
borrows
heavily
from
online
lectures/ppt
les
posted
by
David
Jacobs
at
Univ.
of
Maryland
Tim
Marks
at
UCSD
Joseph
Bradley
at
Carnegie
Mellon