IndefiniteMatrixQ

IndefiniteMatrixQ[m]

gives True if m is explicitly indefinite, and False otherwise.

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 all

Basic Examples  (2)

Test if a matrix is explicitly indefinite:

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

Test if a 3×3 Hermitian matrix is indefinite:

Scope  (10)

Basic Uses  (6)

Test if a real machine-precision matrix is explicitly indefinite:

Test if a complex matrix is indefinite:

Test if an exact matrix is indefinite:

Use IndefiniteMatrixQ with an arbitrary-precision matrix:

A random matrix is typically indefinite:

Use IndefiniteMatrixQ with a symbolic matrix:

The matrix becomes indefinite when b=-TemplateBox[{a}, Conjugate]:

IndefiniteMatrixQ works efficiently with large numerical matrices:

Special Matrices  (4)

Use IndefiniteMatrixQ with sparse matrices:

Use IndefiniteMatrixQ with structured matrices:

The identity matrix is not indefinite:

HilbertMatrix is not indefinite:

Options  (1)

Tolerance  (1)

Generate a real-valued diagonal matrix with some random perturbation of order :

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

Adjust the option Tolerance to give a correct answer:

Applications  (16)

The Geometry and Algebra of Positive Semidefinite Matrices  (6)

Consider a real indefinite 2×2 matrix and its associated real quadratic q=TemplateBox[{x}, Transpose].m.x:

Because is indefinite, the level sets are hyperbolas:

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

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

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

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

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

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

A Hermitian matrix defines a real-valued quadratic form by q=TemplateBox[{x}, ConjugateTranspose].m.x:

If is indefinite, achieves both positive and negative values:

Visualize for real-valued inputs:

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

As is real and symmetric TemplateBox[{{(, {TemplateBox[{x}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], ., s, ., x}, )}}, Conjugate]=TemplateBox[{{(, {TemplateBox[{x}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], ., s, ., x}, )}}, ConjugateTranspose]=TemplateBox[{x}, ConjugateTranspose].TemplateBox[{s}, ConjugateTranspose].TemplateBox[{{(, TemplateBox[{x}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], )}}, ConjugateTranspose]=TemplateBox[{x}, ConjugateTranspose].s.x, meaning TemplateBox[{x}, ConjugateTranspose].s.x is purely real:

Similarly, as is real and antisymmetric TemplateBox[{{(, {TemplateBox[{x}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], ., a, ., x}, )}}, Conjugate]=-TemplateBox[{x}, ConjugateTranspose].a.x, or TemplateBox[{x}, ConjugateTranspose].a.x is pure imaginary:

Thus, Re(TemplateBox[{x}, ConjugateTranspose].m.x)=TemplateBox[{x}, ConjugateTranspose].s.x, so is indefinite if and only if is:

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

As is Hermitian, TemplateBox[{{(, {TemplateBox[{x}, ConjugateTranspose], ., h, ., x}, )}}, Conjugate]=TemplateBox[{{(, {TemplateBox[{x}, ConjugateTranspose], ., h, ., x}, )}}, ConjugateTranspose]=TemplateBox[{x}, ConjugateTranspose].TemplateBox[{h}, ConjugateTranspose].TemplateBox[{{(, TemplateBox[{x}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], )}}, ConjugateTranspose]=TemplateBox[{x}, ConjugateTranspose].h.x, meaning TemplateBox[{x}, ConjugateTranspose].h.x is purely real:

Similarly, as is antihermitian, TemplateBox[{{(, {TemplateBox[{x}, ConjugateTranspose, SyntaxForm -> SuperscriptBox], ., a, ., x}, )}}, Conjugate]=-TemplateBox[{x}, ConjugateTranspose].a.x, or TemplateBox[{x}, ConjugateTranspose].a.x is pure imaginary:

Thus, Re(TemplateBox[{x}, ConjugateTranspose].m.x)=TemplateBox[{x}, ConjugateTranspose].h.x, so is indefinite if and only if is:

By definition, a matrix is indefinite if Re(TemplateBox[{x}, ConjugateTranspose].m.x) achieves both positive and negative values:

Note that this does not necessarily mean that TemplateBox[{x}, ConjugateTranspose].m.x achieves both signs:

For this particular matrix, both Re(TemplateBox[{x}, ConjugateTranspose].m.x) and TemplateBox[{x}, ConjugateTranspose].m.x achieve positive values:

But only Re(TemplateBox[{x}, ConjugateTranspose].m.x) achieves a negative value:

Sources of Indefinite Matrices  (6)

The Pauli matrices are indefinite:

FourierMatrix[k] is indefinite for :

ToeplitzMatrix[k] is indefinite for :

The Redheffer matrix is a 0-1 indefinite matrix:

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

DiamondMatrix[k]:

And DiskMatrix[k] for :

DiskMatrix[1] is positive semidefinite:

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 :

Matrices drawn from GaussianOrthogonalMatrixDistribution:

Matrices drawn from GaussianUnitaryMatrixDistribution:

Matrices drawn from CircularRealMatrixDistribution:

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:

Compute the Hessian matrix :

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

The first two points are local minima:

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

Find the critical points of a function of three variables:

Compute the Hessian matrix of f:

The first two critical points are local minima:

The last three are saddle points:

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

Compute the normal to that plane:

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

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 x.r.x=TemplateBox[{x}, Norm]^2>0, and for the latter . First, generate random rotation matrices:

Roughly half are indeed indefinite:

Compute the Schur decomposition of one randomly selected indefinite matrix:

The matrix defines a basis in which is represented by :

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

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:

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

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

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

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

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

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

Properties & Relations  (9)

IndefiniteMatrixQ[x] trivially returns False for any x that is not a matrix:

A matrix is indefinite if Re(TemplateBox[{x}, ConjugateTranspose].m.x) achieves both positive and negative values:

Note that this does not necessarily mean that TemplateBox[{x}, ConjugateTranspose].m.x achieves both signs:

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

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

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

This statement is true of Hermitian matrices more generally:

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

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

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

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

Split into its Hermitian and antihermitian parts:

By the spectral theorem, can be unitarily diagonalized using JordanDecomposition:

The matrix is diagonal with positive and negative diagonal entries:

The matrix is unitary:

Verify that m=u.d.TemplateBox[{u}, ConjugateTranspose]+a:

An indefinite matrix is neither positive semidefinite nor negative semidefinite:

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

Possible Issues  (1)

IndefiniteMatrixQ gives False unless it can prove a symbolic matrix is indefinite:

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

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.

CMS

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

BibTeX

@misc{reference.wolfram_2024_indefinitematrixq, author="Wolfram Research", title="{IndefiniteMatrixQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_indefinitematrixq, organization={Wolfram Research}, title={IndefiniteMatrixQ}, year={2014}, url={https://reference.wolfram.com/language/ref/IndefiniteMatrixQ.html}, note=[Accessed: 22-December-2024 ]}