Академический Документы
Профессиональный Документы
Культура Документы
- Vector space
-Linear transformation
- Equivalances for invertibility matrices
Scalar
A quantity (variable), described by a single
real number
e.g. Intensity of each
voxel in an MRI scan
Vector
x1
x 2
VECTOR=
i.e. A column
of numbers xn
Linear Algebra & Matrices, MfD 2010
Matrices
Rectangular display of vectors in rows and columns
Can inform about the same vector intensity at different
times or different voxels at the same time
Vector is just a n x 1 matrix
Matrices
Matrix locations/size defined as rows x columns (R x C)
d11
D d 21
d 31
1 4 7
A 2 5 8
3 6 9
Square (3 x 3)
d12
d 22
d 32
d13
d 23
d 33
x31
x32 x33
x31 x32 x33
3 dimensional (3 x 3 x 5)
1 4
A 2 5
3 6
Rectangular (3 x 2)
Basic concepts
Vector in Rn is an ordered
set of n real numbers.
e.g. v = (1,6,3,4) is in R4
(1,6,3,4) is a column
vector:
as opposed to a row
vector:
1
6
3
4
6 3 4
1 2 8
4 78 6
9 3 2
Matrices in MATLAB
Description
Matrix(X)
Meaning
1 4 7
X 2 5 8
3 6 9
;=end of a row
Reference matrix values (X(row,column))
Note the : refers to all of row or column and , is the divider between rows and columns
3rd row
X(3, :)
X(2,3)
X( [1 2], 2)
zeros(3,1)
ones(2,2)
6 9
8
4
5
0
0
0
Transposition
1
b 1
2
column
b 1 1 2
T
row
1 2 3
A 5 4 1
6 7 4
d 3 4 9
row
1 5 6
AT 2 4 7
3 1 4
T
d 4
9
column
Basic concepts
Transpose: reflect vector/matrix on line:
T
a
a b
b
a b
a c
c d
b d
Vector norms:
Lp norm of v = (v1,,vk) is (i |vi|p)1/p
Common norms: L1, L2
Linfinity = maxi |vi|
Matrix Calculations
Addition
Commutative: A+B=B+A
Associative: (A+B)+C=A+(B+C)
2
AB
2
Subtraction
- By adding a negative matrix
4 1 0 2 1 4 0 3 4
5 3 1 2 3 5 1 5 6
Scalar multiplication
Scalar * matrix = scalar multiplication
Matrix Multiplication
When A is a mxn matrix & B is a kxl matrix, AB is only possible
if n=k. The result will be an mxl matrix
Simply put, can ONLY perform A*B IF:
A1 A2 A3
B13 B14
A4 A5 A6
A7 A8 A9
B15 B16
= m x l matrix
B17 B18
Matrix multiplication
Multiplication method:
Sum over product of respective rows and columns
Matrix multiplication
Matrix multiplication is NOT commutative
i.e the order matters!
ABBA
Identity matrix
A special matrix which plays a similar role as the number 1 in number
multiplication?
Identity matrix
Worked
example
A I3 = A
for a 3x3 matrix:
1+0+0
0+2+0
0+0+3
4+0+0
0+5+0
0+0+6
7+0+0
0+8+0
0+0+9
Basic concepts
Vector products:
Dot product: u v u v u
1
T
Outer product:
u1
uv v1
u2
T
v1
u 2 u1v1 u 2 v2
v2
u1v1 u1v2
v2
u 2 v1 u 2 v2
0 5 1 5
0 11 1
1 0 1 1
(stretching)
(rotation)
1 0 0 1
1 0 1 1
0 0 1 0
1 c x x cy
0 1 y y
(reflection)
(projection)
(shearing)
y
2 1 1 z 2
Special matrices
a 0 0
0 b 0
0 0 c
c
0
diagonal
a b
0 d
0 0
0
tri-diagonal
1 0 0
0 1 0
0 0 1
e
f
a 0
b c
d e
upper-triangular
0 lower-triangular
f
I (identity matrix)
Vector spaces
Formally, a vector space is a set of vectors which is
closed under addition and multiplication by real numbers.
A subspace is a subset of a vector space which is a
vector space itself, e.g. the plane z=0 is a subspace of
R3 (It is essentially R2.).
Well be looking at Rn and subspaces of Rn
Our notion of planes in R3
may be extended to
hyperplanes in Rn (of
dimension n-1)
Note: subspaces must
include the origin (zero
vector).
u
2 3 b2
1 3 v b
1
0 b1
u 2 v 3 b2
1
3 b
3
(0,3,3)
1 0
0
u
2 3 0
1 3 v 0
1 0 1 x 0
2 3 5 y 0
1 3 4 z 0
(1,0)
1 0
0
u
2 3 0
1 3 v 0
|
|
v1 v2
|
|
| c1 0
v3 c2 0
| c3 0
2
0
2
0
(0,0,1)
0
2 1
0
0
2 0
1
2
.9
.3
2 1.57 .2 1.29 1
2
0
0
(.1,.2,1)
(0,1,0)
(.3,1,0)
(1,0,0)
(.9,.2,0)
.1
2 .2
1
2
0
2
0
(0,0,1)
0
2 1
0
0
2 0
1
2
.9
.3
2 1.57 .2 1.29 1
2
0
0
(.1,.2,1)
(0,1,0)
(.3,1,0)
(1,0,0)
(.9,.2,0)
.1
2 .2
1
2
0
2
0
(0,0,1)
0
2 1
0
0
2 0
1
2
.9
.3
2 1.57 .2 1.29 1
2
0
0
(.1,.2,1)
(0,1,0)
(.3,1,0)
(1,0,0)
(.9,.2,0)
.1
2 .2
1
About subspaces
The rank of A is the dimension of the column space of A.
It also equals the dimension of the row space of A (the
subspace of vectors which may be written as linear
combinations of the rows of A).
1 0
2 3
1 3
About subspaces
Fundamental Theorem of Linear Algebra:
If A is m x n with rank r,
Column space(A) has dimension r
Nullspace(A) has dimension n-r (= nullity of A)
Row space(A) = Column space(AT) has dimension r
Left nullspace(A) = Nullspace(AT) has dimension m - r
Rank-Nullity Theorem: rank + nullity = n => prove it!
(0,0,1)
(0,1,0)
(1,0,0)
1 0
0 1
0 0
m=3
n=2
r=2
Non-square matrices
1 0
0 1
2 3
1 0 2
0 1 3
m=3
n=2
r=2
System Ax=b may
not have a solution
(x has 2 variables
but 3 constraints).
1 0
1
x1
0 1 1
2 3 x2 1
m=2
n=3
r=2
System Ax=b is
underdetermined
(x has 3 variables
and 2 constraints).
x1
1 0 2 1
x2
0 1 3 x 1
3
Basis transformations
Before talking about basis transformations,
we need to recall matrix inversion and
projections.
Matrix inversion
To solve Ax=b, we can write a closed-form solution if
we can find a matrix A-1
s.t. AA-1 =A-1A=I (identity matrix)
Then Ax=b iff x=A-1b:
x = Ix = A-1Ax = A-1b
A is non-singular iff A-1 exists iff Ax=b has a unique
solution.
Note: If A-1,B-1 exist, then (AB)-1 = B-1A-1,
and (AT)-1 = (A-1)T
Projections
(2,2,2)
b = (2,2)
(0,0,1)
(0,1,0)
(1,0,0)
a = (1,0)
2 1 0 0 2
2 0 1 0 2
0 0 0 0 2
2
aT b
c T a
a a
0
Basis transformations
We may write v=(2,2,2) in terms of an alternate basis:
2 .9 .3 .1 1.57
2 .2 1 .2 1.29
2 0 0 1 2
2 1 0 0 2
2
0
1
0
2
2 0 0 1 2
(0,0,1)
(.1,.2,1)
(0,1,0)
(.3,1,0)
(1,0,0)
(.9,.2,0)
Basis transformations
Given vector v written in standard basis, rewrite as vQ
in terms of basis Q.
If columns of Q are orthonormal, vQ = QTv
Otherwise, vQ = (QTQ)QTv
Special matrices
Matrix A is symmetric if A = AT
A is positive definite if xTAx>0 for all non-zero x (positive semidefinite if inequality is not strict)
1 0 0 a
a b c 0 1 0 b a 2 b 2 c 2
0 0 1 c
1 0 0 a
a b c 0 1 0 b a 2 b 2 c 2
0 0 1 c
Special matrices
Matrix A is symmetric if A = AT
A is positive definite if xTAx>0 for all non-zero x (positive semidefinite if inequality is not strict)
Useful fact: Any matrix of form ATA is positive semi-definite.
Determinants
If det(A) = 0, then A is
singular.
If det(A) 0, then A is
invertible.
To compute:
a b
Simple example: det
c d ad bc
Matlab: det(A)
Determinants
m-by-n matrix A is rank-deficient if it has
rank r < m ( n)
Thm: rank(A) < r iff
det(A) = 0 for all t-by-t submatrices,
rtm
A 0 3 / 4 6
0
0 1 / 2
4
5
1
det( A I ) 0
3/ 4
6 (1 )(3 / 4 )(1 / 2 )
0
0
1 / 2
1, 3 / 4, 1 / 2
A
0 1
Eigenvalues = 2, 1 with
eigenvectors (1,0), (0,1)
Av
(1,0)
(2,0)
Solving Ax=b
x + 2y + z = 0
y- z=2
x
+2z= 1
------------x + 2y + z = 0
y- z=2
-2y + z= 1
------------x + 2y + z = 0
y- z=2
- z=5
1 2 1 0
0 1 1 2
1 0 2 1
1 0
1 2
0 1 1 2
0 2 1 1
1 2 1 0
0 1 1 2
0 0 1 5
Write system of
equations in matrix
form.