For any column vector we can easily create a corresponding diagonal matrix, whose elements along the diagonal are the elements of the column vector.

Is there a simple way to write this transformation using standard linear algebra operations (such as matrix multiplication, etc.), instead of explicitly writing it as $diag(\mathbf{x})$?

For example $M \mathbf{x}$ cannot work for any matrix M, since the result will be a vector, not a diagonal matrix. But maybe there is some more elaborate expression that yields the diagonal matrix.

  • 2
    $\begingroup$ I have worried about this, and think the answer is basically no, largely because a column vector is rank 1 and the diagonal matrix is larger rank. But I wouldn't say that's a proof. $\endgroup$ Feb 18, 2011 at 4:11
  • $\begingroup$ When you say "notation", do you mean "method"? $\endgroup$
    – Yemon Choi
    Feb 18, 2011 at 4:17
  • 1
    $\begingroup$ Well you can hardly call it a method, it doesn't really do any multiplications, its basically just writing it in a way that implies its shape. $\endgroup$
    – Jerry
    Feb 18, 2011 at 4:22
  • $\begingroup$ notation-wise that's $diag({\bf x})$. proof-wise, however, I agree with the first comment, you jump from a $1$-dimensional space to an $n$-dimensional space, so no linear operator can get you there. From the diagonal you can definitely go to the vector. Just multiply it with the all ones vector. $\endgroup$
    – Anadim
    Feb 18, 2011 at 4:34
  • 2
    $\begingroup$ I think this question should be improved before it is appropriate for MO. As is, I have voted to close, but I hope that instead OP rewrites it to clarify (you can modify the question by clicking the little "edit" button). Please see mathoverflow.net/howtoask . $\endgroup$ Feb 18, 2011 at 5:14

1 Answer 1


I'm not sure whether it answers your question, but here is a "matrix procedure" to transform the column vector $v$ into a diagonal matrix $D$:

Let $E_i$ be the $n \times n$ matrix with a $1$ on position $(i,i)$ and zeros everywhere else; similarly, let $e_i$ be the $1 \times n$ row matrix with a $1$ on position $(1,i)$ and zeros everywhere else. Then

$$D = \sum_{i=1}^n E_i v e_i .$$

  • 2
    $\begingroup$ Great, just what I was looking for! $\endgroup$ Mar 11, 2014 at 23:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.