Inmathematics, especially inlinear algebra andmatrix theory, theduplication matrix and theelimination matrix arelinear transformations used for transforminghalf-vectorizations ofmatrices intovectorizations or (respectively) vice versa.
The duplication matrix
is the unique
matrix which, for any
symmetric matrix
, transforms
into
:
.
For the
symmetric matrix
, this transformation reads

The explicit formula for calculating the duplication matrix for a
matrix is:

Where:
Here is aC++ function usingArmadillo (C++ library):
arma::matduplication_matrix(constint&n){arma::matout((n*(n+1))/2,n*n,arma::fill::zeros);for(intj=0;j<n;++j){for(inti=j;i<n;++i){arma::vecu((n*(n+1))/2,arma::fill::zeros);u(j*n+i-((j+1)*j)/2)=1.0;arma::matT(n,n,arma::fill::zeros);T(i,j)=1.0;T(j,i)=1.0;out+=u*arma::trans(arma::vectorise(T));}}returnout.t();}An elimination matrix
is a
matrix which, for any
matrix
, transforms
into
:
. [1]
By the explicit (constructive) definition given byMagnus & Neudecker (1980), the
by
elimination matrix
is given by

where
is a unit vector whose
-th element is one and zeros elsewhere, and
.
Here is aC++ function usingArmadillo (C++ library):
arma::matelimination_matrix(constint&n){arma::matout((n*(n+1))/2,n*n,arma::fill::zeros);for(intj=0;j<n;++j){arma::rowvece_j(n,arma::fill::zeros);e_j(j)=1.0;for(inti=j;i<n;++i){arma::vecu((n*(n+1))/2,arma::fill::zeros);u(j*n+i-((j+1)*j)/2)=1.0;arma::rowvece_i(n,arma::fill::zeros);e_i(i)=1.0;out+=arma::kron(u,arma::kron(e_j,e_i));}}returnout;}For the
matrix
, one choice for this transformation is given by
.
- Magnus, Jan R.; Neudecker, Heinz (1980),"The elimination matrix: some lemmas and applications",SIAM Journal on Algebraic and Discrete Methods,1 (4):422–449,doi:10.1137/0601049,ISSN 0196-5212.
- Jan R. Magnus and Heinz Neudecker (1988),Matrix Differential Calculus with Applications in Statistics and Econometrics, Wiley.ISBN 978-0-471-98633-1.
- Jan R. Magnus (1988),Linear Structures, Oxford University Press.ISBN 978-0-19-520655-5