This calculator tests the definiteness of a real symmetric matrix using Sylvester's criterion. For a chosen size (2×2, 3×3, or 4×4), you enter the entries of a symmetric matrix. The tool then computes the leading principal minors (determinants of the top-left k×k blocks) and classifies the matrix as positive definite, negative definite, positive semidefinite, negative semidefinite, or indefinite, when possible.
aij = aji.
If you enter a non-symmetric matrix, the calculator will still compute the
leading principal minors of the matrix you provide, but the theoretical
conclusions about definiteness strictly apply only when the matrix is
symmetric.
This is especially useful if you are checking Hessian matrices in optimization, testing covariance matrices in statistics, or analyzing stability in differential equations without computing eigenvalues explicitly.
Let A be an n×n real symmetric matrix. For each k = 1, 2, …, n, the k-th leading principal minor is the determinant of the top-left k×k block of A. Denote this determinant by Δk.
In compact form, if we write the k×k leading principal submatrix as Ak, then
For small matrices, this becomes very explicit. For a 2×2 matrix
A = [ [a, b],
[b, c] ]
For a 3×3 matrix
A = [ [a, d, e],
[d, b, f],
[e, f, c] ]
Sylvester's criterion for a real symmetric matrix states:
When some minors are zero, you cannot conclude strict definiteness, but you may still be able to recognize positive or negative semidefiniteness (see the limitations and special cases below).
The calculator examines the sign pattern of the leading principal minors and attempts to assign one of the following labels:
Because the test is sensitive to small numerical values, the script treats determinants whose absolute value is extremely close to zero as zero within a small numerical tolerance. This helps avoid misclassifying matrices when rounding errors occur in floating-point arithmetic.
Consider the symmetric 2×2 matrix
A = [ [2, 1],
[1, 2] ].
The leading principal minors are
Both minors are positive, so by Sylvester's criterion the matrix is positive definite. The quadratic form xTAx is strictly positive for every nonzero vector x.
Take the symmetric 3×3 matrix mentioned in the original explanation:
A = [ [4, 1, 2],
[1, 3, 0],
[2, 0, 5] ].
Then
All three minors are strictly positive, so the calculator will report that A is positive definite.
If we replace the 4 in the upper-left corner with −4, producing
B = [ [-4, 1, 2],
[ 1, 3, 0],
[ 2, 0, 5] ],
the signs of the minors change to an alternating pattern (negative, positive, negative), and the calculator classifies B as negative definite.
The table below summarizes how the calculator interprets the sign pattern of the leading principal minors for a real symmetric matrix.
| Condition on leading principal minors | Typical classification | What it means for xTAx |
|---|---|---|
| Δk > 0 for all k = 1, …, n | Positive definite | Strictly positive for all nonzero x; unique minimum at the origin for the associated quadratic form. |
| Δ1 < 0, Δ2 > 0, Δ3 < 0, … (alternating signs) | Negative definite | Strictly negative for all nonzero x; unique maximum at the origin. |
| At least one positive and one negative Δk, pattern not matching the above | Indefinite | Takes both positive and negative values; typical of saddle points in optimization. |
| All Δk ≥ 0, with at least one zero (pattern consistent with positive definiteness apart from zeros) | Positive semidefinite (candidate) | Never negative, but may be zero for some nonzero x; Sylvester's test alone is not a complete characterization. |
| Alternating signs with some Δk = 0 (pattern consistent with negative definiteness apart from zeros) | Negative semidefinite (candidate) | Never positive, but may be zero for some nonzero x; requires additional checks to confirm. |
| One or more Δk numerically very close to zero while others fit a definite pattern | Borderline / sensitive case | Classification may depend on numerical tolerance; consider rerunning with higher precision or symbolic methods. |
Once you know whether a matrix is positive or negative definite, you might want to explore related tools:
Together, these tools provide a practical toolkit for understanding the curvature and stability properties encoded in matrices across optimization, statistics, physics, and engineering.