Gradient Lab · PSD Classifier
PSD Classifier Guide - Definiteness by Trace and Det
Classify a symmetric 2x2 matrix as positive definite, positive semidefinite, indefinite, or negative definite using trace and determinant - the test that decides whether it could be a covariance matrix.

What is a positive definite matrix?
A symmetric matrix A is positive definite if the quadratic form xᵀAx is strictly positive for every nonzero vector x, positive semidefinite if it can touch zero but never goes negative, and indefinite if it takes both positive and negative values depending on x. These properties describe the matrix's entire behavior at once: positive definiteness says A never reverses the sign of the 'energy' xᵀAx no matter which direction x you probe it with.
Because A is symmetric, its eigenvalues are real, and definiteness translates directly into their signs: positive definite means every eigenvalue is strictly positive, positive semidefinite allows zero eigenvalues alongside nonnegative ones, and indefinite means the eigenvalues have mixed signs. For a 2x2 matrix this is why the determinant (the product of the eigenvalues) and the trace (their sum) are enough to classify it: a negative determinant forces opposite-signed eigenvalues on its own, and once the determinant is nonnegative the trace tells you which sign both eigenvalues share. The same idea generalizes to any size through Sylvester's criterion - a matrix is positive definite exactly when all of its leading principal minors are positive.
Positive semidefiniteness is the exact condition that makes a symmetric matrix a valid covariance matrix. For any random vector, the variance of a linear combination wᵀX is wᵀΣw, where Σ is the covariance matrix - and a variance can never be negative. So any legitimate covariance or correlation matrix must be positive semidefinite, and a candidate matrix that fails the test, however plausible its individual entries look, is claiming that some portfolio or linear combination has negative variance, which is impossible.
Definiteness also decides the shape of an optimization landscape. A twice-differentiable function's Hessian being positive definite at a critical point certifies a local minimum, negative definite certifies a local maximum, and an indefinite Hessian marks a saddle point - the multivariable generalization of the second-derivative test. A positive semidefinite Hessian everywhere is exactly the condition for a function to be convex, which is why convexity checks in optimization and machine learning routinely come down to a definiteness test.
In quant finance this test shows up constantly: validating that an estimated or shrunk covariance matrix is usable, checking that a proposed correlation matrix is internally consistent, confirming that an optimization problem like mean-variance portfolio construction is convex and therefore has a unique solution, and using the Cholesky decomposition - which exists only for positive definite matrices - to simulate correlated asset returns.
How it works
Each round shows a random symmetric 2x2 matrix [[a, b], [b, c]] with integer entries - a and c drawn from -4 to 4, b from -3 to 3. You pick one of four labels: Positive definite, Positive semidefinite, Indefinite, or Negative definite.
The truth is computed from trace and determinant: det = ac - b² and trace = a + c. If det < 0 the matrix is indefinite. If det ≥ 0 with a > 0 and trace > 0, it is positive definite when det > 0 and positive semidefinite when det = 0. If a < 0 and trace < 0 it is negative definite. In the remaining boundary cases (a = 0 with det ≥ 0), it counts as positive semidefinite only when b = 0 and both a and c are nonnegative; otherwise indefinite.
After each pick the reveal shows trace and det with a one-line explanation of what they imply about the eigenvalue signs, then you move to the next matrix.
How scoring works
A correct label adds 1 to score and extends your streak; a wrong one resets the streak to 0. Rounds count every pick. Each pick is also recorded against the linear-algebra skill in your progress profile as correct or incorrect.
Definiteness is about the sign of a quadratic form
For a symmetric matrix Σ, the object being classified is the quadratic form xᵀΣx = ax₁² + 2bx₁x₂ + cx₂². Positive definite means the form is strictly positive for every nonzero x; positive semidefinite allows it to touch zero; indefinite means it takes both signs; negative definite means it is always strictly negative.
For a symmetric matrix these definitions translate exactly into eigenvalue signs: both positive (PD), both nonnegative with at least one zero (PSD boundary), opposite signs (indefinite), both negative (ND). You never need the eigenvalues themselves, because for a 2x2 their product is det and their sum is trace - the two numbers the game shows you afterward.
This is why the intro mentions covariance matrices: a covariance matrix is exactly a symmetric PSD matrix, since xᵀΣx is the variance of the portfolio with weights x, and a variance cannot be negative. A candidate covariance with det < 0 is claiming some portfolio has negative variance - impossible, and instantly spottable.
The det-first decision tree
Run one fixed order every round. First compute det = ac - b². If det < 0, stop: the eigenvalues have opposite signs (their product is negative), so the matrix is indefinite - no other check needed, and the diagonal signs are irrelevant. This single test resolves a large share of rounds, and b² grows fast, so any sizable off-diagonal against a modest diagonal product tends to force indefiniteness.
If det > 0, the eigenvalues share a sign, and the trace (their sum) tells you which: trace > 0 means positive definite, trace < 0 means negative definite. With det > 0 you cannot have a zero eigenvalue, so the semidefinite labels are off the table.
If det = 0, one eigenvalue is exactly zero and the boundary labels come alive: positive trace means PSD (the other eigenvalue is positive), negative trace means the game classifies it under negative definite per its trace/det rule, and the fully degenerate cases hinge on b - the code accepts PSD only when b = 0 with a and c nonnegative. In play: det = 0 with a positive diagonal and consistent b means semidefinite.
Sanity anchors that catch errors instantly
Diagonal entries are quadratic-form values at the coordinate directions: a = e₁ᵀΣe₁ and c = e₂ᵀΣe₂. So a negative diagonal entry immediately rules out PD and PSD, and a positive one immediately rules out ND - before you compute anything. Mixed diagonal signs (a > 0, c < 0) force indefiniteness on the spot, which det confirms since ac - b² < 0.
Sylvester's criterion is the same test in another costume: PD iff the leading minors a and ac - b² are both positive. It generalizes to any dimension - check all leading principal minors - which is the version interviewers ask about for 3x3 and beyond.
Keep the classic trap matrix in mind: [[1, 2], [2, 1]] has a positive diagonal and positive trace but det = 1 - 4 = -3, so it is indefinite. Positive diagonal entries are necessary but not sufficient - the off-diagonal coupling can drag one eigenvalue negative, which is exactly what b² subtracting from ac encodes.
A worked example
Setup: classify this symmetric matrix.
Determinant first. It is positive, so the eigenvalues share a sign - indefinite and semidefinite are eliminated.
Trace tells you which sign the eigenvalues share.
Verify against the eigenvalues directly: their product is det and their sum is trace, and both come out positive.
A direct probe of the quadratic form confirms it - even along the coupling-heavy direction, it stays positive.
Contrast case: change c to 1. Now det is negative, so the matrix is indefinite despite a positive diagonal.
An explicit direction shows negative variance - impossible for a real covariance matrix.
Common mistakes
• Judging from the diagonal alone. Positive a and c do not make a matrix PSD - if b² > ac, the off-diagonal coupling makes it indefinite. Always compute det.
• Checking trace before det. Trace only identifies the shared sign after det ≥ 0 has established that the signs agree; with det < 0 a positive trace still means indefinite.
• Conflating positive definite with positive semidefinite. In this game det > 0 with positive trace is PD, and det = 0 exactly is the semidefinite boundary - answering PSD when det is strictly positive is graded wrong.
• Forgetting the sign rule of the product: det < 0 means opposite-sign eigenvalues, always indefinite - there is no other option, whatever a, b, c look like individually.
• Ignoring the b term in degenerate cases. With a = 0, the matrix is only PSD if b = 0 too (and c ≥ 0); a zero diagonal entry with nonzero coupling produces a direction where the form goes negative.
Why interviews test this
Definiteness checks appear across the quant interview stack: is this a valid covariance or correlation matrix, is this Hessian telling me the critical point is a min, a max, or a saddle, and is this optimization problem convex. The 2x2 trace/det shortcut is the expected fluency level, with Sylvester's leading-minors criterion as the stated generalization.
Common phrasings to be ready for: fix the entry range that keeps [[1, ρ], [ρ, 1]] PSD (answer: |ρ| ≤ 1, from det = 1 - ρ² ≥ 0), explain why sample covariance matrices are always PSD, and classify a critical point from its Hessian - the second-derivative test in multivariable calculus is precisely this game.
Play PSD Classifier on Outcry
PSD Classifier is free to play on Outcry, in the Gradient Lab section, and every run is timed and scored. Read the guide once, then play PSD Classifier and check your score against the strategy above. The guide book has a written guide for every other game, and the practice hub and mock assessments put the same skills under a real screen's clock.