({{, (RefLink[NegativeDefiniteMatrixQ, paclet:ref/NegativeDefiniteMatrixQ])[m] 
gives (RefLink[True, paclet:ref/True]) if m is explicitly negative definite, and (RefLink[False, paclet:ref/False]) otherwise.}})

OpenersNotesSection(Spacer1)Details

A matrix m is negative definite if (RefLink[Re, paclet:ref/Re])[(RefLink[Conjugate, paclet:ref/Conjugate])[x].m.x]<0 for all nonzero vectors x.

(RefLink[NegativeDefiniteMatrixQ, paclet:ref/NegativeDefiniteMatrixQ]) works for symbolic as well as numerical matrices.

OpenersPrimaryExamplesSection(Spacer1)Examples  (24)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Test if a matrix is explicitly negative definite:

m = {{-1,1},{1,-2}};

NegativeDefiniteMatrixQ[m]

This means that the quadratic form x.m.x<0 for all vectors x≠0:

Plot3D[{(Subscript[x, 1]),(Subscript[x, 2])}.m.{(Subscript[x, 1]),(Subscript[x, 2])},{(Subscript[x, 1]),-1,1},{(Subscript[x, 2]),-1,1}]

OpenersExampleSection1(Spacer1)Scope  (5)

A real matrix:

NegativeDefiniteMatrixQ[{{-3,2},{1,-2}}]

A complex matrix:

NegativeDefiniteMatrixQ[{{-1,-2I},{I,-4}}]

A dense matrix:

NegativeDefiniteMatrixQ[{{-4,1},{2,-5}}]

A sparse matrix:

s=SparseArray[{{i_,i_}->-2.,{i_,j_}/;Abs[i-j]==1->1.},{1000, 1000},0.]

NegativeDefiniteMatrixQ[s]

An approximate (RefLink[MachinePrecision, paclet:ref/MachinePrecision]) matrix:

NegativeDefiniteMatrixQ[{{-2.3,1.2},{0.6,-3.7}}]

An approximate arbitrary-precision matrix:

m= N[{{-Pi,-1},{1,-E}},20]

NegativeDefiniteMatrixQ[m]

A matrix of exact numeric entries:

NegativeDefiniteMatrixQ[{{-Pi,-1},{1,-E}}]

A matrix with symbolic entries:

NegativeDefiniteMatrixQ[{{-1,-a},{Conjugate[a],-1}}]

The test returns (RefLink[False, paclet:ref/False]) unless it is true for all possible complex values of symbolic parameters:

NegativeDefiniteMatrixQ[{{a,0},{0,a}}]

OpenersExampleSection3(Spacer1)Applications  (3)

Find the level sets for a quadratic form x.m.x for a negative definite matrix:

q={{1,1},{1,-1}};d=DiagonalMatrix[{-1,-2}];
m=q.d.Transpose[q]

NegativeDefiniteMatrixQ[m]

In 2D, the level sets are ellipses:

{Plot3D[{x,y}.m.{x,y},{x,-2,2},{y,-2,2},MeshFunctions->{#3&}],ContourPlot[{x,y}.m.{x,y}==-5,{x,-2,2},{y,-2,2}]}

In 3D, the level sets are ellipsoids:

q={{1,1,0},{1,-1,0},{0,0,1}};d=DiagonalMatrix[{-1,-2,-3}];
m=q.d.Transpose[q]

NegativeDefiniteMatrixQ[m]

ContourPlot3D[{x,y,z}.m.{x,y,z}==-9,{x,-2,2},{y,-2,2},{z,-2,2},Contours->{0.1,0.2,0.5}]

It is possible to apply (RefLink[CholeskyDecomposition, paclet:ref/CholeskyDecomposition]) to a negative definite matrix by changing its sign:

m = {{-4,0,0},{0,-3,1},{0,1,-2}};

NegativeDefiniteMatrixQ[m]&&SymmetricMatrixQ[m]

(RefLink[CholeskyDecomposition, paclet:ref/CholeskyDecomposition]) works only with positive definite symmetric or Hermitian matrices:

b=CholeskyDecomposition[-m]

An upper triangular decomposition of m is a matrix b such that (b^†).b==-m:

ConjugateTranspose[b].b==-m

A sufficient condition for a maximum of a function f is a zero gradient and negative definite Hessian:

f[v_?VectorQ]:=Module[{v1=Take[v,{1,-1,2}],v2=Take[v,{2,-1,2}],n},
n=Length[v2];
v2=(v2-PadRight[v1,n,v1]^2);
v1-=Range[Length[v1]];
-v1.v1-(Range[n]v2).v2];

f[Array[(Subscript[x, #])&,5]]

Check the conditions for up to five variables:

TableForm[Table[
v=Array[(Subscript[x, #])&,n];g=D[f[v],{v}];h=D[f[v],{v,2}];
{max,maxp}=Quiet[FindMaximum[f[v],Evaluate[Transpose[{v,RandomReal[1,n]}]]]];
{max,maxp,Norm[g/.maxp],NegativeDefiniteMatrixQ[h/.maxp]},{n,1,5}],TableHeadings->{{},{"max","maximizer","\[LeftDoubleBracketingBar]∇f\[RightDoubleBracketingBar]","Negative definite Hessian"}}]

OpenersExampleSection4(Spacer1)Properties & Relations  (14)

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

m={{-2,1},{1,-2}};

{SymmetricMatrixQ[m],NegativeDefiniteMatrixQ[m]}

The eigenvalues of m are all negative:

Negative/@Eigenvalues[m]

A Hermitian matrix is negative definite if and only if its eigenvalues are all negative:

m={{-1,-I},{I,-2}};

{HermitianMatrixQ[m],NegativeDefiniteMatrixQ[m]}

The eigenvalues of m are all negative:

Negative/@Eigenvalues[m]

A real m is negative definite if and only if its symmetric part, (1/2) (m+(Transpose[m])), is negative definite:

m = {{-3,2},{-1,-4}};

NegativeDefiniteMatrixQ[m]

The condition (RefLink[Re, paclet:ref/Re])[(RefLink[Conjugate, paclet:ref/Conjugate])[x].m.x]<0 is satisfied:

x=RandomComplex[1+I,{2}];
Re[Conjugate[x].m.x]

The symmetric part has negative eigenvalues:

Negative/@Eigenvalues[(m+Transpose[m])/2]

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

Negative/@Eigenvalues[m]

A complex m is negative definite if and only if its Hermitian part, (1/2) (m+(m^†)), is negative definite:

m = {{-1,-2I},{I,-4 + I}};

NegativeDefiniteMatrixQ[m]

The condition (RefLink[Re, paclet:ref/Re])[(RefLink[Conjugate, paclet:ref/Conjugate])[x].m.x]<0 is satisfied:

x=RandomComplex[1+I,{2}];
Re[Conjugate[x].m.x]

The Hermitian part has negative eigenvalues:

Negative/@Eigenvalues[(m+ConjugateTranspose[m])/2]

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

Negative/@Eigenvalues[m]

A diagonal matrix is negative definite if the diagonal elements are negative:

d=DiagonalMatrix[{-1,-2,-4}];

{x,y,z}.d.{x,y,z}

NegativeDefiniteMatrixQ[d]

A negative definite matrix is always negative semidefinite:

m={{-3,1},{1,-2}};

{NegativeDefiniteMatrixQ[m],NegativeSemidefiniteMatrixQ[m]}

The determinant and trace of a symmetric negative definite matrix are negative:

m={{-0.680920612569,-0.5839532843511359,-0.7933498904602229},{-0.5839532843511359,-2.821694958440086,-0.8447285139555082},{-0.7933498904602229,-0.8447285139555082,-0.9445332482607429}};

NegativeDefiniteMatrixQ[m]&&SymmetricMatrixQ[m]

Negative/@{Det[m],Tr[m]}

A symmetric negative definite matrix is invertible:

m={{-0.680920612569,-0.5839532843511359,-0.7933498904602229},{-0.5839532843511359,-2.821694958440086,-0.8447285139555082},{-0.7933498904602229,-0.8447285139555082,-0.9445332482607429}};

NegativeDefiniteMatrixQ[m]&&SymmetricMatrixQ[m]

mi=Inverse[m]

The inverse matrix is negative definite:

NegativeDefiniteMatrixQ[mi]

A Hermitian negative definite matrix is invertible:

m={{-4.4063915815780526,-2.415609335653971-0.9784858036636759*I,-3.272554434576208-0.9581109282797712*I},{-2.415609335653971+0.9784858036636759*I,-3.2093833346047265,-2.1186156336423365+0.44745371013921886*I},{-3.272554434576208+0.9581109282797711*I,-2.1186156336423365-0.4474537101392189*I,-2.711962460046668}};

NegativeDefiniteMatrixQ[m]&&HermitianMatrixQ[m]

mi=Inverse[m]//Chop

The inverse matrix is negative definite:

NegativeDefiniteMatrixQ[mi]

A symmetric negative definite matrix m has a uniquely defined square root b such that -m=b.b:

m={{-3.190023505153258,-2.4571124732137526,-3.1702589583416105},{-2.4571124732137526,-3.7756789190375084,-4.005717103481039},{-3.1702589583416105,-4.005717103481039,-4.806632993087039}};

NegativeDefiniteMatrixQ[m]&&SymmetricMatrixQ[m]

b=MatrixFunction[Sqrt,-m]

-m==b.b

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

m={{-2.9425255996142887,-1.6494147021595955,-3.6136769206595654},{-1.6494147021595955,-2.2267882143758357,-2.2251351542101174},{-3.6136769206595654,-2.2251351542101174,-4.4769591062377}};
n={{-0.10696857615478556,-0.09420715976163785},{-0.09420715976163785,-0.17814922498702113}};

NegativeDefiniteMatrixQ[#]&&SymmetricMatrixQ[#]&/@{m,n}

kp=KroneckerProduct[m,n];

{PositiveDefiniteMatrixQ[kp],SymmetricMatrixQ[kp]}

The Kronecker product of a symmetric negative definite matrix and a symmetric positive definite matrix is symmetric negative definite:

m={{-2.9425255996142887,-1.6494147021595955,-3.6136769206595654},{-1.6494147021595955,-2.2267882143758357,-2.2251351542101174},{-3.6136769206595654,-2.2251351542101174,-4.4769591062377}};
n={{0.10696857615478556,0.09420715976163785},{0.09420715976163785,0.17814922498702113}};

{NegativeDefiniteMatrixQ[m]&&SymmetricMatrixQ[m],PositiveDefiniteMatrixQ[n]&&SymmetricMatrixQ[n]}

kp=KroneckerProduct[m,n];

{NegativeDefiniteMatrixQ[kp],SymmetricMatrixQ[kp]}

If m is negative definite, then there exists δ>0 such that (Transpose[x]).m.x≤-δ ((Norm[x])^2) for any nonzero x:

m={{-2.73606532826915,-2.0786854839400886,-1.4786047351101208},{-2.3613800805922605,-2.4910629497367434,-1.948650327453989},{-2.1525986233405727,-2.5588806912654993,-2.4474066146439286}};

{NegativeDefiniteMatrixQ[m],SymmetricMatrixQ[m]}

result=True;
Do[ x=RandomReal[1.,3];
result=result&&(x.m.x≤-0.13 x.x),{100}];
result

A negative definite real matrix has the general form m.d.(m^ᵀ)+a with a diagonal negative definite d:

d=DiagonalMatrix[{-2,-1,-3}];

m is a nonsingular square matrix:

m=RandomReal[1,{3,3}]; Det[m]≠0

a is an antisymmetric matrix:

a=Block[{b=RandomReal[1,{3,3}]},(b-b\[Transpose])/2];

NegativeDefiniteMatrixQ[m.d.m\[Transpose]+a]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

The Hilbert matrix m is positive definite and -m is negative definite:

m = HilbertMatrix[16];

NegativeDefiniteMatrixQ[-m]

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

Eigenvalues[N[-m]]

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

NegativeDefiniteMatrixQ[N[-m]]

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

NegativeDefiniteMatrixQ[N[-m,24]]

Negative/@Eigenvalues[N[-m,24]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NegativeSemidefiniteMatrixQ, paclet:ref/NegativeSemidefiniteMatrixQ])  ▪  (RefLink[PositiveDefiniteMatrixQ, paclet:ref/PositiveDefiniteMatrixQ])  ▪  (RefLink[PositiveSemidefiniteMatrixQ, paclet:ref/PositiveSemidefiniteMatrixQ])  ▪  (RefLink[HermitianMatrixQ, paclet:ref/HermitianMatrixQ])  ▪  (RefLink[SymmetricMatrixQ, paclet:ref/SymmetricMatrixQ])  ▪  (RefLink[Eigenvalues, paclet:ref/Eigenvalues])  ▪  (RefLink[SquareMatrixQ, paclet:ref/SquareMatrixQ])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Matrix Predicates, paclet:guide/MatrixPredicates])}})}})