PositiveDefiniteMatrixQ

PositiveDefiniteMatrixQ[m]

gives True if m is explicitly positive definite, and False otherwise.

Details

Examples

open allclose all

Basic Examples  (2)

Test if a 2×2 real matrix is explicitly positive definite:

This means that the quadratic form for all vectors :

Visualize the values of the quadratic form:

Test if a 3×3 Hermitian matrix is positive definite:

Scope  (10)

Basic Uses  (6)

Test if a real machine-precision matrix is explicitly positive definite:

Test if a complex matrix is positive definite:

Test if an exact matrix is positive definite:

Use PositiveDefiniteMatrixQ with an arbitrary-precision matrix:

A random matrix is typically not positive definite:

Use PositiveDefiniteMatrixQ with a symbolic matrix:

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

PositiveDefiniteMatrixQ works efficiently with large numerical matrices:

Special Matrices  (4)

Use PositiveDefiniteMatrixQ with sparse matrices:

Use PositiveDefiniteMatrixQ with structured matrices:

The identity matrix is positive definite:

HilbertMatrix is positive definite:

Applications  (15)

The Geometry and Algebra of Positive Definite Matrices  (4)

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

Because is positive definite, the level sets are ellipses:

The plot of will be an upward-facing elliptic paraboloid:

For a real, positive definite matrix, the level sets are -ellipsoids:

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

If is positive definite, is positive for all nonzero inputs:

Visualize for real-valued inputs:

For a real-valued matrix , only the symmetric part determines whether is positive definite. 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 positive definite if and only if is:

For a complex-valued matrix , only the Hermitian part determines whether is positive definite. 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 positive definite if and only if is:

Sources of Positive Definite Matrices  (6)

A real nonsingular Covariance matrix is always symmetric and positive definite:

A complex one is Hermitian:

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

A Gram matrix is always positive definite if vectors are linearly independent:

Matrices drawn from WishartMatrixDistribution are real, symmetric and positive definite:

The squares of nonsingular Hermitian matrices are positive definite:

The Lehmer matrix is symmetric positive definite:

Its inverse is tridiagonal, which is also symmetric positive definite:

The matrix Min[i,j] is always symmetric positive definite:

Its inverse is a tridiagonal matrix, which is also symmetric positive definite:

Uses of Positive Definite Matrices  (5)

A positive definite, real symmetric matrix or metric defines an inner product by :

Verify that is in fact symmetric and positive definite:

Orthogonalize the standard basis of TemplateBox[{}, Reals]^n to find an orthonormal basis:

Confirm that this basis is orthonormal with respect to the inner product :

The moment of inertia tensor is the equivalent of mass for rotational motion. For example, kinetic energy is , with taking the place of the mass and angular velocity taking the place of linear velocity in the formula . can be represented by a positive definite symmetric matrix. Compute the moment of inertia for a tetrahedron with endpoints at the origin and positive coordinate axes:

Verify that the matrix is symmetric and positive definite:

Compute the kinetic energy if its angular velocity is :

As is positive definite, the kinetic energy is positive as long as is nonzero:

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:

CholeskyDecomposition works only with positive definite Hermitian matrices:

An upper triangular decomposition of is a matrix such that TemplateBox[{b}, ConjugateTranspose].b=m:

Properties & Relations  (15)

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

A matrix is positive definite if Re(TemplateBox[{x}, ConjugateTranspose].m.x)>0 for all nonzero vectors :

The sign of Im(TemplateBox[{x}, ConjugateTranspose].m.x) is irrelevant:

A real matrix is positive definite if and only if its symmetric part is positive definite:

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

A real symmetric matrix is positive definite if and only if its eigenvalues are all positive:

The statement is true of Hermitian matrices more generally:

A general matrix can have all positive eigenvalues without being positive definite:

Equally, a matrix can be positive definite without having positive eigenvalues:

The failure is due to the eigenvalues being complex:

The real part of the eigenvalues of a positive definite matrix must be positive:

A diagonal matrix is positive definite if and only if the diagonal elements have positive real part:

A positive definite matrix has the general form u.d.TemplateBox[{u}, ConjugateTranspose]+a with a diagonal positive definite :

Split into its Hermitian and antihermitian parts:

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

The matrix is diagonal with positive diagonal entries:

The matrix is unitary:

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

A matrix is positive definite if and only if is negative definite:

A positive definite matrix is always positive semidefinite:

It cannot be indefinite or negative semidefinite:

A positive definite matrix is invertible:

The inverse matrix is positive definite as well:

If is real and positive definite, there exists such that TemplateBox[{x}, Transpose].m.x>=delta ||x||^2 for any real vector :

Let be the smallest eigenvalue of the symmetric part of :

Verify that TemplateBox[{x}, Transpose].m.x>=delta ||x||^2:

The determinant and trace of a real, symmetric, positive definite matrix are positive:

This is also true of positive definite Hermitian matrices:

A real symmetric positive definite matrix has a uniquely defined square root such that :

The square root is positive definite and real symmetric:

A Hermitian positive definite matrix has a uniquely defined square root such that :

The square root is positive definite and Hermitian:

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

Replacing one matrix in the product by a negative definite one gives a negative definite matrix:

Possible Issues  (2)

Hilbert matrices are positive definite:

The smallest eigenvalue of m is too small to be certainly positive at machine precision:

At machine precision, the matrix m does not test as positive definite:

Using precision high enough to compute positive eigenvalues will give the correct answer:

PositiveDefiniteMatrixQ gives False unless it can prove a symbolic matrix is positive definite:

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

Wolfram Research (2007), PositiveDefiniteMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PositiveDefiniteMatrixQ.html.

Text

Wolfram Research (2007), PositiveDefiniteMatrixQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PositiveDefiniteMatrixQ.html.

CMS

Wolfram Language. 2007. "PositiveDefiniteMatrixQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PositiveDefiniteMatrixQ.html.

APA

Wolfram Language. (2007). PositiveDefiniteMatrixQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PositiveDefiniteMatrixQ.html

BibTeX

@misc{reference.wolfram_2024_positivedefinitematrixq, author="Wolfram Research", title="{PositiveDefiniteMatrixQ}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/PositiveDefiniteMatrixQ.html}", note=[Accessed: 17-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_positivedefinitematrixq, organization={Wolfram Research}, title={PositiveDefiniteMatrixQ}, year={2007}, url={https://reference.wolfram.com/language/ref/PositiveDefiniteMatrixQ.html}, note=[Accessed: 17-November-2024 ]}