Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Matrices and Linear Algebra > Parts of Matrices > Diagonal >
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Programming > Matrices and Linear Algebra > Parts of Matrices > Diagonal >
Mathematica > Visualization and Graphics > Graphs & Networks > Graph Programming > Matrices and Linear Algebra > Parts of Matrices > Diagonal >

Diagonal

Diagonal[m]
gives the list of elements on the leading diagonal of the matrix m.
Diagonal
gives the elements on the k^(th) diagonal of m.
  • Diagonal[m] works even if m is not a square matrix.
  • For positive k, Diagonal gives diagonals above the leading diagonal. Diagonal gives diagonals below.
Give the diagonal elements of a matrix:
Give diagonals one element above and below the leading diagonal:
Give a diagonal of a nonsquare matrix:
Give the diagonal elements of a matrix:
In[1]:=
Click for copyable input
Out[1]=
 
Give diagonals one element above and below the leading diagonal:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Give a diagonal of a nonsquare matrix:
In[1]:=
Click for copyable input
Out[1]=
Subdiagonals and superdiagonals:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF