A matrix decomposition or matrix factorisation expresses a matrix AA as a product of matrices with special structure, such as triangular, diagonal or orthogonal matrices, so that properties of AA can be read off the factors and systems of linear equations involving AA can be solved by simpler steps. The diagonalisation A=PΛP−1A=P\Lambda P^{-1} of a non-defective square matrix is one such decomposition.

The spectral theorem states that a real symmetric matrix A∈R n×nA\in\mathbb{R}^{\,n\times n} has nn real eigenvalues λ1,…,λn,\lambda_1,\ldots,\lambda_n, repeated according to algebraic multiplicity, and an eigen-basis of Rn\mathbb{R}^n that is an orthonormal set. Collecting the orthonormal eigenvectors as the columns of QQ gives an orthogonal matrix and the spectral decomposition

A=QΛQ⊺=∑i=1nλi q‾iq‾i⊺A=Q\Lambda Q^\intercal=\sum_{i=1}^n\lambda_i\,\underline{q}_i\underline{q}_i^\intercal

where Λ\Lambda is the diagonal matrix of eigenvalues. A real symmetric matrix is therefore positive definite if and only if all of its eigenvalues are positive, and positive semi-definite if and only if all of its eigenvalues are non-negative. The complex analogue states that a Hermitian matrix has real eigenvalues and a decomposition A=UΛU∗A=U\Lambda U^* with UU unitary.

Let A∈F n×nA\in\mathbb{F}^{\,n\times n} be a square matrix. The leading principal sub-matrix Ak∈F k×kA_k\in\mathbb{F}^{\,k\times k} of AA is formed from its first kk rows and columns, and the leading principal minor of order kk is ∣Ak∣.\lvert A_k\rvert. An LU decomposition of AA is a factorisation

A=LUA=LU

where L∈F n×nL\in\mathbb{F}^{\,n\times n} is a lower triangular matrix with diagonal elements equal to one and U∈F n×nU\in\mathbb{F}^{\,n\times n} is an upper triangular matrix. If AA is invertible then an LU decomposition exists if and only if every leading principal minor ∣Ak∣,\lvert A_k\rvert, k=1,…,n−1,k=1,\ldots,n-1, is non-zero, and it is then unique. The factors are produced by Gaussian elimination: UU is the result of eliminating the elements below the diagonal column by column using row operations and LL records the multipliers used.

A permutation matrix P∈F n×nP\in\mathbb{F}^{\,n\times n} is a matrix obtained by reordering the rows of the identity matrix In,I_n, so that PAPA reorders the rows of AA in the same way. Permutation matrices are orthogonal, so P−1=P⊺.P^{-1}=P^\intercal. Every square matrix AA has a PLU decomposition

PA=LUPA=LU

for some permutation matrix P,P, obtained by swapping rows during Gaussian elimination so that each diagonal element used for elimination is non-zero. The determinant follows from the factors, ∣A∣=∣P∣∏i=1nuii\lvert A\rvert=\lvert P\rvert\prod_{i=1}^n u_{ii} where ∣P∣=±1,\lvert P\rvert=\pm 1, and the system Ax‾=b‾A\underline{x}=\underline{b} is solved by the two triangular systems Ly‾=Pb‾L\underline{y}=P\underline{b} and Ux‾=y‾U\underline{x}=\underline{y} by forward and back substitution.

Let A∈F n×pA\in\mathbb{F}^{\,n\times p} be a matrix with rank r≥1.r\geq 1. A rank factorisation of AA is a factorisation

A=CFA=CF

where C∈F n×rC\in\mathbb{F}^{\,n\times r} and F∈F r×pF\in\mathbb{F}^{\,r\times p} both have rank r.r. Every matrix of rank r≥1r\geq 1 has a rank factorisation: the columns of CC can be taken to be any basis of the column space of AA and the columns of FF are then the coordinates of the columns of AA in that basis. The factorisation is not unique, since A=(CM)(M−1F)A=\left(CM\right)\left(M^{-1}F\right) for any invertible M∈F r×r,M\in\mathbb{F}^{\,r\times r}, and rr is the smallest inner dimension for which AA factorises as a product of two matrices.

Let A∈R n×nA\in\mathbb{R}^{\,n\times n} be a real symmetric positive definite matrix. The Cholesky decomposition of AA is the factorisation

A=LL⊺A=LL^\intercal

where L∈R n×nL\in\mathbb{R}^{\,n\times n} is a lower triangular matrix with positive diagonal elements. The Cholesky decomposition exists and is unique if and only if AA is symmetric positive definite, so attempting to compute it is a test for positive definiteness. For a Hermitian positive definite matrix the decomposition is A=LL∗.A=LL^*. The elements of LL are computed column by column from

ljj=ajj−∑k=1j−1ljk2,lij=1ljj(aij−∑k=1j−1likljk)  ∀ i>j,l_{jj}=\sqrt{a_{jj}-\sum_{k=1}^{j-1}l_{jk}^2},\qquad l_{ij}=\frac{1}{l_{jj}}\left(a_{ij}-\sum_{k=1}^{j-1}l_{ik}l_{jk}\right)\,\,\forall\,i>j,

the determinant is ∣A∣=∏i=1nlii2\lvert A\rvert=\prod_{i=1}^n l_{ii}^2 and LL acts as a matrix square root of A.A. A symmetric positive semi-definite matrix also factorises as LL⊺LL^\intercal with non-negative diagonal elements, but then not necessarily uniquely.

Let A∈R n×pA\in\mathbb{R}^{\,n\times p} be a real matrix with n≥p.n\geq p. A QR decomposition of AA is a factorisation

A=QRA=QR

where Q∈R n×pQ\in\mathbb{R}^{\,n\times p} has orthonormal columns, so is orthogonal when n=pn=p and semi-orthogonal when n>p,n>p, and R∈R p×pR\in\mathbb{R}^{\,p\times p} is an upper triangular matrix. This is the thin QR decomposition. The full QR decomposition extends QQ to an orthogonal matrix in R n×n\mathbb{R}^{\,n\times n} by appending n−pn-p further orthonormal columns and RR to a matrix in R n×p\mathbb{R}^{\,n\times p} by appending n−pn-p rows of zeros. Every real matrix has a QR decomposition. If AA has rank pp then the thin QR decomposition with positive diagonal elements of RR is unique and is given by Gram-Schmidt orthonormalisation of the columns a‾1,…,a‾p\underline{a}_1,\ldots,\underline{a}_p of A:A: the columns q‾1,…,q‾p\underline{q}_1,\ldots,\underline{q}_p of QQ are the orthonormalised vectors and

rij=⟨a‾j,q‾i⟩  ∀ i≤jr_{ij}=\langle\underline{a}_j,\underline{q}_i\rangle\,\,\forall\,i\leq j

so that a‾j=∑i=1jrijq‾i.\underline{a}_j=\sum_{i=1}^j r_{ij}\underline{q}_i. The columns of QQ are an orthonormal basis of the column space of A.A. The QR decomposition solves the least squares problem of minimising ∥Ax‾−b‾∥\lVert A\underline{x}-\underline{b}\rVert over x‾∈Rp\underline{x}\in\mathbb{R}^p through the triangular system Rx‾=Q⊺b‾.R\underline{x}=Q^\intercal\underline{b}. The complex analogue has unitary QQ and uses the conjugate transpose.

Let A∈R n×pA\in\mathbb{R}^{\,n\times p} be a real matrix. The matrix A⊺A∈R p×pA^\intercal A\in\mathbb{R}^{\,p\times p} is symmetric positive semi-definite, since v‾⊺A⊺Av‾=∥Av‾∥2≥0,\underline{v}^\intercal A^\intercal A\underline{v}=\lVert A\underline{v}\rVert^2\geq 0, so by the spectral theorem its eigenvalues λ1≥…≥λp≥0\lambda_1\geq\ldots\geq\lambda_p\geq 0 are real and non-negative. The singular values of AA are the square roots of these eigenvalues in decreasing order.

σi:=λi,σ1≥σ2≥…≥σmin⁡{n,p}≥0\sigma_i:=\sqrt{\lambda_i},\qquad\sigma_1\geq\sigma_2\geq\ldots\geq\sigma_{\min\{n,p\}}\geq 0

The matrices A⊺AA^\intercal A and AA⊺AA^\intercal share their non-zero eigenvalues, so AA has min⁡{n,p}\min\{n,p\} singular values and the number of non-zero singular values is the rank of A.A.

The singular value decomposition (SVD) of AA is the factorisation

A=UΣV⊺A=U\Sigma V^\intercal

where U∈R n×nU\in\mathbb{R}^{\,n\times n} and V∈R p×pV\in\mathbb{R}^{\,p\times p} are orthogonal matrices and Σ∈R n×p\Sigma\in\mathbb{R}^{\,n\times p} has the singular values σ1,…,σmin⁡{n,p}\sigma_1,\ldots,\sigma_{\min\{n,p\}} along its diagonal and zeros elsewhere. The columns u‾1,…,u‾n\underline{u}_1,\ldots,\underline{u}_n of UU are the left singular vectors and the columns v‾1,…,v‾p\underline{v}_1,\ldots,\underline{v}_p of VV are the right singular vectors of A.A. Every real matrix has a singular value decomposition, and the singular values are unique although UU and VV are not. Multiplying out gives

A⊺A=VΣ⊺ΣV⊺,AA⊺=UΣΣ⊺U⊺A^\intercal A=V\Sigma^\intercal\Sigma V^\intercal,\qquad AA^\intercal=U\Sigma\Sigma^\intercal U^\intercal

so the right singular vectors are orthonormal eigenvectors of A⊺A,A^\intercal A, the left singular vectors are orthonormal eigenvectors of AA⊺AA^\intercal and the two are linked by

Av‾i=σiu‾i,A⊺u‾i=σiv‾i  ∀ i≤min⁡{n,p}.A\underline{v}_i=\sigma_i\underline{u}_i,\qquad A^\intercal\underline{u}_i=\sigma_i\underline{v}_i\,\,\forall\,i\leq\min\{n,p\}.

If AA is symmetric positive semi-definite then its singular value decomposition coincides with its spectral decomposition. The complex analogue has unitary UU and VV and uses the conjugate transpose.

Let AA have rank r.r. The thin singular value decomposition keeps only the rr non-zero singular values and the corresponding singular vectors, Ur∈R n×r,U_r\in\mathbb{R}^{\,n\times r}, Σr∈R r×r\Sigma_r\in\mathbb{R}^{\,r\times r} and Vr∈R p×r,V_r\in\mathbb{R}^{\,p\times r}, and expresses AA as a sum of rr rank-one matrices.

A=UrΣrVr⊺=∑i=1rσi u‾iv‾i⊺A=U_r\Sigma_rV_r^\intercal=\sum_{i=1}^r\sigma_i\,\underline{u}_i\underline{v}_i^\intercal

The left singular vectors u‾1,…,u‾r\underline{u}_1,\ldots,\underline{u}_r are an orthonormal basis of the column space of AA and the right singular vectors v‾r+1,…,v‾p\underline{v}_{r+1},\ldots,\underline{v}_p are an orthonormal basis of the kernel of A,A, the set of x‾\underline{x} with Ax‾=0‾.A\underline{x}=\underline{0}.

The Frobenius norm of a matrix A∈R n×pA\in\mathbb{R}^{\,n\times p} is the Euclidean length of its elements, which equals the Euclidean length of its singular values.

∥A∥F:=∑i=1n∑j=1paij2=tr(A⊺A)=∑i=1min⁡{n,p}σi2\lVert A\rVert_F:=\sqrt{\sum_{i=1}^n\sum_{j=1}^p a_{ij}^2}=\sqrt{\mathrm{tr}\left(A^\intercal A\right)}=\sqrt{\sum_{i=1}^{\min\{n,p\}}\sigma_i^2}

The Eckart–Young theorem states that for k<rk<r the matrix of rank at most kk that is closest to AA in Frobenius norm is the truncated singular value decomposition that keeps the kk largest singular values.

Ak:=∑i=1kσi u‾iv‾i⊺A_k:=\sum_{i=1}^k\sigma_i\,\underline{u}_i\underline{v}_i^\intercal ∥A−Ak∥F=∑i=k+1rσi2=min⁡rank B≤k∥A−B∥F\lVert A-A_k\rVert_F=\sqrt{\sum_{i=k+1}^r\sigma_i^2}=\min_{\mathrm{rank}\,B\leq k}\lVert A-B\rVert_F

This low-rank approximation underlies principal components analysis and data compression.

Let A∈R n×pA\in\mathbb{R}^{\,n\times p} have singular value decomposition A=UΣV⊺A=U\Sigma V^\intercal and let Σ+∈R p×n\Sigma^+\in\mathbb{R}^{\,p\times n} be the matrix with 1σi\frac{1}{\sigma_i} in the diagonal positions where Σ\Sigma has non-zero σi\sigma_i and zeros elsewhere. The Moore–Penrose pseudo-inverse of AA is

A+:=VΣ+U⊺∈R p×n.A^+:=V\Sigma^+U^\intercal\in\mathbb{R}^{\,p\times n}.

The pseudo-inverse is the unique matrix satisfying the four conditions

AA+A=A,A+AA+=A+,(AA+)⊺=AA+,(A+A)⊺=A+AAA^+A=A,\qquad A^+AA^+=A^+,\qquad\left(AA^+\right)^\intercal=AA^+,\qquad\left(A^+A\right)^\intercal=A^+A

and generalises the matrix inverse to singular and non-square matrices: if AA is invertible then A+=A−1,A^+=A^{-1}, if AA has rank pp then A+=(A⊺A)−1A⊺A^+=\left(A^\intercal A\right)^{-1}A^\intercal and if AA has rank nn then A+=A⊺(AA⊺)−1.A^+=A^\intercal\left(AA^\intercal\right)^{-1}. The vector x‾=A+b‾\underline{x}=A^+\underline{b} is the solution of the least squares problem of minimising ∥Ax‾−b‾∥\lVert A\underline{x}-\underline{b}\rVert that has the smallest Euclidean length ∥x‾∥,\lVert\underline{x}\rVert, and AA+AA^+ is the matrix that projects Rn\mathbb{R}^n orthogonally onto the column space of A.A.