Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Diagonal Matrix from vector

  1. Feb 15, 2008 #1


    User Avatar
    Homework Helper

    Perhaps a silly question. I have a vector:

    [tex]a=[a_1 \ a_2 \ a_3 \ ...\ a_n]^T[/tex]

    that I want to turn into a diagonal matrix. Is there an elegant way to represent this? I thought maybe something like:


    would do, but it doesn't. I suppose I can use the kronecker delta and subscript form:

    [tex]b_{ij} = \delta_{ij}a_i[/tex]

    but how would this be done in matrix form?
  2. jcsd
  3. Feb 16, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper

    I think it is common notation to denote a diagonal matrix such as
    \lambda_1 & 0 & 0 & \cdots & 0 \\
    0 & \lambda_2 & 0 & \cdots & 0 \\
    0 & 0 & \lambda_3 & & \vdots \\
    \vdots & 0 & 0 & \ddots & 0 \\
    0 & 0 & 0 & 0 & \lambda_n \\
    [tex]\operatorname{diag}(\lambda_1, \lambda_2, \cdots, \lambda_n)[/tex].
    So you could write
    [tex]\operatorname{diag}(a_1, a_2, \cdots, a_n)[/tex]
    and everyone will know what you mean, and you can even write
    [tex]\operatorname{diag}(\vec a)[/tex]
    to mean just that (though you should define it explicitly, just to be clear).
  4. Jul 1, 2008 #3
    \operatorname{diag}(\lambda_1, \lambda_2, \cdots, \lambda_n)
    [/tex] seems OK but does not look good in long equations.

    Some writers prefer to add a superscript [tex] D[/tex] as in [tex]a^D[/tex].
    I always use small letters for vectors and capital letters for matrices. And if you combine this rule with the difference between braces and brackets, then the case is also resolved. In general braces ([tex]\{...\}[/tex]) are used to denote vectors, and brackets for matrices ([tex][...][/tex]). So a small letter in brackets is nothing but a diagonal matrix with the elements of a vector as its diagonal entries.
    If you would like...
  5. Jun 15, 2011 #4
    you can use a vector times a bold 1, i.e a1
  6. Jun 15, 2011 #5
    This thread is 3 years old... :frown:
  7. Jul 3, 2013 #6
    So what? This information stays online for years. A delayed answer might not help the person who asked the question in the first place, but it could help the larger community.
  8. Jul 3, 2013 #7


    User Avatar
    Science Advisor
    Homework Helper

    Wow... and you registered just to make that remark? :)
  9. Jul 3, 2013 #8

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    But the answer is wrong, and was already mentioned in the thread as being wrong.
  10. Jul 3, 2013 #9

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    A nearly perfect answer was given over 5 years ago in post #2:

    My only gripe: the parenthetical remark though you should define it explicitly, just to be clear. I can see only two possible outcomes if some reviewer said that about my use [itex]\operatorname{diag}(\vec a)[/itex] in some math:
    • Aggressive. Reject the comment with
      Really?! Are you serious? We lost the people who don't understand [itex]\operatorname{diag}(\vec a)[/itex] on page 2.

    • Passive aggressive. Modify the offending equation with
      [tex]\mathrm A = \cdots \operatorname{diag}(\vec a) \cdots \ \ \text{where} \operatorname{diag}(\vec a) = \sum\nolimits_i a_i e_i e_i^T[/tex]
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook