This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

DiagonalMatrix

Updated In 6 Graphic
DiagonalMatrix[list]
gives a matrix with the elements of list on the leading diagonal, and 0 elsewhere.
DiagonalMatrix[list, k]
gives a matrix with the elements of list on the k^(th) diagonal.
  • For positive k, DiagonalMatrix[list, k] puts the elements k positions above the main diagonal. DiagonalMatrix[list, -k] puts the elements k positions below.
  • DiagonalMatrix[list, k] fills the k^(th) diagonal of a square matrix with the elements from list. Different values of k lead to different matrix dimensions.
New in 1 | Last modified in 6