Vectorization of a diagonal matrix

linear algebramatricesvectorization

Is there any representation for the vectorization of a diagonal matrix $\text{vec}(\text{Diag}(x))$?

For example, for two elements $$\text{vec}(\begin{bmatrix} x_1 & 0 \\ 0 &x_2 \end{bmatrix}) = \begin{bmatrix} 1 & 0 \\ 0 & 0 \\ 0 & 0 \\ 0 & 1 \end{bmatrix} \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} \ . $$

In general case, $\text{vec}(\text{Diag}(x)) = A x$, what is the closed form for matrix $A$?

Best Answer

$A : \Bbb R^n \to \Bbb R^{n^2}$. Let $e_i, i = 1, ..., n$ be the canonical basis vectors of $\Bbb R^n$, and let $f_j, j = 1, ..., n^2$ be the canonical basis vectors of $\Bbb R^{n^2}$

Then $$A = \sum_{i=1}^n f_{ni - n + i}\otimes e_i^T$$

Related Question