Section 6.3 Operations On Matrices
Matrices also support non-arithmetic, unary operations; operation that are applied to the matrix itself and its entrees. Some of these operations are shown below.
Subsection 6.3.1 Determinant and Inverse of a Matrix
The determinant of a square matrix is a scalar value that provides important information about the matrix, such as whether it is invertible and how it scales space during transformations. For an \(n \times n\) matrix \(A\text{,}\) the determinant is denoted as \(\det(A)\) or \(|A|\text{.}\) If the determinant is zero, the matrix is singular and does not have an inverse. In Sage, the determinant of a matrix can be computed using the
det
method:Note that the determinant of the identity matrix is 1, and the determinant of the zero matrix is 0.
The inverse of a matrix \(A\) is denoted as \(A^{-1}\) and is defined as the matrix that, when multiplied with \(A\text{,}\) yields the identity matrix. The inverse exists only if the determinant of the matrix is non-zero. In Sage, the inverse of a matrix can be computed using the
inverse
method:Subsection 6.3.2 Transpose and Conjugate of a Matrix
The transpose of a matrix is obtained by flipping it over its diagonal, swapping rows with columns. The transpose is denoted as \(A^T\) and can be computed in Sage using the
transpose
method: For matrices with complex entries, the complex conjugate is found by taking the conjugate of each individual entry. This operation is often used in conjunction with the transpose to form the conjugate transpose (also called the Hermitian transpose)
Matrices with Complex values, and computing conjugates are very common in signal processing and quantum mechanics.
Just like vectors, matrices also has a norm quantity defined. But unlike vectors, there are several types of norms for matrices. The method
norm
in Sage returns the Frobenius norm which is defined as the square root of the sum of the squares of all the entries in the matrix.Subsection 6.3.3 LU Decomposition of a Matrix
The LU decomposition of a matrix is a factorization of the matrix into a product of a lower triangular matrix \(L\) and an upper triangular matrix \(U\text{.}\) This decomposition is useful for solving systems of linear equations and computing the determinant of the matrix.
In Sage, the LU decomposition can be computed using the
LU()
method:The product of the matrices \(P\text{,}\) \(L\text{,}\) and \(U\) yields the original matrix \(A\text{.}\) The matrix \(P\) is called the Pivot (or the permutation) matrix, which always has a determinant of 1 (has exactly one \(1\) in every row and column). The matrix \(L\) is the Lower triangular matrix L. its determinant is equal to the product of the diagonal entries.
Similarly, the matrix \(U\) is the Upper triangular matrix U. its determinant is also equal to the product of the diagonal entries.
Note that the LU decomposition is not unique, and there are many different ways to perform it. For instance, we can choose to decomposition with a pivot that has a non-zero determinant (also equal to 1 in this case):
Withpartial pivoting, every entry of \(L\) will have absolute value of \(1\) or less.
Additionally, Sage offers different ways to format the display of the result of the LU decomposition.
And for a slightly compact format: