Skip to main content
3 of 3
Added top-level tag (bump the question -- maybe someone wishes to cast the remaining delete vote).
Stefan Kohl
  • 19.6k
  • 21
  • 75
  • 137

vector to diagonal matrix

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.

Jerry
  • 247
  • 1
  • 2
  • 3