profile pic
⌘ '
raccourcis clavier

See also matrix cookbook

matrix representation of a system of linear equations

x1+x2+x3=5x12x23x3=12x1+x2x3=3\begin{aligned} x_1 + x_2 + x_3 &= 5 \\ x_1 - 2x_2 - 3x_3 &= -1 \\ 2x_1 + x_2 - x_3 &= 3 \end{aligned}

Equivalent matrix representation of Ax=bAx = b

A=[111123211]x=[x1x2x3]b=[513]ARm×n,xRn,bRm\begin{aligned} A &= \begin{bmatrix} 1 & 1 & 1 \\ 1 & -2 & -3 \\ 2 & 1 & -1 \end{bmatrix} \\ x &= \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} \\ b &= \begin{bmatrix} 5 \\ -1 \\ 3 \end{bmatrix} \end{aligned} \because A \in R^{m \times n}, x \in R^n, b \in R^m

Transpose of a matrix

ARm×nA \in R^{m \times n} and ATRn×mA^T \in R^{n \times m}

dot product.

x,y=i=1nxiyi=i=1nxiyi\begin{aligned} \langle x, y \rangle &= \sum_{i=1}^{n} x_i y_i \\ &= \sum_{i=1}^{n} x_i \cdot y_i \end{aligned}

linear combination of columns

Let ARm×nA \in R^{m \times n}, XRnX \in R^n, AxRnAx \in R^n

Then Ax=i=1naixiRnAx = \sum_{i=1}^{n}{\langle a_i \rangle} x_i \in R^n

inverse of a matrix

The inverse of a square matrix ARn×nA \in R^{n \times n} is a unique matrix denoted by A1Rn×nA^{-1} \in \mathbb{R}^{n\times{n}}

A1A=I=AA1A^{-1} A = I = A A^{-1}

euclidean norm

L2L_{2} norm:

x2=i=1nxi2=XTX\| x \|_{2} = \sqrt{\sum_{i=1}^{n}{x_i^2}} = X^TX

L1 norm: x1=i=1nxi\| x \|_{1} = \sum_{i=1}^{n}{|x_i|}

LL_{\infty} norm: x=maxixi\| x \|_{\infty} = \max_{i}{|x_i|}

p-norm: xp=(i=1nxip)1/p\| x \|_{p} = (\sum_{i=1}^{n}{|x_i|^p})^{1/p}

Comparison

xx2x_1 \|x\|_{\infty} \leq \|x\|_{2} \leq \|x\|\_{1}

One can prove this with Cauchy-Schwarz inequality

linear dependence of vectors

Given {x1,x2,,xn}Rd\{x_1, x_2, \ldots, x_n\} \subseteq \mathbb{R}^d and α1,α2,,αnR\alpha_1, \alpha_2, \ldots, \alpha_n \in \mathbb{R}

i[n],{a1,a2,,an}Rd s.t. xij=1najxj\forall i \in [ n ], \forall \{a_1, a_2, \ldots, a_n\} \subseteq \mathbb{R}^d \space s.t. \space x_i \neq \sum_{j=1}^{n}{a_j x_j}

Span

Given a set of vectors {x1,x2,,xn}Rd\{x_1, x_2, \ldots, x_n\} \subseteq \mathbb{R}^d, the span of the set is the set of all possible linear combinations of the vectors.

span({x1,x2,,xn})={y:y=i=1nαixiαiR}\text{span}(\{x_1, x_2, \ldots, x_n\}) = \{ y: y = \sum_{i=1}^{n}{\alpha_i x_i} \mid \alpha_i \in \mathbb{R} \}

If x1,x2,,xnx_{1}, x_{2}, \ldots, x_{n} are linearly independent, then the span of the set is the entire space Rd\mathbb{R}^d

Rank

For a matrix ARm×nA \in \mathbb{R}^{m \times n}:

  • column rank: max number of linearly independent columns of AA
  • row rank: max number of linearly independent rows of AA

If rank(A)m\text{rank}(A) \leq m, then the rows are linearly independent. If rank(A)n\text{rank}(A) \leq n, then the columns are linearly independent.

rank of a matrix AA is the number of linearly independent columns of AA:

  • if AA is full rank, then rank(A)=min(m,n)\text{rank}(A) = \min(m, n) (rank(A)min(m,n)\text{rank}(A) \leq \min(m, n))
  • rank(A)=rank(AT)\text{rank}(A) = \text{rank}(A^T)

solving linear system of equations

If ARnA \in \mathbb{R}^{n} is invertible, there exists a solution:

x=A1bx = A^{-1}b

Range and Projection

Given a matrix ARm×nA \in \mathbb{R}^{m \times n}, the range of AA, denoted by R(A)\mathcal{R}(A) is the span of columns of AA:

R(A)={yRmy=AxxRm}\mathcal{R}(A) = \{ y \in \mathbb{R}^m \mid y = Ax \mid x \in \mathbb{R}^m \}

Projection of a vector yRmy \in \mathbb{R}^m onto span({x1,,xn})\text{span}(\{x_1, \cdots, x_n\}), xiRmx_i \in \mathbb{R}^m is a vector in the span that is as close as possible to yy wrt l2l_2 norm

Proj(y;{x1,,xn})=arg minvspan({x1,,xn})yv2\text{Proj}(y; \{x_{1}, \cdots, x_n\}) = \argmin_{{v \in \text{span}(\{x_1, \cdots, x_n\})}} \| y - v \|_2

Null space of AA

is the set of all vectors that satisfies the following:

N(A)={xRnAx=0}\mathcal{N}(A) = \{ x \in \mathbb{R}^n \mid Ax = 0 \}