Skip to main content

Linear Algebra with SageMath: Learn math with open-source software

Section 6.1 Special Matrices

Some matrices occur frequently enough to be given special names:
  • The zero matrix contains only zeros and acts as the additive identity.
  • A diagonal matrix has zero entries everywhere outside the main diagonal. Note that a diagonal matrix may have some or all its diagonal entries equal to \(0\) (recall that the main diagonal runs from the top left to the bottom right of the matrix, while the secondary diagonal runs from the top right to the bottom left).
    Diagonal matrices are simple to multiply and often appear in eigenvalue problems which we’ll see in upcoming chapters.
  • An identity matrix is a diagonal matrix with all its diagonal elements equals to 1.
  • Although the ones matrix is not a predefined matrix in Sage, it is common in other similar computational frameworks such as Octave©, and MATLAB©. Essentially, it is a matrix where every entry is 1. It can be created by leverage the built-in list duplication operator * applied on a list of ones.
  • Two other common types of matrices are the Upper and Lower triangular matrices:
    An Upper Triangular Matrix is a square matrix where all entries below the main diagonal are zero.
    A Lower Triangular Matrix is a square matrix where all entries above the main diagonal are zero.
    Sage does not have these last two as predefined command. They can however be obtained by leveraging the LU() method that we will see in the next section.