Mehmet Emre Tiryaki
Back to Notes

Linear Algebra Review

Inner Product

⟨x,y⟩=x⋅y=xTy=∑i=1nxiyi\langle x, y \rangle = x \cdot y = x^T y = \sum_{i=1}^{n} x_i y_i

An inner product ⟨⋅,⋅⟩\langle \cdot, \cdot \rangle is more general than the dot product. In Rn\mathbb{R}^n, the dot product is usually used as the inner product as it induces the Euclidean norm. If x⋅y=0x \cdot y = 0 then x,yx, y are orthogonal.

∥x∥2=∑i=1n∣xi∣2=⟨x,x⟩=x⋅x=xTx\|x\|_2 = \sqrt{\sum_{i=1}^{n} |x_i|^2} = \sqrt{\langle x, x \rangle} = \sqrt{x \cdot x} = \sqrt{x^T x} ∥x∥1=∑i=1n∣xi∣\|x\|_1 = \sum_{i=1}^{n} |x_i|

∥x∥\|x\| usually means ∥x∥2\|x\|_2.

The projection of xx on yy is

x⋅y∥y∥2 y\frac{x \cdot y}{\|y\|^2} \, y

and the cosine similarity of xx and yy is

x⋅y∥x∥⋅∥y∥\frac{x \cdot y}{\|x\| \cdot \|y\|}

Square Matrices

For square matrices A,B∈Rn×nA, B \in \mathbb{R}^{n \times n} and a scalar c∈Rc \in \mathbb{R}, assume A−1,B−1A^{-1}, B^{-1} exist.

  • AA is invertible   ⟺  \iff det⁡(A)≠0\det(A) \neq 0   ⟺  \iff AA is full-rank   ⟺  \iff columns of AA are linearly independent
  • (AT)−1=(A−1)T(A^T)^{-1} = (A^{-1})^T
  • (AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}
  • det⁡(AB)=det⁡A⋅det⁡B\det(AB) = \det A \cdot \det B
  • det⁡(A−1)=1det⁡A\det(A^{-1}) = \frac{1}{\det A}
  • det⁡(cA)=cndet⁡(A)\det(cA) = c^n \det(A)
  • AA is orthogonal if ATA=I  ⟺  A−1=ATA^T A = I \iff A^{-1} = A^T
  • tr(A)=∑i=1nAii=∑i=1nλi\mathrm{tr}(A) = \sum_{i=1}^{n} A_{ii} = \sum_{i=1}^{n} \lambda_i for eigenvalues λi\lambda_i
  • AA is symmetric if AT=AA^T = A

General Matrices

More generally, for matrices of compatible shapes,

  • (AB)T=BTAT(AB)^T = B^T A^T
  • (A+B)T=AT+BT(A + B)^T = A^T + B^T
  • tr(AB)=tr(BA)\mathrm{tr}(AB) = \mathrm{tr}(BA) for A∈Rn×mA \in \mathbb{R}^{n \times m}, B∈Rm×nB \in \mathbb{R}^{m \times n}
  • AB≠BAAB \neq BA necessarily, matrix multiplication is not commutative

Positive and Negative Semi-Definiteness

For a symmetric A∈Rn×nA \in \mathbb{R}^{n \times n},

  • AA is positive semi-definite when xTAx≥0x^T A x \ge 0 for all x∈Rnx \in \mathbb{R}^n   ⟺  \iff all eigenvalues of AA are ≥0\ge 0
  • AA is negative semi-definite when xTAx≤0x^T A x \le 0 for all x∈Rnx \in \mathbb{R}^n   ⟺  \iff all eigenvalues of AA are ≤0\le 0

Positive (negative) definite is the same with strict inequalities for x≠0x \neq 0.