IndefiniteMatrixQ
✖
IndefiniteMatrixQ
Details and Options

- A matrix m is indefinite if Re[Conjugate[x].m.x] achieves both positive and negative values.
- IndefiniteMatrixQ works for symbolic as well as numerical matrices.
- For approximate matrices, the option Tolerance->t can be used to indicate that all eigenvalues λ satisfying λ≤t λmax are taken to be zero where λmax is an eigenvalue largest in magnitude.
- The option Tolerance has Automatic as its default value.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Test if a matrix is explicitly indefinite:

https://wolfram.com/xid/0btnu1b32bwj-c31f7e

https://wolfram.com/xid/0btnu1b32bwj-e0jun2

The quadratic form has positive and negative values for different vectors
:

https://wolfram.com/xid/0btnu1b32bwj-uu2a3

Test if a 3×3 Hermitian matrix is indefinite:

https://wolfram.com/xid/0btnu1b32bwj-wvw84j

Scope (10)Survey of the scope of standard use cases
Basic Uses (6)
Test if a real machine-precision matrix is explicitly indefinite:

https://wolfram.com/xid/0btnu1b32bwj-u5nvc8

Test if a complex matrix is indefinite:

https://wolfram.com/xid/0btnu1b32bwj-gh9car

Test if an exact matrix is indefinite:

https://wolfram.com/xid/0btnu1b32bwj-18kovk

Use IndefiniteMatrixQ with an arbitrary-precision matrix:

https://wolfram.com/xid/0btnu1b32bwj-h89ze5

A random matrix is typically indefinite:

https://wolfram.com/xid/0btnu1b32bwj-e792ql

Use IndefiniteMatrixQ with a symbolic matrix:

https://wolfram.com/xid/0btnu1b32bwj-zevp93

The matrix becomes indefinite when :

https://wolfram.com/xid/0btnu1b32bwj-fpkx6f

IndefiniteMatrixQ works efficiently with large numerical matrices:

https://wolfram.com/xid/0btnu1b32bwj-bjhh1d

https://wolfram.com/xid/0btnu1b32bwj-n2hz99


https://wolfram.com/xid/0btnu1b32bwj-pcc5uf

Special Matrices (4)
Use IndefiniteMatrixQ with sparse matrices:

https://wolfram.com/xid/0btnu1b32bwj-c1kclu


https://wolfram.com/xid/0btnu1b32bwj-dkghyq

Use IndefiniteMatrixQ with structured matrices:

https://wolfram.com/xid/0btnu1b32bwj-f39gxg


https://wolfram.com/xid/0btnu1b32bwj-c0k3bb

The identity matrix is not indefinite:

https://wolfram.com/xid/0btnu1b32bwj-kkhgb9

HilbertMatrix is not indefinite:

https://wolfram.com/xid/0btnu1b32bwj-ou7ra

Options (1)Common values & functionality for each option
Tolerance (1)
Generate a real-valued diagonal matrix with some random perturbation of order :

https://wolfram.com/xid/0btnu1b32bwj-35lu76

If the element of order is a roundoff error, then the matrix is incorrectly considered as indefinite:

https://wolfram.com/xid/0btnu1b32bwj-mrsvrl

Adjust the option Tolerance to give a correct answer:

https://wolfram.com/xid/0btnu1b32bwj-cbjh4n

Applications (16)Sample problems that can be solved with this function
The Geometry and Algebra of Positive Semidefinite Matrices (6)
Consider a real indefinite 2×2 matrix and its associated real quadratic :

https://wolfram.com/xid/0btnu1b32bwj-4qdqkt


https://wolfram.com/xid/0btnu1b32bwj-cwuc79
Because is indefinite, the level sets are hyperbolas:

https://wolfram.com/xid/0btnu1b32bwj-psoigb

The contour corresponding to zero gives the shared asymptotes of the hyperbolas:

https://wolfram.com/xid/0btnu1b32bwj-yo1srg

The plot of will be a saddle-shaped hyperbolic paraboloid that has both positive and negative values:

https://wolfram.com/xid/0btnu1b32bwj-d843tc

For a real, indefinite matrix, the level sets are
-hyperboloids:

https://wolfram.com/xid/0btnu1b32bwj-4k07zj

Typically, the level sets will include both one-sheeted and two-sheeted hyperboloids:

https://wolfram.com/xid/0btnu1b32bwj-bbv41l

https://wolfram.com/xid/0btnu1b32bwj-xg46fi

The two types of hyperboloids are separated by the asymptotic double cone at :

https://wolfram.com/xid/0btnu1b32bwj-qzkid

In three dimensions, these can degenerate into cylinders over hyperbolas:

https://wolfram.com/xid/0btnu1b32bwj-kkyuyx


https://wolfram.com/xid/0btnu1b32bwj-m0es35

A Hermitian matrix defines a real-valued quadratic form by :

https://wolfram.com/xid/0btnu1b32bwj-b1o4wi

If is indefinite,
achieves both positive and negative values:

https://wolfram.com/xid/0btnu1b32bwj-7b0a2q

Visualize for real-valued inputs:

https://wolfram.com/xid/0btnu1b32bwj-iznf0y

For a real-valued matrix , only the symmetric part determines whether
is indefinite. Write
with
symmetric and
antisymmetric:

https://wolfram.com/xid/0btnu1b32bwj-pextao


https://wolfram.com/xid/0btnu1b32bwj-4lefur


https://wolfram.com/xid/0btnu1b32bwj-w8i23t

As is real and symmetric
, meaning
is purely real:

https://wolfram.com/xid/0btnu1b32bwj-pz7f27

Similarly, as is real and antisymmetric
, or
is pure imaginary:

https://wolfram.com/xid/0btnu1b32bwj-b4fz3d

Thus, , so
is indefinite if and only if
is:

https://wolfram.com/xid/0btnu1b32bwj-ezj37z

For a complex-valued matrix , only the Hermitian part determines whether
is indefinite. Write
with
Hermitian and
antihermitian:

https://wolfram.com/xid/0btnu1b32bwj-6c2p1w


https://wolfram.com/xid/0btnu1b32bwj-dt5ung


https://wolfram.com/xid/0btnu1b32bwj-kk7abf

As is Hermitian,
, meaning
is purely real:

https://wolfram.com/xid/0btnu1b32bwj-cyeors

Similarly, as is antihermitian,
, or
is pure imaginary:

https://wolfram.com/xid/0btnu1b32bwj-tuq2n3

Thus, , so
is indefinite if and only if
is:

https://wolfram.com/xid/0btnu1b32bwj-wynbjl

By definition, a matrix is indefinite if
achieves both positive and negative values:

https://wolfram.com/xid/0btnu1b32bwj-7egopo


https://wolfram.com/xid/0btnu1b32bwj-in0bz

Note that this does not necessarily mean that achieves both signs:

https://wolfram.com/xid/0btnu1b32bwj-ni65az

For this particular matrix, both and
achieve positive values:

https://wolfram.com/xid/0btnu1b32bwj-h047zb


https://wolfram.com/xid/0btnu1b32bwj-h1vbuw

But only achieves a negative value:

https://wolfram.com/xid/0btnu1b32bwj-pojw92


https://wolfram.com/xid/0btnu1b32bwj-hxed6c

Sources of Indefinite Matrices (6)
The Pauli matrices are indefinite:

https://wolfram.com/xid/0btnu1b32bwj-3rbtl0

FourierMatrix[k] is indefinite for :

https://wolfram.com/xid/0btnu1b32bwj-0ljkn5

ToeplitzMatrix[k] is indefinite for :

https://wolfram.com/xid/0btnu1b32bwj-rh1cfh

The Redheffer matrix is a 0-1 indefinite matrix:

https://wolfram.com/xid/0btnu1b32bwj-p6ud7


https://wolfram.com/xid/0btnu1b32bwj-zxwevl


https://wolfram.com/xid/0btnu1b32bwj-p8v3ye

Many filter kernel matrices are indefinite, including CrossMatrix[k]:

https://wolfram.com/xid/0btnu1b32bwj-oiuzxi

DiamondMatrix[k]:

https://wolfram.com/xid/0btnu1b32bwj-sv4lmu

And DiskMatrix[k] for :

https://wolfram.com/xid/0btnu1b32bwj-m8pana

DiskMatrix[1] is positive semidefinite:

https://wolfram.com/xid/0btnu1b32bwj-bwit30

Randomly generated matrices tend to be indefinite, with the probability of the matrix being indefinite rapidly increasing as the dimensions of the matrix increase. The following inputs estimate the probability of a matrix being indefinite for matrices from
to
. First, matrices whose entries are independently and uniformly drawn from the interval
:

https://wolfram.com/xid/0btnu1b32bwj-7eu8bz

Matrices drawn from GaussianOrthogonalMatrixDistribution:

https://wolfram.com/xid/0btnu1b32bwj-usbva5

Matrices drawn from GaussianUnitaryMatrixDistribution:

https://wolfram.com/xid/0btnu1b32bwj-y6bbrn

Matrices drawn from CircularRealMatrixDistribution:

https://wolfram.com/xid/0btnu1b32bwj-ba5ndi

Uses of Indefinite Matrices (4)
The second derivative test classifies critical points of a function as local minima if the Hessian is positive definite, local maxima if the Hessian is negative definite and saddle points if the Hessian is indefinite (the test fails if the Hessian is not one of these three types). Find the critical points of a function of two variables:

https://wolfram.com/xid/0btnu1b32bwj-wle784

https://wolfram.com/xid/0btnu1b32bwj-wvt8fp


https://wolfram.com/xid/0btnu1b32bwj-6rwfnq


https://wolfram.com/xid/0btnu1b32bwj-xcrwo4

The last of the three critical points is a saddle point:

https://wolfram.com/xid/0btnu1b32bwj-lr5do9

The first two points are local minima:

https://wolfram.com/xid/0btnu1b32bwj-eqxtcj

Visualize the function. The red and blue points are minima and the green point is a saddle point:

https://wolfram.com/xid/0btnu1b32bwj-k30p10

Find the critical points of a function of three variables:

https://wolfram.com/xid/0btnu1b32bwj-p1xcnq

https://wolfram.com/xid/0btnu1b32bwj-eb6t8y


https://wolfram.com/xid/0btnu1b32bwj-laj3fd

Compute the Hessian matrix of f:

https://wolfram.com/xid/0btnu1b32bwj-8a4jyc

The first two critical points are local minima:

https://wolfram.com/xid/0btnu1b32bwj-i4p7qs

The last three are saddle points:

https://wolfram.com/xid/0btnu1b32bwj-c7f2tz

For this function, any three of the critical points are linearly dependent, so they all lie in a single plane:

https://wolfram.com/xid/0btnu1b32bwj-ebjwkm

Compute the normal to that plane:

https://wolfram.com/xid/0btnu1b32bwj-pul5ff

Visualize the function, with the minima green and the non-extreme critical points red:

https://wolfram.com/xid/0btnu1b32bwj-o4ybe5

Roughly half of three-dimensional rotation matrices are indefinite. This can be understood as vectors parallel to the axis of rotation being unchanged by the rotation, and vectors perpendicular to the axis being rotated by more than . For the former
, and for the latter
. First, generate
random rotation matrices:

https://wolfram.com/xid/0btnu1b32bwj-kw2xgm
Roughly half are indeed indefinite:

https://wolfram.com/xid/0btnu1b32bwj-7w2gx5

Compute the Schur decomposition of one randomly selected indefinite matrix:

https://wolfram.com/xid/0btnu1b32bwj-qzryge
The matrix defines a basis in which
is represented by
:

https://wolfram.com/xid/0btnu1b32bwj-k6zzc5

The action of on the standard unit vectors leaves one unchanged and rotates the others by more than
:

https://wolfram.com/xid/0btnu1b32bwj-3kf18y

A spacetime or pseudo-Riemannian metric is an invertible, real symmetric, indefinite matrix that becomes positive definite when restricted some three-dimensional subspace. It gives a notion of squared distance between events in spacetime via its associated quadratic form. Show that the standard or Minkowski metric is a spacetime metric:

https://wolfram.com/xid/0btnu1b32bwj-vkuwqd

https://wolfram.com/xid/0btnu1b32bwj-k13vtr

The restriction of to the second through fourth standard basis elements is positive definite:

https://wolfram.com/xid/0btnu1b32bwj-d0hr69

The event is separated from the origin by a positive squared distance, known as spacelike separation:

https://wolfram.com/xid/0btnu1b32bwj-51dze

Thus, the events are simultaneous in some reference frame, and the distance in that frame is:

https://wolfram.com/xid/0btnu1b32bwj-sys0jg

The event is separated from the origin by a negative squared distance, known as timelike separation:

https://wolfram.com/xid/0btnu1b32bwj-e8lwuu

They occur at the same point in some reference frame, one being the proper time after the other:

https://wolfram.com/xid/0btnu1b32bwj-m0tbnf

The event has zero squared distance, or lightlike separation, from the origin. Only light can reach both events:

https://wolfram.com/xid/0btnu1b32bwj-gtyqy3

Properties & Relations (9)Properties of the function, and connections to other functions
IndefiniteMatrixQ[x] trivially returns False for any x that is not a matrix:

https://wolfram.com/xid/0btnu1b32bwj-dqapjm

A matrix is indefinite if
achieves both positive and negative values:

https://wolfram.com/xid/0btnu1b32bwj-gmli2h


https://wolfram.com/xid/0btnu1b32bwj-mta52e

Note that this does not necessarily mean that achieves both signs:

https://wolfram.com/xid/0btnu1b32bwj-rq8dbj

A real matrix is indefinite if and only if its symmetric part is indefinite:

https://wolfram.com/xid/0btnu1b32bwj-bj1smo

https://wolfram.com/xid/0btnu1b32bwj-rbyn3v

In general, a matrix is indefinite if and only if its Hermitian part is indefinite:

https://wolfram.com/xid/0btnu1b32bwj-oquzfm

https://wolfram.com/xid/0btnu1b32bwj-tlzru9

A real symmetric matrix is indefinite if and only if it has both positive and negative eigenvalues:

https://wolfram.com/xid/0btnu1b32bwj-0yr0n2


https://wolfram.com/xid/0btnu1b32bwj-w5llvz

This statement is true of Hermitian matrices more generally:

https://wolfram.com/xid/0btnu1b32bwj-q988y6


https://wolfram.com/xid/0btnu1b32bwj-qbbydn

A general matrix can be indefinite without having eigenvalues of both signs:

https://wolfram.com/xid/0btnu1b32bwj-4npekz


https://wolfram.com/xid/0btnu1b32bwj-gyknno

While both eigenvalues are positive, there are non-eigenvectors that make the quadratic form negative:

https://wolfram.com/xid/0btnu1b32bwj-36tgn8

A diagonal matrix is indefinite if and only if diagonal elements have both positive and negative real parts:

https://wolfram.com/xid/0btnu1b32bwj-eokl6o


https://wolfram.com/xid/0btnu1b32bwj-hwyvpg

An indefinite matrix has the general form , with a diagonal indefinite
:

https://wolfram.com/xid/0btnu1b32bwj-18kcz9

Split into its Hermitian and antihermitian parts:

https://wolfram.com/xid/0btnu1b32bwj-gbg565

https://wolfram.com/xid/0btnu1b32bwj-hypszb
By the spectral theorem, can be unitarily diagonalized using JordanDecomposition:

https://wolfram.com/xid/0btnu1b32bwj-kxey6a
The matrix is diagonal with positive and negative diagonal entries:

https://wolfram.com/xid/0btnu1b32bwj-86zpfk


https://wolfram.com/xid/0btnu1b32bwj-354tyu


https://wolfram.com/xid/0btnu1b32bwj-thgk4f

An indefinite matrix is neither positive semidefinite nor negative semidefinite:

https://wolfram.com/xid/0btnu1b32bwj-8yyijr

A matrix is indefinite if and only if
is also indefinite:

https://wolfram.com/xid/0btnu1b32bwj-d4t288

https://wolfram.com/xid/0btnu1b32bwj-ln3hz2

Possible Issues (1)Common pitfalls and unexpected behavior
IndefiniteMatrixQ gives False unless it can prove a symbolic matrix is indefinite:

https://wolfram.com/xid/0btnu1b32bwj-bjidka

Using a combination of Eigenvalues and Reduce can give more precise results:

https://wolfram.com/xid/0btnu1b32bwj-gixlky


https://wolfram.com/xid/0btnu1b32bwj-n8xyss

Wolfram Research (2014), IndefiniteMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html.
Text
Wolfram Research (2014), IndefiniteMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html.
Wolfram Research (2014), IndefiniteMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html.
CMS
Wolfram Language. 2014. "IndefiniteMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html.
Wolfram Language. 2014. "IndefiniteMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html.
APA
Wolfram Language. (2014). IndefiniteMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html
Wolfram Language. (2014). IndefiniteMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html
BibTeX
@misc{reference.wolfram_2025_indefinitematrixq, author="Wolfram Research", title="{IndefiniteMatrixQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html}", note=[Accessed: 03-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_indefinitematrixq, organization={Wolfram Research}, title={IndefiniteMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html}, note=[Accessed: 03-May-2025
]}