# PositiveSemidefiniteMatrixQ

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 all

## Basic Examples(1)

Test if a matrix is explicitly positive semidefinite:

This means that the quadratic form for all vectors :

## Scope(6)

A real matrix:

A complex matrix:

A sparse matrix:

An approximate MachinePrecision real matrix:

An approximate MachinePrecision complex matrix:

An approximate arbitrary-precision matrix:

A matrix with exact numeric entries:

A matrix with symbolic entries:

The test returns False unless it is true for all possible complex values of symbolic parameters:

## 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(4)

Find the level sets for a quadratic form for a positive semidefinite matrix:

In 2D, the level sets are straight lines:

In 3D, the level sets are elliptical cylinders or planes:

A real singular Covariance matrix is symmetric and positive semidefinite:

Tolerance is used to set to zero roundoff errors in computed eigenvalues:

A complex singular Covariance matrix is Hermitian and positive semidefinite:

Tolerance is used to set to zero roundoff errors in eigenvalues:

A Gram matrix is a symmetric matrix of dot products of vectors:

This Gram matrix is not positive definite:

But a Gram matrix is always positive semidefinite:

## Properties & Relations(11)

A symmetric matrix is positive semidefinite if and only if its eigenvalues are non-negative:

The condition Re[Conjugate[x].m.x]0 is satisfied:

The eigenvalues of are all non-negative:

A Hermitian matrix is positive semidefinite if and only if its eigenvalues are all non-negative:

The condition Re[Conjugate[x].m.x]0 is satisfied:

The eigenvalues of are all non-negative:

A real matrix is positive semidefinite if its symmetric part, , is positive semidefinite:

The symmetric part has non-negative eigenvalues:

Note that this does not mean that the eigenvalues of are necessarily non-negative:

A complex is positive semidefinite if the Hermitian part, , is positive semidefinite:

The Hermitian part has non-negative eigenvalues:

Note that this does not mean that the eigenvalues of are necessarily non-negative:

A diagonal matrix is positive semidefinite if the diagonal elements are non-negative:

The determinant and trace of a symmetric positive semidefinite matrix are non-negative:

The determinant and trace of a Hermitian positive semidefinite matrix are non-negative:

A symmetric positive semidefinite matrix m has a uniquely defined square root b such that m=b.b:

The square root b is positive semidefinite and symmetric:

A Hermitian positive semidefinite matrix m has a uniquely defined square root b such that m=b.b:

The square root b is positive semidefinite and Hermitian:

The Kronecker product of two symmetric positive semidefinite matrices is symmetric and positive semidefinite:

A positive semidefinite real matrix has the general form m.d.m+a, with a diagonal positive semidefinite d:

m is a square matrix:

a is an antisymmetric matrix:

## Possible Issues(2)

CholeskyDecomposition does not work with symmetric or Hermitian positive semidefinite matrices that are singular: The function returns False for symbolic matrices having non-numeric eigenvalues that cannot be determined as non-negative:

It is not possible to determine if the eigenvalues of m are non-negative: