PositiveSemidefiniteMatrixQ
PositiveSemidefiniteMatrixQ[m]
gives True if m is explicitly positive semidefinite, and False otherwise.
Details and Options

- A matrix m is positive semidefinite if Re[Conjugate[x].m.x]≥0 for all vectors x. »
- PositiveSemidefiniteMatrixQ 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)
Scope (10)
Basic Uses (6)
Test if a real machine-precision matrix is explicitly positive semidefinite:
Test if a complex matrix is positive semidefinite:
Test if an exact matrix is positive semidefinite:
Use PositiveSemidefiniteMatrixQ with an arbitrary-precision matrix:
A random matrix is typically not positive semidefinite:
Use PositiveSemidefiniteMatrixQ with a symbolic matrix:
The matrix becomes positive semidefinite when :
PositiveSemidefiniteMatrixQ works efficiently with large numerical matrices:
Special Matrices (4)
Use PositiveSemidefiniteMatrixQ with sparse matrices:
Use PositiveSemidefiniteMatrixQ with structured matrices:
The identity matrix is positive semidefinite:
HilbertMatrix is positive semidefinite:
Options (1)
Tolerance (1)
Generate a real-valued diagonal matrix with some random perturbation of order 10-12:
Adjust the option Tolerance to accept matrices as positive semidefinite:
Applications (13)
The Geometry and Algebra of Positive Semidefinite Matrices (5)
Consider a real, positive semidefinite 2×2 matrix and its associated real quadratic :
Because is positive definite, the level sets are ellipses:
The plot of will be an upward-facing elliptic paraboloid:
However, the ellipses can be degenerate, turning into lines:
The plot of is then a cylinder over a parabola:
In an even more extreme case, the level set can be the whole plane as :
For a real, positive semidefinite matrix, the level sets are
-ellipsoids:
In three dimensions, these can degenerate into cylinders over ellipses:
A Hermitian matrix defines a real-valued quadratic form by :
If is positive semidefinite,
is non-negative for all inputs:
Visualize for real-valued inputs:
For a real-valued matrix , only the symmetric part determines whether
is positive semidefinite. 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 positive semidefinite if and only if
is:
For a complex-valued matrix , only the Hermitian part determines whether
is positive semidefinite. Write
with
Hermitian and
antihermitian:
As is Hermitian,
, meaning
is purely real:
Sources of Positive Definite Matrices (8)
A real Covariance matrix is always symmetric and positive semidefinite:
Compute SingularValueDecomposition[m] for a square matrix :
The matrix is positive semidefinite:
A Gram matrix is a symmetric matrix of dot products of
vectors:
A Gram matrix is always positive semidefinite:
Matrices drawn from WishartMatrixDistribution are real, symmetric and positive semidefinite:
The squares of Hermitian matrices are positive semidefinite:
Every antihermitian matrix is positive semidefinite:
The Lehmer matrix is symmetric positive semidefinite:
Its inverse is tridiagonal, which is also symmetric positive semidefinite:
The matrix Min[i,j] is always symmetric positive semidefinite:
Its inverse is a tridiagonal matrix, which is also symmetric positive semidefinite:
Properties & Relations (13)
PositiveSemidefiniteMatrixQ[x] trivially returns False for any x that is not a matrix:
A matrix is positive semidefinite if
for all vectors
:
A real matrix is positive semidefinite if and only if its symmetric part is positive semidefinite:
In general, a matrix is positive semidefinite if and only if its Hermitian part is positive semidefinite:
A real symmetric matrix is positive semidefinite if and only if its eigenvalues are all non-negative:
The statement is true of Hermitian matrices more generally:
A general matrix can have all non-negative eigenvalues without being positive semidefinite:
Equally, a matrix can be positive semidefinite without having non-negative eigenvalues:
The failure is due to the eigenvalues being complex:
The real part of the eigenvalues of a positive semidefinite matrix must be non-negative:
A diagonal matrix is positive semidefinite if and only if diagonal elements have non-negative real parts:
A positive semidefinite matrix has the general form with a diagonal positive semidefinite
:
Split into its Hermitian and antihermitian parts:
By the spectral theorem, can be unitarily diagonalized using JordanDecomposition:
The matrix is diagonal with non-negative diagonal entries:
A matrix is positive semidefinite if and only if
is negative semidefinite:
A positive definite matrix is always positive semidefinite:
There are positive semidefinite matrices that are not positive definite:
A positive semidefinite matrix cannot be indefinite or negative semidefinite:
The determinant and trace of a real, symmetric, positive semidefinite matrix are non-negative:
This is also true of positive semidefinite Hermitian matrices:
A real symmetric positive semidefinite matrix has a uniquely defined square root
such that
:
The square root is positive semidefinite and real symmetric:
A Hermitian positive semidefinite matrix has a uniquely defined square root
such that
:
The square root is positive semidefinite and Hermitian:
The Kronecker product of two symmetric positive semidefinite matrices is symmetric and positive semidefinite:
Replacing one matrix in the product by a negative semidefinite one gives a negative semidefinite matrix:
Possible Issues (2)
CholeskyDecomposition does not work with symmetric or Hermitian positive semidefinite matrices that are singular:

PositiveSemidefiniteMatrixQ gives False unless it can prove a symbolic matrix is positive semidefinite:
Using a combination of Eigenvalues and Reduce can give more precise results:
Text
Wolfram Research (2014), PositiveSemidefiniteMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PositiveSemidefiniteMatrixQ.html.
CMS
Wolfram Language. 2014. "PositiveSemidefiniteMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PositiveSemidefiniteMatrixQ.html.
APA
Wolfram Language. (2014). PositiveSemidefiniteMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PositiveSemidefiniteMatrixQ.html