linalg review
See also matrix cookbook
matrix representation of a system of linear equations
x1+x2+x3x1−2x2−3x32x1+x2−x3=5=−1=3
Equivalent matrix representation of Ax=b
Axb=1121−211−3−1=x1x2x3=5−13∵A∈Rm×n,x∈Rn,b∈Rm
A∈Rm×n and AT∈Rn×m
dot product.
⟨x,y⟩=i=1∑nxiyi=i=1∑nxi⋅yi
linear combination of columns
Let A∈Rm×n, X∈Rn, Ax∈Rn
Then Ax=∑i=1n⟨ai⟩xi∈Rn
inverse of a matrix
The inverse of a square matrix A∈Rn×n is a unique matrix denoted by A−1∈Rn×n
A−1A=I=AA−1
euclidean norm
L2 norm:
∥x∥2=i=1∑nxi2=XTX
L1 norm: ∥x∥1=∑i=1n∣xi∣
L∞ norm: ∥x∥∞=maxi∣xi∣
p-norm: ∥x∥p=(∑i=1n∣xi∣p)1/p
∥x∥∞≤∥x∥2≤∥x∥_1
One can prove this with Cauchy-Schwarz inequality
linear dependence of vectors
Given {x1,x2,…,xn}⊆Rd and α1,α2,…,αn∈R
∀i∈[n],∀{a1,a2,…,an}⊆Rd s.t. xi=j=1∑najxj
Span
Given a set of vectors {x1,x2,…,xn}⊆Rd, the span of the set is the set of all possible linear combinations of the vectors.
span({x1,x2,…,xn})={y:y=i=1∑nαixi∣αi∈R}
If x1,x2,…,xn are linearly independent, then the span of the set is the entire space Rd
Rank
For a matrix A∈Rm×n:
- column rank: max number of linearly independent columns of A
- row rank: max number of linearly independent rows of A
If rank(A)≤m, then the rows are linearly independent. If rank(A)≤n, then the columns are linearly independent.
rank of a matrix A is the number of linearly independent columns of A:
- if A is full rank, then rank(A)=min(m,n) (rank(A)≤min(m,n))
- rank(A)=rank(AT)
solving linear system of equations
If A∈Rn is invertible, there exists a solution:
x=A−1b
Range and Projection
Given a matrix A∈Rm×n, the range of A, denoted by R(A) is the span of columns of A:
R(A)={y∈Rm∣y=Ax∣x∈Rm}
Projection of a vector y∈Rm onto span({x1,⋯,xn}), xi∈Rm is a vector in the span that is as close as possible to y wrt l2 norm
Proj(y;{x1,⋯,xn})=v∈span({x1,⋯,xn})argmin∥y−v∥2
Null space of A
is the set of all vectors that satisfies the following:
N(A)={x∈Rn∣Ax=0}