In mathematics, especially in linear algebra and matrix theory, the vectorization of a matrix is a linear transformation which converts the matrix into a vector. Specifically, the vectorization of a m × n matrix A, denoted vec(A), is the mn × 1 column vector obtained by stacking the columns of the matrix A on top of one another: vec ( A ) = [ a 1 , 1 , … , a m , 1 , a 1 , 2 , … , a m , 2 , … , a 1 , n , … , a m , n ] T {\displaystyle \operatorname {vec} (A)=[a_{1,1},\ldots ,a_{m,1},a_{1,2},\ldots ,a_{m,2},\ldots ,a_{1,n},\ldots ,a_{m,n}]^{\mathrm {T} }} Here, a i , j {\displaystyle a_{i,j}} represents the element in the i-th row and j-th column of A, and the superscript T {\displaystyle {}^{\mathrm {T} }} denotes the transpose. Vectorization expresses, through coordinates, the isomorphism R m × n := R m ⊗ R n ≅ R m n {\displaystyle \mathbf {R} ^{m\times n}:=\mathbf {R} ^{m}\otimes \mathbf {R} ^{n}\cong \mathbf {R} ^{mn}} between these (i.e., of matrices and vectors) as vector spaces.
For example, for the 2×2 matrix A = [ a b c d ] {\displaystyle A={\begin{bmatrix}a&b\\c&d\end{bmatrix}}} , the vectorization is vec ( A ) = [ a c b d ] {\displaystyle \operatorname {vec} (A)={\begin{bmatrix}a\\c\\b\\d\end{bmatrix}}} .
The connection between the vectorization of A and the vectorization of its transpose is given by the commutation matrix.