Summary
Summary
Summary
Definition
1
Notation:
2
Special Vectors:
1 Null vector:
0 = (0, . . . , 0)T
2 Sum vector:
s = (1, . . . , 1)T
In fact u T s =
P
iIn ui
3 Canonical vector:
ej = I j ,
where I j denotes the j-th column of the identity matrix. Also called
selector vector, since u T e j = uj
3
Vector Addition and Scalar Multiplication
Consider , xi R, and a i , u, v , w Rn .
Addition: w = u + v , where wi = ui + vi
Scalar Multiplication: v = u, where vi = ui
Moreover, vector
X
v = x1 a 1 + x2 a 2 + + xm a m = xi a i ,
iIm
4
Properties:
Consider , R and 0, u, v , w Rn
1 u + (v + w ) = (u + v ) + w
2 u +0=u
3 u + (u) = 0
4 u +v =v +u
5 (u + v ) = u + v
6 ( + )u = u + u
7 ()u = (u)
8 1u = u
5
Inner Product
6
Properties:
Consider R and 0, u, v , w Rn
1 h(u + v ), w i = hu, w i + hv , w i
2 hu, v i = hu, v i
3 hu, v i = hv , ui
4 hu, ui 0 and hu, ui = 0 iff u = 0
7
Norms
8
Unit spheres:
L2 L1
1.0
1.0
0.5
0.5
0.0 0.0
-0.5
-0.5
-1.0
-1.0
-1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0
L Lp
1.0
1.0
0.5
0.5
0.0 0.0
-0.5
-0.5
-1.0
-1.0
-1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0
A vector that lies in the unit circle is called unit vector. Any u Rn
under k k2 can be turned into a unit vector letting v = u/(u T u)1/2 .
9
Properties:
1 kuk2 = u T u.
2 kuk 0 and kuk = 0 iff u = 0
3 kuk = ||kuk
4 k uk = kuk
5 ku v k = 0 iff u = v
6 ku v k2 = kuk2 + kv k2 2u T v
10
Angle between two Vectors
11
Important results:
kv k + kw k ku w k
Proof.
Squaring and for cos() = u T v /kukkv k we obtain 1 cos(), which
holds .
(u T v )2 kuk2 kv k2
Proof.
For cos() = u T v /kukkv k, we get cos2 () 1 0, which holds .
12
Applications
For example if he/she starts at the origin and moves horizontally in the
first moment and vertically on the second, we obtain that:
" # " # " # " #
x3 0 1 0
= + 1 + 2 ,
y3 0 0 1
-4 -2 2 4 6
-5
-10
14
Example 1.2 (Regression)
Are the total sells of water bottles during the month related to the
average temperature on the month?
Let xi denote the number of water bottles sold in march for year i,
and let xi denote the average temperature in march year i.
Angle between x and y is an indicator of how align the vectors
are. If cos() > 0, x and y are positively related; if cos() < 0, they
are negatively related; and if cos() = 0, they have no relation.
This result is closely related to the linear regression problem. In fact
xT y ky k
cos() = = ,
kxkky k ky k
15
Example 1.3 (PC1 2015-II)
Let x, y Rn , and let the angle between them be denoted by
xy [0, /2]. Consider R, and define e() = y x.
16
Review on Matrices
Definition
17
Matrix Addition and Scalar Multiplication
18
Properties:
1 (A + B) + C = A + (B + C )
2 A+0=0+A=A
3 A + (A) = 0
4 A+B =B +A
5 (A + B) = A + B
6 ( + )A = A + A
7 ()A = (A)
8 1A = A
19
Matrix Multiplication
ci,j = h(AT )i , B j i,
X
Cj = AB j = bk,j Ak ,
kIp
20
Properties:
1 (AB)C = A(BC )
2 A(B + C ) = AB + AC
3 (A + B)C = AC + BC
4 (AB) = (A)B = A(B)
AB 6= BA
AB = 0 6 B = 0 or A = 0
AB = AC 6 B = C
21
Example 2.1 (Image Processing)
Say you have a picture as a n n matrix A in a grey scale, i.e. with
entries ai,j [0, 1], where ai,j = 0 means black and ai,j = 1 means white.
1 How would you add light to the picture? (assume that for any
transformed matrix A it holds that ai,j 0 means black and ai,j 0
means white.)
2 How can you rotate the picture horizontally by pre or post
multiplying A by another matrix?
22
Define A = A, for > 0.
1A 1.5A 2A
2.5A 3A 3.5A
23
Define A = AB, where B j = I nj+1 .
24
Transpose of a Matrix
25
Properties:
(A + B)T = AT + B T
(AT )T = A
(A)T = AT
(AB)T = B T AT
26
Square Matrices
27
Example 2.2 (Identity matrix)
The n-dimensional identity matrix is given by
1 0 0
0 1 0
I n = [e 1 , . . . , e n ] =
.. .. .. .. .
. . . .
0 0 0 1
28
Non-singular Matrices
29
Example 2.3 (Inverse of a 2 2 matrix)
To find the inverse involves solving for xi,j in
" # " # " #
a1,1 a1,2 x1,1 x1,2 1 0
= .
a2,1 a2,2 x2,1 x2,2 0 1
| {z } | {z } | {z }
A B I2
to obtain x1,1 = a2,2 /d, x1,2 = a1,2 /d, x2,1 = a2,1 /d, x2,2 = a1,1 /d,
where d = a1,1 a2,2 a1,2 a2,1 = det(A).
30
Properties (inverse):
(A1 )1 = A
(AT )1 = (A1 )T
(AB)1 = B 1 A1
1
det(A1 ) =
det(A)
(A + B)1 = A1 (A1 + B 1 )1 B 1
A1 (A + B)1 = A1 (A1 + B 1 )1 A1
31
Review on Gauian Elimination
This section is included for completeness. For full proofs on the theorems
stated here, see:
32
Basic Definitions
33
Note that we can write (1) as
X X
ai,j xj = bi or xj Aj = b,
jIn jIn
34
$$
9 #
D
#
D
#
f
#
P
n - # D & #
D #
( 5
(
#
Linear systems can (also) be classified as
+
( &
&
/SQm .$
1 a unique solution
2 no solution
3 an infinite number of solutions
36
-*& (/7*!7$) -7
&" - 7
'+ '+ '+
+ +
&+
! + &+
'+*
+
e ! + &+ '+*+ ! + &+ '+*++
+ &+'+*+
+ + '+*
e + &+ '+*+
+ +
/SQm .+
* "e$A$
e$$%
Bbb nb ~qb Zb ZZ~~b~ W@qm 5 Pnq __ nb nb ~qb nZb nb Zb ~b ^
`qfbbA qb_b nb
37
Ws #] {&W-6,%#& 7&J %-# <
*
*
*
+
!* &!('! &*
/SQm ..
39
Example 3.1
The following matrices are in echelon form and their pivots are in red
2 3 2 0 4 5 6
1 2 3
0 0 1 1 3 2 0
A = , B= 0 0 1
0 0 0 0 0 6 2
0 0 0
0 0 0 0 0 0 0
0 1 3 0 0 4
C = 0 0 0 1 0 3 .
0 0 0 0 1 2
40
Definition 3.2 (Row Canonical form)
A matrix is said to be in row canonical form if it is in echelon form and
41
Example 3.2
The matrices from example 3.1 can be written in row canonical form
after applying a sequence of row operations.
1 3/2 0 1 5 0 19/6
1 2 0
0 0 1 1 3 0 2/3
A = , B= 0 0 1
0 0 0 0 0 1 1/3
0 0 0
0 0 0 0 0 0 0
0 1 3 0 0 4
C = 0 0 0 1 0 3 .
0 0 0 0 1 2
42
Consider the augmented matrix M = [A b], with A and b as in (1). It
can be shown that the following row operations preserve the solution of
the system:
1 row interchange: M i, M j,
2 row scaling: kM i, M i,
3 row addition: kM i, + M j M j, ,
43
Definition 3.3 (Rank)
The rank of a matrix A denoted rank(A) is equal to the number of pivots
in an echelon form of A.
44
Example 3.3
Find the rank for matrices in example 3.1
2 3 2 0 4 5 6
1 2 3
0 0 1 1 3 2 0
A = , B= 0 0 1
0 0 0 0 0 6 2
0 0 0
0 0 0 0 0 0 0
0 1 3 0 0 4
C = 0 0 0 1 0 3 , D = [B C ].
0 0 0 0 1 2
45
Properties (rank):
rank(A) = rank(AT )
rank(A) min{m, n}
If rank(A) = min{m, n} we say A is full rank
46
Gauian Elimination
Gauian elimination is an algorithm that takes any matrix (as input) and
returns an its row canonical form (as output). It uses:
47
In fact, solving Ax = b is equivalent to finding the row canonical form of
M = [A b]. The justification follows from these facts:
48
Forward Elimination
Note that in the resulting echelon form matrix, the pivots will be
a1,j1 , . . . , ar ,jr , where r is the rank of M.
49
Backward Elimination
50
Cnb_Zq_Z~c cnb Zmbb`Zq>
b_~`qmbnb _bg_qbcbZ
^Zq_ ZqZ^~bq Z q b bZ~ Z`q q nb ~b b q q bb_qb _~
nb_bnbjbbZqZ^~bc cnb ~qcnb b c~qbZbZqq^Zqb`^ q
Zcbqm nb jbbZqZ^~b nb nb q`b
Exampleq~~Zb`
Pnq_bq 3.4 ^b~
Solve the following system
&!"%$ 0,2 W~lleitmtl m~~us l4
f HB C{ f }D{ f Nn HE{
! 7
*w
?
, !
w
Hence the system has infinite solutions, with free variables x2 , x4 ; and pivot
variables x1 , x3 .
51
"> {&W-6,%#& 7&J %-#
Example 3.5
Solve the following system
7
1
; n
2 2x3 + 3x4 M =
! v x\51 d+x!W 4 (3)
M q MG
q !W ! MG v \5d
59 !2xB5
1 d+3x 2 + 3x3 x4 M9 =
!B !B
3 B5d
Z
- Mq M9 V
MG Md n
5x1 + 7x2 + 4x3 + x4 = 5
( "
V
f
f E
f
6
*w
?
$ " 2 $ $ "
w $ " " " B B !B
- B 2 - $ 2 2 5
9
w
1
1
9
1
<* ;
Hence the system has no solution.
\M q \MGIt\M9
contains
\Mdadegenerate
- equation.
1
m <
7
*w
?
$
$ $ $
e
- " ! v \ " 52
( " E
f
f
f
*w
?
$ " 2 $ $ "
w $ " 3.6" "
Example
B
B !B
2 system
Solve-theB following - $ 2 2 5
9
w
1
9
1
<*
x1 + 2x2 + 1x3 = 3 (4)
\M
2xq1 \M 1x3\M
+ 5xG2 \M9 4
=d -
1
3x1 2x2 1x3 = 5
m <
*w
?
$ Z
$ $ $
e
- " ! v \ "
D D $ m <
$ 0 2 2 $0 !0 2
$ $
"
1
;
M $ = " ;
1 $
w
1
;
Hence the system has a unique solution.
8
V1
Theorem 3.3
Consider a system of equations with n unknowns s.t.: M = [A b], then
Theorem 3.4
The square system Ax = b has a unique solution iff A is invertible. In
such cases x = A1 b is the unique solution of the system.
54
Theorem 3.5
The following propositions are equivalent:
det(A) 6= 0
A is invertible
A is full rank
the columns of A are linearly independent
the rows of A are linearly independent
Ax = 0 has unique solution at x = 0
55
Vector Spaces
Definition
1 (a + b) + w = a + (b + w ) 4 a+b =b+a
2 0 V s.t. b + 0 = b, for 5 k(b + w ) = kb + kw
each b V 6 (k + )b = kb + b
3 For each b V, b V s.t. 7 (k)b = k(b)
b + (b) = 0
8 1a = a
56
Example 4.1 (Vector spaces)
The following are vector spaces:
57
Example 4.2 (Vector spaces in Rn )
V = {x Rn , a Rn : a T x = 0}
V = {x Rn , a Rn , 6= 0 : a T x = }
58
Linear Combinations
59
Remark 4.1
The question of expressing a given vector b Rn as a lc of
a . . . , a m Rn is equivalent to the question of solving Ax = b.
unique solution
many solutions
no solution.
60
Example 4.3 (Linear combinations in R3 )
Express b = (3, 7, 4)T as a lc of
61
Example 4.4 (Linear combinations in Pn (x))
Express the polynomial q(x) = 3x 2 + 5x 5 as a lc of
Gauian elimination leads to: q(x) = 3p1 (x) + p2 (x) 2p3 (x).
62
Spanning Sets
for every b V, x R : b = x1 a 1 + + xm a m
Remark 4.2
Suppose a 1 , . . . , a m are a ss of V. Then it holds that:
63
Example 4.5 (Spanning set of R3 )
64
Example 4.6 (Spanning set of Pn (x))
1 Every polynomial in Pn (t) can be expressed as a lc of n + 1
polynomials of degree n
1, x, x 2, x 3, . . . , x n
65
Example 4.7 (Spanning set of R22 )
Show that the matrices
" # " # " # " #
1 0 0 1 0 0 0 0
E1 = , E1 = , E1 = , and E 1 = ,
0 0 0 0 1 0 0 1
66
Subspaces
Note that any vector space has always two trivial subspaces, i.e.
V, 0 V and V t 0 = V.
67
Example 4.8 (Subspaces of R3 )
U = {(x1 , x2 , x3 ) : x1 = x2 = x3 , xi R}
is a subspace of R3 .
2 Show that any plane that goes through the origin in R3 is a
subspace of R3 .
68
4Y < m
/ M$
<m 3.Dv e
M 3 ) Gm )
$
M`
3 .Dv e
)$
Gm M<mm
2
2
m
mm
m
mm
mm
mm
'+ m '+
mm
m
-
-
RRR
RRR
+ +
/SQm 2$
#&!"%$ 6:
W = {x Rn , a, b Rn : a T x = 0, b T x = 0},
70
Example 4.10 (Subspaces of Rnn )
Let V = Rnn ,
71
Example 4.11 (Subspaces of P(x))
Let P(x) represent the space of all polynomials, then
72
Theorem 4.2 (Intersection of subspaces)
The intersection of any number of subspaces of a vector space V is a
subspace of V.
Proof.
Without loss of generality, let U and W be subspaces of vector space V.
Hence, 0 U, 0 W and 0 U W. Now suppose a, b U W.
Then a, b U and a, b W. Further, since U and W are subspaces, for
any , R, a + b U and a + b W. Thus a + b U W.
Therefore U W is a subspace of V.
73
Definition 4.6 (Nullspace of a Matrix)
Let A be a m n matrix, the Nullspace of matrix A, denoted null(A) is
the solution set of Ax = 0.
Note that null(A) Rn is a subspace of Rn since
74
Linear span
span(a i ),
1 0a 1 + 0a 2 + + 0a m = 0 (span)(a i )
2 If a, b span(ai ),
a = x1 a 1 + x2 a 2 + + xm a m
b = y1 a 1 + y2 a 2 + + ym a m ,
then for , R
75
Example 4.12 (Linear span in R3 )
Consider vector space V = R3 ,
76
77
Definition 4.8 (Range of a matrix)
Let A be a m n matrix, the range of matrix A, denoted range(A) is the
space spanned by the columns of A, i.e. rank(A) = span(Ai ).
Note that range(A) Rm is a subspace of Rm since
y 1 = Aa y 1 = y 1 = Aa
y 2 = Ab y 2 = y 2 = Ab
78
Linear Dependence and Independence
x1 a 1 + + xm a m = 0.
79
Remark 4.3
1 Suppose 0 is one of the vectors a 1 , . . . , a m , say a j = 0 then the
vectors must be ld since
6= 0 : 0a 1 + 0a 2 + + 0a j1 + a j + 0a j+1 + + 0a m = 0
1a 1 + ()a 2 + 0a 3 + + 0a m = 0
80
Example 4.13 (Linear independence)
1 Show that the vectors
are li.
3 Let V be the vector space of functions fi : R R. Show that the
functions f1 (x) = sin(x), f2 (x) = e x and f3 (x) = x 2 are li.
4 Show that every set a 1 , . . . , a m of mutually orthogonal vectors, i.e.
ha i , a j i = 0 for i 6= j, is li.
81
Linear dependence in R3 :
82
83
Linear dependence and linear combinations:
y1 a 1 + y2 a 2 + + ym a m = 0, for some yk 6= 0
ak = yk1 y1 a 1 + + yk1 yk1 a k1 + yk1 yk+1 a k+1 + yk1 ym a m ,
84
Linear dependence and echelon matrices:
r1 cannot be expressed as a lc of r2 , r3 , r4
The nonzero rows of a matrix in echelon form are linearly
independent.
85
Theorem 4.3
Let A be a m n matrix, with columns A1 , . . . , Am Rm , then if
86
Basis and Dimension
87
Theorem 4.4
Definitions 4.10 and 4.11 are equivalent.
Proof.
Consider the statements: [1] S = {a 1 , . . . , a n } is li and S spans V; and
[2] every b V can be written uniquely as a lc of a 1 , . . . , a n
0 = (x1 y1 )a 1 + + (xn yn )a n ,
88
Special cases:
89
Example 4.14 (Orthogonal basis)
Show that the set
90
Lemma 4.1 (Steinitz)
{b 1 , . . . , b m , a `1 , . . . , a `nm },
91
Theorem 4.5
Let V be a vector space such that one basis has m elements and another
basis has n elements. Then m = n.
Proof.
Suppose {a 1 , . . . , a n } and {b 1 , . . . } are two bases of V. By lemma 4.1,
because {a i } spans V, then {b i } must contain n or less elements,
otherwise the vectors would be ld. If {b i } contains less than n elements,
then {a i } would be ld. Thus the cardinality of {b i } is exactly n.
92
Definition 4.14 (Dimension of a vector space)
Let S = {a 1 , . . . , a n } be a basis of V. The dimension of V, denoted
dim(V), is the number of elements in the basis, i.e. dim(V) = #S = n.
93
Example 4.15 (Rn basis)
Consider the following vectors in Rn
b = a1 e 1 + a2 e 2 + + an e n .
94
Example 4.16 (Rmn basis)
The following matrices form a basis for the vector space R23 :
" # " # " #
1 0 0 0 1 0 0 0 1
, ,
0 0 0 0 0 0 0 0 0
" # " # " #
0 0 0 0 0 0 0 0 0
, , .
1 0 0 0 1 0 0 0 1
95
Example 4.17 (Polynomial basis)
1 Consider Pn (x) and the set
S = {1, x, x 2 , . . . , x n }
96
Theorems on bases
Theorem 4.6
Proof.
Suppose B = {b 1 , . . . , b n } is a basis of V.
Proof.
1 Suppose {a i }ni=1 is a maximum li subset of S, and suppose b S.
Accordingly {a 1 , . . . , a n , b} is ld because b span(a i ) and hence
S span(a i ). This leads to V = span(S) span(a i ) . Thus li set
{a}ni=1 spans V and hence it is a basis of V.
2 The remaining vectors form a maximum li subset of S, hence by [1],
it is a basis of V.
98
Theorem 4.8
Proof.
Suppose B = {b i }ni=1 is a basis of V. Note that V is also spanned by
S B = {a 1 , . . . , a r , b 1 , . . . , b n }
99
Dimensions and subspaces:
The following theorem gives the basic relation between the dimension of
a vector space and the dimension of a subspace
Theorem 4.9
100
Example 4.18 (Dimension of a subspace)
Let W be a subspace of R3 . Note that dim(R3 ) = 3. Theorem 4.9 tells
us that dim(W) can only be 0, 1, 2 or 3. The following cases apply:
101
Example 4.19
M = {M R22 : M = M T }.
M = {M R33 : M = M T }.
102
Applications to Matrices, Rank of a Matrix
rank(A) = dim(colsp(A))
103
Theorem 4.10
104
Application to finding a basis for W = span(u 1 , . . . , u r ):
W = span(S) = span(u 1 , . . . , u r )
105
Algorithm 4.1 (Casting-out algorithm)
1 Form matrix M, whose columns are the given vectors
2 Row reduce M to echelon form M
3 For each column M k without a pivot, delete (cast-out) the vector
u k from the list S of given vectors.
4 Output the remaining vectors in S (which correspond to columns
with pivots).
106
Example 4.20
Let W be a subspace of R5 spanned by
Find a basis for W consisting of the original given vectors and find
dim(W).
107
Example 4.21
Let W be a subspace of R4 spanned by
108
Application to homogeneous systems of linear equations:
dim(W) = n rank(A)
109
Coordinates
Consider vector space V, and basis A = {ai }ni=1 . For any b V we have
b = x1 a 1 + x2 a 2 + + xn a n ,
[b]A = (x1 , x2 , . . . , xn )T
110
Example 4.22 (PC1 2015-II)
Consider the following vectors in R4 :
111