Documentation Center |
Determinant of a matrix
Note: linalg::det will be removed in a future release. Use det instead. |
This functionality does not run in MATLAB.
linalg::det(A, options)
linalg::det(A) computes the determinant of the square matrix A.
A floating-point approximation of the determinant is computed with numeric::det, if A is defined over the component ring Dom::Float. In this case, it is recommended to call numeric::det directly for a better efficiency.
The component ring of A must be a commutative ring, i.e., a domain of category Cat::CommutativeRing.
The MinorExpansion option is useful for small matrices (typically, matrices of dimension up to 10) containing many symbolic entries. By default, linalg::det tries to recognize matrices that can benefit from using MinorExpansion, and uses this option when computing their determinants. Nevertheless, linalg::det does not always recognize these matrices. Also, identifying that a matrix is small enough and contains many symbolic entries takes time. To improve performance, use the MinorExpansion option explicitly.
By default, linalg::det calls normal before returning results. This additional internal call ensures that the final result is normalized. This call can be computationally expensive. It also affects the result returned by linalg::det only if a matrix contains variables or exact expressions, such as sqrt(5) or sin(PI/7)).
To avoid this additional call, specify Normal = FALSE. In this case, linalg::det also can return normalized results, but does not guarantee such normalization. See Example 2 and Example 3.
Compute the determinant of the following matrix:
A := matrix([[a11, a12], [a21, a22]])
linalg::det returns the well-known formula for the determinant of an arbitrary 2×2 matrix:
linalg::det(A)
If you use the Normal option, linalg::det calls the normal function for final results. This call ensures that linalg::det returns results in normalized form:
linalg::det(matrix([[x, x^2], [x/(x + 2), 1/x]]))
If you specify Normal = FALSE, linalg::det does not call normal for the final result:
linalg::det(matrix([[x, x^2], [x/(x + 2), 1/x]]), Normal = FALSE)
Using Normal can significantly decrease the performance of linalg::det. For example, computing the determinant of this matrix takes a long time:
n := 5: det5 := linalg::det(matrix([[(x[i*j]^(i + j) + x[i+j]^j)/(i + j) $ j = 1..n] $ i = 1..n])):
For better performance, specify Normal = FALSE:
n := 5: det5 := linalg::det(matrix([[(x[i*j]^(i + j) + x[i+j]^j)/(i + j) $ j = 1..n] $ i = 1..n]), Normal = FALSE):
MinorExpansion |
Compute the determinant by a recursive minor expansion along the first column. |
Normal |
Option, specified as Normal = b Return normalized results. The value b must be TRUE or FALSE. By default, Normal = TRUE, meaning that linalg::det guarantees normalization of the returned results. Normalizing results can be computationally expensive. |
For an n×n matrix A = (a_{i, j})_{1 ≤ i ≤ n, 1 ≤ j ≤ n} over a commutative ring its determinant is defined as:
.
(S_{n} is the symmetric group of all permutations of {1, …, n}.)
For a component ring of A that is an integral domain (i.e., a domain of category Cat::IntegralDomain) and not defined over the domain Dom::Float, Gaussian elimination is used to compute the determinant of A.
For any other commutative ring that is not an integral domain, a modification of the Berkowitz algorithm is used.
Reference: A. Jounaidi: The Berkowitz Algorithm, Maple and Computing the Characteristic Polynomial in an Arbitrary Commutative Ring. Equipe de Mathématiques de Besançon, Université de Franche-Comté, 25030 Besançon Cedex, May 1996.