Module 1

Use vector, matrix, or tensor to represent data.

A M×NM \times N matrix is a 2D array with M rows and N columns.

1D array - row vector or column vector.

Some special matrix: diagonal - only diagonal is non 0. Identiy - diagonal with all 1. Sparse (lots of 0), and symmetric (square, a(i,j) = a(j,i) for all i and j).

Tensor

Array of numbers, 0 dimension- scalar, 1 d - vector, 2d - matirx, 3 or higher is usually a tensor.

Matrix operation: element by element vector operations - addition and subtractions. Size must be the same for all operands.

Matrix and scalar operation, multiply or divide.

Inner/outer product.

Let A=[aij]A = [a_{ij}] be a M×NM \times N matrix and b=[bn]b = [b_n] be a N×1N \times 1 column vector.

Inner product: Let xx and yy be N×1N \times 1 vectors:

xTy=n=1Nxnynx^Ty = \sum_{n=1}^Nx_ny_n

Result in a scalar, both x and y have the same dimension.

outer product:

xM×1y1×NT=[xmyn]M×Nx_{M\times 1}y_{1\times N}^T = [x_my_n]_{M \times N} A M×NM \times N matrix.

Results in a matrix.

x and y do not need to be same dimension

Matrix vector product:

c=Ab=[ci]i=1Mc = Ab = [c_i]_{i=1}^M where ci=j=1Naijbj=aiTb,1iMc_i = \sum_{j=1}^Na_{ij}b_j = a_i^Tb , 1 \leq i \leq M

Matrix matrix product: dimension need to match (column of first and row of second)

C=AM×NBN×P    cm,p=n=1NamnbnpC = A_{M \times N}B_{N \times P} \implies c_{m,p} = \sum_{n=1}^N a_{mn}b_{np}

Vector Space

xx and yy are linearly independent if ax+by=0ax + by = 0 implies a=b=0a=b=0. Otherwise, y=(a/b)xy = -(a/b)x meaning yy is scaled version of x.

If {vk}\{v_k\}are KKlinearly independe t vectors, and each vkv_k is a M(K)×1M(\geq K) \times 1 vector, then {vk}\{v_k\}span a K dim subspace in RM\R^M.

xx and yy are orthogonal if xTy=0x^Ty=0.

if {vk}\{v_k\} are mutually orthogonal, they can be a set of basis of the subspace.

Rank

rank of a matrix is the number of linear independent column vectors, or linear independnet row vectors.

rank(AM×N)min{M,N}rank(A_{M \times N}) \leq \min \{M, N\}

A matrix is full rank if its rank equal to the smaller of its column numbers or row numbers. Otherwise, a matrix is rank-deficient.

Vector Norms

L2: x2=xTx=(i=1Nxi2)1/2||x||2 = \sqrt{x^Tx} = (\sum_{i=1}^N x_i^2)^{1/2} x is a unit vector if x2=1||x||_2 = 1

Angle: cosθ=(xTy)/(xy)\cos \theta = (x^Ty)/(||x|| \cdot ||y||)

L1: x1=k=1mxk||x||1 = \sum_{k=1}^m |x_k|

L infinity: x=max1kmxk||x|||_{\infty} = \max_{1\leq k \leq m} |x_k|

Hyperplane

A hyperplane in an n-dimensional vector space is a (n-1) dim subspace. In the Euclidean space,a plane is a hyperplane in a 3D space, a line is a hyper plane in a 2D space.

Hyperplane function {x;xRn,wTx+b=i=1nwixi+b=0}\{ x; x\in \R^n, w^Tx+b = \sum_{i=1}^n w_ix_i + b = 0\}

A hyperplane partition the space into two half spaces:

{x;xRn,wTx=i=1nwixi<b}\{x; x\in \R^n, w^Tx = \sum_{i=1}^nw_ix_i < b\} and {x;xRn,wTx=i=1nwixi>b}\{x; x\in \R^n, w^Tx = \sum_{i=1}^nw_ix_i > b\}

Distance from a point to a hyperplane

r=(wTx+b)/w=g(x)/wr = -(w^Tx^*+b)/|w| = -g(x^*)/|w|

SVD

AM×N=UM×rΣr×rVr×NT=i=1rσiuiviTA_{M \times N} = U_{M \times r} \Sigma_{r\times r}V_{r\times N}^T = \sum_{i=1}^r\sigma_iu_iv_i^T

Singular value: σ1σ2,σr0\sigma_1 \geq \sigma_2 \geq \dots, \geq \sigma_r \geq 0, rmin(M,N)r\leq \min(M,N)

UTU=IrU^TU = I_r, VTV=IrV^TV=I_r, UUM×MTIUU_{M \times M}^T \neq I, VVN×NTIVV_{N\times N}^T \neq I

umTun=vmTvn={1m=n0mnu_m^Tu_n = v_m^Tv_n = \begin{cases} 1 & m=n \\ 0 & m \neq n \end{cases}

Number of non-zero singular values = rank of matrix.

SVD is the procedure for PCA.

Eigenvalue Decomposition

A symmetric matrix may be decomposed as:

AN×N=VΛVT=n=1NλnvnvnT A_{N\times N} = V\Lambda V^T = \sum_{n=1}^N \lambda_n v_n v_n^T

ΛN×N=diag{λ1,,λN}\Lambda_{N\times N} = diag\{\lambda_1, \dots, \lambda_N\}, λn\lambda_n eigenvalue

vnv_n eigenvector Av=λv    (AλI)v=0Av = \lambda v \implies (A - \lambda I)v = 0

VVT=VTV=I    vmTvn={1m=n0mnVV^T = V^TV=I \implies v_m^Tv_n = \begin{cases}1 & m=n \\ 0 &m \neq n \end{cases}

A is positive definite iff all eigenvalues are posisitve

If A is Hermitian (A^H = complex conjugate transpose of A) then all eigenvalues are real numbers.

Last updated