Det[m]
gives the determinant of the square matrix m.
Det
Det[m]
gives the determinant of the square matrix m.
Examples
open all close allBasic Examples (2)
Scope (13)
Basic Uses (8)
Find the determinant of a MachinePrecision matrix:
Det[{{1.7, 7.1, -2.7}, {2.2, 8.7, 3.2}, {3.2, -9.2, 1.2}}]Determinant of a complex matrix:
Det[{{1. + I, 2, 3 - 2 I}, {0, 4 π, 5I}, {3, 0, 6}}]Determinant of an exact matrix:
Det[{{1, 2, 4}, {5, 4, 5}, {9, 2, 7}}]Determinant of an arbitrary-precision matrix:
Det[RandomReal[2, {3, 3}, WorkingPrecision -> 20]]Determinant of a symbolic matrix:
Det[{{a, b, c}, {d, e, f}, {g, h, i}}]The determinant of a large numerical matrix is computed efficiently:
mat = BlockRandom[RandomReal[3, {1500, 1500}], RandomSeeding -> 1234];Det[mat]//TimingNote that the result may not be a machine number:
Divide[Abs[Last[%]], $MaxMachineNumber]Determinant of a matrix with finite field elements:
ℱ = FiniteField[17, 3];
Det[{{ℱ[12], ℱ[23], ℱ[34]}, {ℱ[45], ℱ[56], ℱ[67]}, {ℱ[78], ℱ[89], ℱ[90]}}]Determinant of a CenteredInterval matrix:
(m = Map[CenteredInterval, RandomReal[{-10, 10}, {3, 3}, WorkingPrecision -> 10], {2}])//MatrixFormmdet = Det[m]Find a random representative mrep of m:
ranrep[e_CenteredInterval] := e["Center"] + RandomInteger[{-1000, 1000}] / 1000 e["Radius"]
(mrep = Map[ranrep, m, {2}])//MatrixFormVerify that mdet contains the determinant of mrep:
IntervalMemberQ[mdet, Det[mrep]]Special Matrices (5)
Determinants of sparse matrices:
SparseArray[{{1, 3} -> 2, {2, 2} -> 3, {3, 1} -> 1, {4, 2} -> 5}, {4, 4}]Det[%]SparseArray[{{x_, y_} /; Abs[x - y] < 3 -> 1}, {10, 10}]Det[%]Determinants of structured matrices:
SymmetrizedArray[{{1, 1} -> 2, {1, 2} -> 1}, {2, 2}, Symmetric[All]]Det[%]QuantityArray[{{1, 2}, {3, 4}}, {"Meters", "Seconds"}]Det[%]IdentityMatrix always has unit determinant:
Det[IdentityMatrix[22]]Determinant of HilbertMatrix:
HilbertMatrix[9]//DetCompute the determinant of a
matrix of univariate polynomials of degree
:
rpoly[n_] := RandomInteger[{-2 ^ 10, 2 ^ 10}, {n + 1}].x ^ Range[0, n]
SeedRandom[1234];
m = Table[rpoly[100], {10}, {10}];Det[m]//Short//AbsoluteTimingOptions (1)
Modulus (1)
Compute a determinant using arithmetic modulo 47:
m = RandomInteger[46, {100, 100}];Det[m, Modulus -> 47]//AbsoluteTimingThis is faster than computing Mod[Det[m],47]:
Mod[Det[m], 47]//AbsoluteTimingApplications (19)
Area and Volumes (6)
Use Det to find area of a parallelogram spanned by
and
:
v = {1, 4};
w = {-5, 2};Visualize the parallelogram when one vertex is at the origin:
p = Parallelogram[{0, 0}, {v, w}];
Graphics[p, Axes -> True]The area is given by the absolute value of the determinant:
Abs[Det[{v, w}]]Compare with the result given by Area:
Area[p]Use Det to find the volume of a parallelepiped spanned by
,
and
:
{Subscript[v, 1], Subscript[v, 2], Subscript[v, 3]} = {{1, 4, 3}, {-2, -5, 2}, {-1, 2, -2}};Visualize the parallelepiped when one vertex is at the origin:
p = Parallelepiped[{0, 0, 0}, {Subscript[v, 1], Subscript[v, 2], Subscript[v, 3]}];
Graphics3D[p, Axes -> True]The volume is given by the absolute value of the determinant:
Abs[Det[{Subscript[v, 1], Subscript[v, 2], Subscript[v, 3]}]]Compare with a direct computation using Volume:
Volume[p]Use Det to find hypervolume of a hyper-parallelepiped spanned by the following vectors:
{v1, v2, v3, v4} = {{6, -6, -1, 6}, {10, -1, 0, -7}, {3, -2, -9, -3}, {4, 5, 6, -3}}The hypervolume is given by the absolute value of the determinant:
Abs[Det[{v1, v2, v3, v4}]]Compare with the result given by RegionMeasure:
RegionMeasure[Parallelepiped[{0, 0, 0, 0}, {v1, v2, v3, v4}]]The determinant itself is negative, so the
are not right-handed:
Det[{v1, v2, v3, v4}]Simply reorder any two vectors, say the middle two, to produce a right-handed set:
Det[{v1, v3, v2, v4}]Find the area of the image of the unit disk
under the linear transformation associated to the matrix
:
m = {{7, -3}, {5, 7}, {-10, 4}};
m//MatrixFormThe area of the image
is given by
:
πSqrt[Det[Transpose[m].m]]Compare with a direct computation:
f𝔻 = ParametricRegion[ {m.{x, y}, {x, y}∈Disk[]}, {x, y}];
Area[f𝔻]Region[f𝔻, PlotTheme -> "Scientific"]Find the volume factor
in the change of variables formula
between Cartesian and polar coordinates. The mapping from polar to Cartesian coordinates is given by:
polar[r_, θ_] := {r Cos[θ], r Sin[θ]}Compute the Jacobian of the mapping using Grad:
jac = Grad[polar[r, θ], {r, θ}]By the change of variables theorem, the volume is the determinant of the Jacobian:
Simplify[Abs[Det[jac]], r > 0]Compare with the result given by CoordinateChartData:
CoordinateChartData["Polar", "VolumeFactor", {r, θ}]The same procedure will work with any coordinate system, for example, spherical coordinates:
spherical[r_, θ_, φ_] := {r Sin[θ]Cos[φ], r Sin[θ]Sin[φ], r Cos[θ]}
Simplify[Abs[Det[Grad[spherical[r, θ, φ], {r, θ, φ}]]], r > 0 && 0 <= θ <= π]CoordinateChartData["Spherical", "VolumeFactor", {r, θ, φ}]Use the change of variables theorem to compute
, where
is the following region:
𝔻 = ImplicitRegion[x > 0 && y > 0 && 1 <= x^2 - y^2 ≤ 9 && 2 <= x y <= 4, {x, y}];
RegionPlot[𝔻]First, define hyperbolic coordinates
as follows:
hyper[x_, y_] := {x^2 - y^2, x y}The region
clearly corresponds to
and
. By the change of variables formula,
. The gradient is given by:
Grad[hyper[x, y], {x, y}]The determinant of the gradient is twice the function whose integral is
:
Det[%]Hence,
is given by the trivial integral
:
Subsuperscript[∫, 2, 4]Subsuperscript[∫, 1, 9](1/2)ⅆuⅆvCompare with a direct integration over the region:
Subscript[∫, {x, y}∈𝔻](x^2 + y^2)Orientation and Rotations (5)
Determine whether the following basis for
is right-handed:
{b1, b2, b3} = {{1, 0, 1}, {0, 1, 1}, {1, 0, 0}};The determinant of the matrix formed by the basis is negative, so it is not right-handed:
Det[{b1, b2, b3}]Determine if linear transformation corresponding to
is orientation-preserving or orientation-reversing:
m = {{-8, 10, -7, -10}, {2, 6, -7, -9}, {6, 2, 4, -10}, {-7, -4, -3, -10}};As
, the mapping is orientation-preserving:
Det[m]Show that the following matrix is not a rotation matrix:
m = {{0.969655, -0.170187, -0.0303448, -0.170187, -0.0303448}, {0.170187, 0.254483, 0.170187, -0.0455171, 0.170187}, {-0.0303448, -0.170187, 0.969655, -0.170187, -0.0303448}, {0.170187, -0.0455171, 0.170187, 0.954483, 0.170187}, {-0.0303448, -0.170187, -0.0303448, -0.170187, 0.969655}};All rotation matrices have unit determinant; since
, it cannot be a rotation matrix:
Det[m]Show that the matrix
is orthogonal and determine if it is a rotation matrix or includes a reflection:
m = {{-0.969655, -0.170187, -0.0303448, -0.170187, -0.0303448}, {-0.170187, 0.954483, 0.170187, -0.0455171, 0.170187}, {0.0303448, -0.170187, 0.969655, -0.170187, -0.0303448}, {-0.170187, -0.0455171, 0.170187, 0.954483, 0.170187}, {0.0303448, -0.170187, -0.0303448, -0.170187, 0.969655}};Up to the input precision,
, which shows that
is orthogonal:
Chop[Transpose[m].m, 10 ^ -6]//MatrixFormAll orthogonal matrices have
, but rotations have
; as
,
includes a reflection:
Det[m]The generalization of a rotation matrix to complex vector spaces is a special unitary matrix that is unitary and has unit determinant. Show that the following matrix is a special unitary matrix:
u = (1/Sqrt[Cosh[2 Im[α]]])(| | |
| ------------- | ------------- |
| Cosh[Im[α]] | I Sinh[Im[α]] |
| I Sinh[Im[α]] | Cosh[Im[α]] |);The matrix is unitary because
:
ConjugateTranspose[u].u//SimplifyIt also has unit determinant, so it is in fact an element of the special unitary group
:
Det[u]//SimplifyLinear and Abstract Algebra (8)
Determine the values of the parameter
for which the system
,
has a unique solution and describe that solution. First, form the coefficient matrix
and constant vector
:
a = (| | |
| -- | -- |
| 2s | 1 |
| 3s | 6s |);b = (| |
| - |
| 1 |
| 2 |);bThe solutions will be unique as
:
Det[a] != 0Solving over the reals gives three open intervals separated at
and
:
Reduce[%, s, Reals]Since the matrix is invertible for these values of
, the solution is simply
:
Inverse[a].b//SimplifyVerify the solution in the original system of equations:
Simplify[2 s x + y == 1 && 3 s x + 6 s y == 2 /. Thread[{x, y} -> %]]Use Cramer's rule to solve the system of equations
,
,
. First, form the coefficient matrix
and constant vector
:
a = {{6, 9, 0}, {-7, 0, 3}, {0, 5, 9}};
b = {11, -12, -9};
{a//MatrixForm, b//MatrixForm}Form the three matrices
where
replaces the corresponding columns of
:
{dx, dy, dz} = Table[ReplacePart[a, {j_, i} :> b[[j]]], {i, 3}];
{dx//MatrixForm, dy//MatrixForm, dz//MatrixForm}The entries of the solution are given by
:
({Det[dx], Det[dy], Det[dz]}/Det[a])a.% == bWrite a function implementing Cramer's rule for solving a linear system m.x=b:
crule[m_, b_] := Module[{d = Det[m], a},
Table[a = m;a[[All, k]] = b;Det[a] / d, {k, Length[m]}]]Use the function to solve a system for particular values of m and b:
m = {{1, 2, 3}, {1, 4, 9}, {1, 8, 27}};
b = {4, 16, 46};x = crule[m, {4, 16, 46}]m.x == bFor numerical systems, LinearSolve is much faster and more accurate:
n = 500;
m = RandomReal[1, {n, n}];
x = ConstantArray[1, n];
b = m.x;AbsoluteTiming[Norm[crule[m, b] - x]]AbsoluteTiming[Norm[LinearSolve[m, b] - x]]Determine if the matrix
has a nontrivial kernel (null space):
a = {{-10, -7, -7, 8, -1}, {5, 0, 2, 0, -8}, {7, -4, -2, -10, 1}, {-5, 7, 10, 0, 3}, {-8, -5, -4, 1, -2}};Since the determinant is nonzero, the kernel is trivial:
Det[a]Confirm the result using NullSpace:
NullSpace[a]Determine if the mapping corresponding to the matrix
is injective:
a = {{3, 1, 1}, {2, -5, 3}, {1, -11, 5}};Since
, the mapping is not injective:
Det[a]Confirm the result using FunctionInjective:
f[x_, y_, z_] := a.{x, y, z}FunctionInjective[f[x, y, z], {x, y, z}]Since
defines a linear function
, the failure to be injective implies a failure to be surjective:
FunctionSurjective[f[x, y, z], {x, y, z}]Determine if the matrix
defines an automorphism (a bijective linear map):
a = RandomInteger[{-10, 10}, {3, 3}]Since
, the mapping is an automorphism:
Det[a]Confirm the result using FunctionBijective:
f[x_, y_, z_] := a.{x, y, z}FunctionBijective[f[x, y, z], {x, y, z}]Compute the cofactor obtained from removing row i and column j:
cofactor[m_, {i_Integer, j_Integer}] := (-1) ^ (i + j)Det[Drop[m, {i}, {j}]]cofactor[{{1, 2, 3, 4}, {5, 6, 7, 8}, {8, 7, 6, 4}, {5, 3, 2, 1}}, {3, 2}](-1) ^ (3 + 2)Det[{{1, 3, 4}, {5, 7, 8}, {5, 2, 1}}]Modular computation of a determinant:
a = {{12, 13}, {14, 15}};d1 = Det[a, Modulus -> 5]d2 = Det[a, Modulus -> 7]ChineseRemainder[{d1, d2}, {5, 7}]Shift the residue to be symmetric:
Mod[33, 5 7, (-5 7 + 1) / 2]Confirm that the non-modular determinant was recovered:
Det[a]Properties & Relations (15)
The determinant is the product of the eigenvalues:
m = RandomReal[1, {100, 100}];Det[m]Apply[Times, Eigenvalues[m]] Det satisfies
, where
is all
-permutations and
is Signature:
a = {{-4, 8, -5, 6, -3}, {10, 2, -5, -4, 8}, {8, 8, -1, 8, 0}, {-7, -6, -4, -5, 2}, {8, -7, -6, -7, 10}};s5 = Permutations[Range[5]];Det[a] == Underoverscript[∑, σ, s5]Signature[σ]Underoverscript[∏, i, 5]a[[i, σ[[i]]]]The determinant Det[m] is the contraction of m's rows or columns into the Levi–Civita tensor:
m = Array[μ, {3, 3}];
Det[m] === TensorContract[m[[1]]m[[2]]m[[3]]LeviCivitaTensor[3, List], {{1, 4}, {2, 5}, {3, 6}}]Generalize to higher dimensions, using Inactive[TensorProduct] for efficiency:
det[m_] := With[{n = Length[m]},
Activate[TensorContract[Inactive[TensorProduct]@@Append[m, LeviCivitaTensor[n]], Table[{k, k + n}, {k, n}]]]];m = Array[μ, {6, 6}];
Det[m] == det[m]//SimplifyDet can be computed recursively via cofactor expansion along any row:
m = RandomReal[1, {5, 5}];
Block[{n = Length[m], i = RandomInteger[{1, Length[m]}]},
Sum[(-1)^i + km[[i, k]]Det[Drop[m, {i}, {k}]], {k, n}] == Det[m]]Block[{n = Length[m], j = RandomInteger[{1, Length[m]}]},
Sum[(-1)^j + km[[k, j]]Det[Drop[m, {k}, {j}]], {k, n}] == Det[m]]The determinant is the signed volume of the parallelepiped generated by its rows:
m = {{1, 2, 3}, {-1, 1, 0}, {3, 2, 1}};Det[m]This equals the volume up to sign:
Volume[Parallelepiped[{0, 0, 0}, m]]A square matrix has an inverse if and only if its determinant is nonzero:
m = {{1, 2, 1}, {1, 0, 2}, {-1, 2, -3}};Det[m]Inverse[m]The determinant of a triangular matrix is the product of its diagonal elements:
MatrixForm[m = SparseArray[{i_, j_} /; i ≥ j :> RandomReal[], {5, 5}]]Det[m]Apply[Times, Diagonal[m]]The determinant of a matrix product is the product of the determinants:
{a, b} = RandomReal[1, {2, 100, 100}];Det[a.b]Det[a]Det[b]The determinant of the inverse is the reciprocal of the determinant:
m = (| | | |
| :---- | :---- | :---- |
| a1, 1 | a1, 2 | a1, 3 |
| a2, 1 | a2, 2 | a2, 3 |
| a3, 1 | a3, 2 | a3, 3 |);Det[Inverse[m]]//Simplify1 / Det[m]%% == %//SimplifyA matrix and its transpose have equal determinants:
m = RandomReal[1, {5, 5}];
Det[m] == Det[Transpose[m]]The determinant of the matrix exponential is the exponential of the trace:
m = RandomReal[1, {10, 10}, WorkingPrecision -> $MachinePrecision];Det[MatrixExp[m]] == Exp[Tr[m]]CharacteristicPolynomial[m] is equal to
:
m = RandomInteger[9, {3, 3}];Det[m - λ IdentityMatrix[3]]CharacteristicPolynomial[m, λ]Det[m] can be computed from LUDecomposition[m]:
m = RandomInteger[9, {5, 5}];
{l, u, p, c} = LUDecomposition[m];
Det[m] == Signature[p["PermutationList"]]Times@@Diagonal[u]Consider two rectangular matrices
and
such that
and
are both square:
a = RandomReal[1, {5, 3}];b = RandomReal[1, {3, 5}];Sylvester's determinant theorem states that
, where
is the matching identity matrix:
Det[IdentityMatrix[5] + a.b] == Det[IdentityMatrix[3] + b.a]If a matrix
is the TensorProduct of two vectors
and
, then
:
{u, v} = RandomReal[1, {2, 5}];Det[IdentityMatrix[5] + uv] == 1 + u.vThis can be expressed equally in terms of KroneckerProduct:
Det[IdentityMatrix[5] + KroneckerProduct[u, v]] == 1 + u.vThis follows from Sylvester's determinant theorem for the corresponding row and column matrices:
c = List /@ u;r = {v};{Det[IdentityMatrix[5] + c.r] == Det[IdentityMatrix[1] + r.c], r.c == {{u.v}}}Neat Examples (1)
Determinants of tridiagonal matrices:
tridiagonal[n_] := SparseArray[{Band[{2, 1}] -> a, Band[{1, 1}] -> b, Band[{1, 2}] -> c}, {n, n}]tridiagonal[5]//MatrixFormTable[Det[tridiagonal[n]], {n, 2, 12}]//TableFormA closed-form formula for these determinants is given by
:
% == Table[(a c) ^ (n / 2) ChebyshevU[n, b / (2 Sqrt[a c])]//Simplify, {n, 2, 12}]Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 2022 (13.2) ▪ 2024 (14.0)
Text
Wolfram Research (1988), Det, Wolfram Language function, https://reference.wolfram.com/language/ref/Det.html (updated 2024).
CMS
Wolfram Language. 1988. "Det." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Det.html.
APA
Wolfram Language. (1988). Det. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Det.html
BibTeX
@misc{reference.wolfram_2026_det, author="Wolfram Research", title="{Det}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Det.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_det, organization={Wolfram Research}, title={Det}, year={2024}, url={https://reference.wolfram.com/language/ref/Det.html}, note=[Accessed: 13-June-2026]}