# 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 all## Basic Examples (2)

## 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 :

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 :

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 :

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 , meaning is purely real:

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

Thus, , 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, , meaning is purely real:

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

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

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

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

For this particular matrix, both and achieve positive values:

### 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:

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 , 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 achieves both positive and negative values:

Note that this does not necessarily mean that 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:

An indefinite matrix is neither positive semidefinite nor negative semidefinite:

## 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:

#### 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