Wednesday, August 23, 2017

linear algebra 08/23/2017 lecture 17

标准正交Q为什么好

QTQ = [q1t;q2t...]*[q1,12...]= [1,0...] 单元矩阵

projection matrix
P = Q(QtQ)-1Qt = QQt (=1 if Q is square)

gram-schmidt 正交化



Tuesday, August 22, 2017

conjugate prior

very nice resource:
http://www.cnblogs.com/lifegoesonitself/p/3423588.html

Monday, August 21, 2017

linear algebra lecture 14 & 15 08/21/2017

lecture 14:
正交:
row space and null space 正交 orthogonal 因为A*x = 0
column space and null space of At 正交
Xt*y=0

subspace S is orthogonal to subspace T means that every vector in S is orthogonal to every vector in T.

Ax = b 可能没有solution
=> 变成这个更好 AtAx = Atb (best solution in this situation)

AtA不一定永远可逆

N(AtA) = N(A)
rank (AtA) = R(A)

AtA is invertible exactly if A has independent columns.


lecture 15:projections and least square
求b在a上面的投影p: (a,b是个向量)
正交 aT(b-xa) = 0
x = aTb/aTa
projection p = ax

p = a*aT/(aT*a) 是projection matrix
性质1:rank是1 因为是一行*一列得到的
性质2:Pt = P
性质3: P2 = P

Why project?
Because Ax = b may not have solution
solve Ax = p instead. p is the projection of b onto the column space. (等式右边是column space 的话肯定会有解)

AT(b-Ax_hat) = 0
=>ATAx = ATb

x = (ATA)-1ATb
p = A(ATA)-1ATb

projection matrix P =  A(ATA)-1AT (不能再简化了,因为A不一定可逆,可能吧不是square matrix)

least square fitting by a line:





















Friday, August 18, 2017

linear algebra 08/18/2017 lecture 12

lecture 12:
graph:
node - edge graph A (column 是 node; row 是edge)
现在看A的 null space

Euler's formula:
#nodes-#edges+#loops = 1

lecture 13:

u,v,w in Rt 构成一个 5*3 u  rank = 3
N(u) = n-r = 0 只有零向量


r = m or r = n (full rank matrix )

Thursday, August 17, 2017

linear algebra 08/17/2017 lecture 11

symmetric & upper triangular matrix = diagonal matrix.  dimension = 3  in 3*3 matrix

Sum: symmetric or upper triangular matrix : take anything in S and anything in U. 不是并集,是相加。 所以可以得到all matrix. dimension (S+U) = 9 in 3*3 matrix

dim(S) +dim(U) = dim(S&U) + dim(S+U)

rank 1 matrix
example : A is 2*3 matrix

rank 1 matrix 像积木,eg. 一个rank 4 的matrix可以分解成4个rank 1 matrix的相乘

subset of rank 1 matrix can't form a sub space (两个rank 1 matrix相加可能得到一个rank 2 matrix)

In R4, V = [v1,v2,v3,v4], S is all v in R4 to make v1+v2+v3+v4 = 0
=>Av = 0 A = [1,1,1,1]
S 是A的null space. RA = 1 => S = R(N(A)) = n-r = 4-1 = 3
三个特殊解找出来即可

graph {nodes,edges}











Wednesday, August 16, 2017

linear algebra letcure 9 & 10 08/16/2017

lecture 9:
independence:
vector x1,x2,....xn are independent, if no combination gives 0 vector (except the 0 combinations.)

c1x1+c2x2+...+cnxn is not 0, they are independent

vectors v1,...vl span a space means: the space consists of all combinations of those vectors.

Basis for a space is a set of vectors with 2 properties:

1. they are independent.
2. they span the space

Example :
space is R3
one basis: [1;0;0] [0;1;0] [0;0;1]

n vectors give basis if the n*n matrix is invertible.
(n个vector的一种组合可以得到单元矩阵,也就是单元基basis)

every basis for the space has the same number of vectors.
It is called the dimension of the space.

rank(A) = #pivot column = dimension of the column space

dimension of null space is the number of free variables. = n - r

lecture 10:

4 subspace of A(m*n)
C(A) column space ;Rm
N(A) null space ;Rn
R(A) row space = all combination of columns of At C(At) ;Rn
N(At) :null space of At. The left null space of A ;Rm


basis? dimension?

C(A)
dimension of C(A) = r (rank of the matrix)
basis: is the pivot columns of A

R(A)

dimension of R(A) = r

N(A)
basis: special solutions
dimension: n-r

N(At)
basis: special solutions
dimension: m - r
why call it left null space?
At*y = 0 => yt*A = 0t =>左零矩阵

[A,I]=>[R,E]

如何计算y?
E*A = R
从E的最后一行找,因为E*A最后会得到一个最后一行为0的矩阵














Monday, August 14, 2017

linear algebra 08/14/2017 lecture 7 & 8

lecture 7:
the rank of the matrix. 矩阵的秩

do elimination, find the pivot columns and free columns.
pivot variables + free variables = n (column number)

reduced row echelon form 是一种矩阵的继续简化

求解null space
解法1:produce null space matrix R*N=0
R是已经被简化的矩阵,变成[I,F;0;0] I 是单元矩阵
N=[-F;I]

解法2:求解null space.把free variable 其中一个设为1,其余free variable 为0. 然后求出一组解,

lecture 8:
Ax = b
solvable when b is in C(A)
If a combination of rows of A gives 0 rows,

to find a compete solutions

1.x particular (找一个特殊解): set all free variables as 0
2. 再把其中一个free variable 换成1,其余的为0,求几组特殊解


The case of full column rank 
r = n

what that imply about the solutions? What is that mean?
No free variables
=> N(A) = {0} null space only have 零向量
solution to Ax = b
x = unique solution, if exists (0 or 1 solution)

full row rank means 

r = m
can solve Ax = b for every b.
free variables n -r = n-m 个
肯定可以得出一个最简矩阵R=[I F]

special case: r = m = n

R = I
=> N(A) = {0} null space only have 零向量
Ax = b


r= m < n 
R= [I;0] => 0  or 1 solution

r = m<n
R = [I F] => infinite solution

r<m, r<n
R = [I,F;0,0]
=> 0 or infinite solutions