Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Compute Determinants and Traces of Square Matrices

MuPAD® provides the functions for performing many special operations on matrices. You can compute the dimensions of a matrix, swap or delete columns and rows, or transpose a matrix. For square matrices, you can compute determinants and traces.

To compute the determinant of a square matrix, use the det function. For example, compute the determinant of the following 2×2 matrix:

A := matrix(2, 2, [a, b, c, d]):
det(A)

Now, compute the determinant of the 12×12 Hilbert matrix:

det(linalg::hilbert(12))

To compute a sum of the diagonal elements of a square matrix (the trace of a matrix), use the linalg::tr function. For example, the trace of the matrix A is:

A := matrix(2, 2, [a, b, c, d]):
linalg::tr(A)

Now, compute the trace of the 12×12 Hilbert matrix:

H := linalg::hilbert(12):
linalg::tr(H)

Was this topic helpful?