1. Home
  2. Explore
  3. Mathematics
  4. Positive Definite Matrices

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Positive Definite Matrices

Positive-Definite Matrices, Energy, and Optimization

Symmetric matrices: the starting point

A symmetric matrix is a square matrix that equals its transpose: S=STS=S^TS=ST. Symmetry matters because it gives a matrix especially useful structure: its eigenvalues are real, and it has a basis of orthogonal eigenvectors. In fact, the eigenvectors can be chosen to be an orthonormal basis.

The real-eigenvalue result follows from symmetry. If vvv is an eigenvector with eigenvalue λ\lambdaλ, then Sv=λvSv=\lambda vSv=λv. Using complex conjugation, symmetry gives v∗Sv=λv∗vv^*Sv=\lambda v^*vv∗Sv=λv∗v, and the left side is real. Since v∗vv^*vv∗v is positive, λ\lambdaλ must be real. For orthogonality, suppose Sv=λvSv=\lambda vSv=λv and Sw=μwSw=\mu wSw=μw. Symmetry gives vTSw=(Sv)Twv^TSw=(Sv)^TwvTSw=(Sv)Tw, so μvTw=λvTw\mu v^Tw=\lambda v^TwμvTw=λvTw. If the eigenvalues are different, this equality requires vTw=0v^Tw=0vTw=0: the eigenvectors are perpendicular.

This structure makes it possible to understand a symmetric matrix through its eigenvalues and eigenvectors. It also gives several equivalent ways to determine whether the matrix is positive definite.

Positive definiteness and the energy of a vector

A symmetric matrix SSS is positive definite when its quadratic expression is positive for every nonzero vector xxx:

xTSx>0for every x≠0.x^T Sx>0 \qquad \text{for every } x\ne 0.xTSx>0for every x=0.

The expression xTSxx^TSxxTSx is often called the energy associated with xxx and SSS. It is quadratic because each component of xxx is multiplied by another component of xxx.

For example, consider

S=[3446],x=[xy].S= \begin{bmatrix} 3&4\\ 4&6 \end{bmatrix}, \qquad x= \begin{bmatrix} x\\ y \end{bmatrix}.S=[34​46​],x=[xy​].

Multiplying out the energy gives

xTSx=[xy][3446][xy]=3x2+8xy+6y2.x^TSx = \begin{bmatrix}x&y\end{bmatrix} \begin{bmatrix}3&4\\4&6\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix} = 3x^2+8xy+6y^2.xTSx=[x​y​][34​46​][xy​]=3x2+8xy+6y2.

The diagonal entries produce the squared terms, and the off-diagonal entries produce the cross terms. Here, the two off-diagonal contributions are both 4xy4xy4xy, giving 8xy8xy8xy altogether.

The cross term can be negative when xxx and yyy have opposite signs, so positive diagonal entries alone do not guarantee positive energy. Positive definiteness means that the full expression remains positive for every nonzero choice of the vector. Geometrically, the energy forms a bowl with its lowest point at the origin.

A symmetric matrix is positive definite precisely when every nonzero vector has positive energy.

A key example

For the matrix above, the determinant is

det⁡(S)=3⋅6−4⋅4=2.\det(S)=3\cdot 6-4\cdot 4=2.det(S)=3⋅6−4⋅4=2.

Its trace, the sum of its diagonal entries, is 3+6=93+6=93+6=9. The two eigenvalues are real; their product is the determinant, and their sum is the trace. Since their product is positive and their sum is positive, both eigenvalues are positive. Thus SSS is positive definite.

By contrast, consider

[3445].\begin{bmatrix} 3&4\\ 4&5 \end{bmatrix}.[34​45​].

Its determinant is 15−16=−115-16=-115−16=−1. Because the eigenvalues are real and their product is negative, one eigenvalue is positive and the other is negative. The matrix is indefinite: its energy is positive for some vectors and negative for others.

This contrast shows why having positive entries is not enough. Positive definiteness concerns the behavior of the entire quadratic expression, not the signs of the individual entries.

Think About It

Why can a quadratic expression with positive squared terms still become negative? The cross terms can pull the value downward, so the question is whether the squared terms always outweigh them.

Equivalent tests for positive definiteness

For a symmetric matrix, several tests give equivalent answers. Any one of these can establish positive definiteness; the most convenient test depends on the problem.

Positive eigenvalues

A symmetric matrix is positive definite exactly when all its eigenvalues are positive. To see why, use an orthonormal eigenbasis. In that basis, the energy is a sum of terms of the form λizi2\lambda_i z_i^2λi​zi2​, where λi\lambda_iλi​ are the eigenvalues and ziz_izi​ are the coordinates of the vector. Every nonzero vector has positive energy if and only if every λi\lambda_iλi​ is positive.

This is a direct test in theory, but finding eigenvalues can be inconvenient in practice.

Positive energy

The definition itself is a test: check whether xTSx>0x^TSx>0xTSx>0 for every nonzero xxx. This viewpoint is especially helpful for proving general statements, because expressions involving the energy can often be compared or rearranged directly.

A factorization as ATAA^TAATA

A positive-definite matrix can be written as

S=ATAS=A^TAS=ATA

for an invertible square matrix AAA. This factorization explains positive energy:

xTSx=xTATAx=(Ax)T(Ax)=∥Ax∥2.x^TSx=x^TA^TAx=(Ax)^T(Ax)=\|Ax\|^2.xTSx=xTATAx=(Ax)T(Ax)=∥Ax∥2.

A squared length is positive unless Ax=0Ax=0Ax=0. Since AAA is invertible, Ax=0Ax=0Ax=0 can happen only when x=0x=0x=0.

The same idea explains positive semidefiniteness, introduced later: if AAA is not invertible, or is rectangular, ATAA^TAATA still has nonnegative energy, but some nonzero vectors may have zero energy.

Positive leading principal determinants

A leading principal determinant is the determinant of a square block taken from the upper-left corner of the matrix. For a matrix of size nnn, the tests use the upper-left blocks of sizes 1,2,…,n1,2,\ldots,n1,2,…,n.

For the example

S=[3446],S= \begin{bmatrix} 3&4\\ 4&6 \end{bmatrix},S=[34​46​],

the first leading determinant is 333, and the second is the full determinant, 222. Both are positive, so this test confirms positive definiteness.

The word leading is important. The full determinant alone is not enough. For instance,

[−344−6]\begin{bmatrix} -3&4\\ 4&-6 \end{bmatrix}[−34​4−6​]

also has determinant 222, but its first leading determinant is −3-3−3. It fails the leading-determinant test and is not positive definite. In fact, it is negative definite: its eigenvalues are both negative. The full determinant records the product of the eigenvalues, not whether each one is positive.

Positive elimination pivots

Gaussian elimination links positive definiteness to pivots, the diagonal entries produced during elimination. For the example matrix, the first pivot is 333. Eliminating the 444 below it uses the multiplier 43\frac{4}{3}34​, leaving the second pivot

6−43⋅4=6−163=23.6-\frac{4}{3}\cdot 4 = 6-\frac{16}{3} = \frac{2}{3}.6−34​⋅4=6−316​=32​.

Both pivots are positive. The second pivot also equals the second leading determinant divided by the first:

23.\frac{2}{3}.32​.

In general, with the leading blocks ordered from the upper-left corner, each pivot is the ratio of consecutive leading determinants. Thus positive leading determinants and positive pivots express the same test in two related forms.

For an n×nn\times nn×n symmetric matrix, these checks involve nnn stages. The determinant test, pivot test, energy test, eigenvalue test, and factorization test are different ways of detecting the same positive-definite structure.

Think About It

If the determinant is positive, what does that say about the eigenvalues—and what does it leave unanswered? It gives their product, but without other information it does not establish that every eigenvalue is positive.

Positive definiteness and optimization

The bowl-shaped energy of a positive-definite matrix is also a basic model for optimization: finding the input that makes a function as small as possible. A quadratic function such as xTSxx^TSxxTSx has its minimum at the origin. Adding a linear term can shift the minimum away from the origin while preserving the bowl shape:

f(x)=xTSx+bTx.f(x)=x^TSx+b^Tx.f(x)=xTSx+bTx.

For a positive-definite SSS, this quadratic has a unique minimum. Its gradient is 2Sx+b2Sx+b2Sx+b, so the minimum occurs where

2Sx+b=0.2Sx+b=0.2Sx+b=0.

This simple quadratic model connects to more complicated loss functions used in machine learning. A loss function measures how poorly a model’s outputs match desired results; training seeks values of the model’s parameters that reduce that loss. In large problems, the function can depend on many variables, and it may include nonlinear terms rather than being a simple quadratic.

A function whose graph has a bowl-like shape is called convex. For a quadratic function, positive definiteness gives a strictly bowl-shaped energy, while allowing zero eigenvalues gives a flatter, positive-semidefinite case. More complicated functions can have additional bends or dips, so they need not be convex. In a nonconvex problem, a descent method may encounter a local minimum without reaching the lowest value overall.

Gradient descent

A common approach to minimization uses the gradient, the vector of first derivatives of the function. At a given point, the gradient indicates the direction of steepest increase; its negative indicates the direction of steepest decrease.

Gradient descent repeatedly performs two actions:

  1. It calculates the gradient at the current point.
  2. It moves in the direction of steepest decrease, then calculates a new gradient at the new point.

Choosing how far to move in each direction is called a line search. A step that is too long may pass the bottom of a valley and head upward again; a shorter step may be safer but slower. The method uses first derivatives rather than second derivatives, which can be much more costly to calculate when there are many variables.

Positive definiteness helps explain the shape of a quadratic bowl, but it does not guarantee that gradient descent will be fast. The eigenvalues describe how steep the bowl is in different directions. If they are very different in size, the bowl is long and narrow. From one side of such a valley, the steepest descent direction may cross to the other side rather than travel efficiently toward the bottom. Repeated crossings can make progress slow.

When the eigenvalues are equal, the bowl is circular in the corresponding coordinates. For example, the energy x2+y2x^2+y^2x2+y2 has equally steep directions. Starting anywhere other than the origin, following the steepest descent direction heads straight toward the center. Thus the relative sizes of the eigenvalues—not just whether they are positive—affect how well gradient descent behaves.

Useful operations that preserve positive definiteness

The energy test makes it easy to study some operations on positive-definite matrices without calculating new eigenvalues, determinants, or pivots.

Adding positive-definite matrices

If SSS and TTT are positive definite, then

xT(S+T)x=xTSx+xTTx.x^T(S+T)x=x^TSx+x^TTx.xT(S+T)x=xTSx+xTTx.

For every nonzero xxx, both terms on the right are positive, so their sum is positive. Therefore, S+TS+TS+T is positive definite.

Taking the inverse

If SSS is positive definite, then it is invertible, and its inverse is also symmetric and positive definite. Its eigenvalues are the reciprocals of the eigenvalues of SSS. Since the original eigenvalues are positive, their reciprocals are positive as well.

Changing coordinates orthogonally

If QQQ is an orthogonal matrix, then QTQ=IQ^TQ=IQTQ=I and QT=Q−1Q^T=Q^{-1}QT=Q−1. The matrix

QTSQQ^TSQQTSQ

is symmetric whenever SSS is symmetric. It is also positive definite, because its energy can be rewritten as

xTQTSQx=(Qx)TS(Qx).x^TQ^TSQx=(Qx)^TS(Qx).xTQTSQx=(Qx)TS(Qx).

For nonzero xxx, the vector QxQxQx is also nonzero, so this energy is positive when SSS is positive definite. In addition, QTSQQ^TSQQTSQ is similar to SSS, which means it has the same eigenvalues.

Think About It

Why is the energy test useful when adding two positive-definite matrices? It lets each matrix contribute a positive quantity to the sum, avoiding the need to compute the sum’s eigenvalues.

Positive semidefinite matrices: the boundary case

A symmetric matrix is positive semidefinite when its energy is nonnegative for every vector:

xTSx≥0.x^TSx\ge 0.xTSx≥0.

Equivalently, all its eigenvalues are nonnegative. Unlike a positive-definite matrix, a positive-semidefinite matrix may have a zero eigenvalue. That makes it singular: there is a nonzero direction in which the energy is zero.

For the family

[344c],\begin{bmatrix} 3&4\\ 4&c \end{bmatrix},[34​4c​],

the determinant is 3c−163c-163c−16. Setting c=163c=\frac{16}{3}c=316​ makes the determinant zero, so one eigenvalue is zero. The trace is then

3+163=253.3+\frac{16}{3}=\frac{25}{3}.3+316​=325​.

Because the trace is the sum of the eigenvalues, the other eigenvalue is 253\frac{25}{3}325​, which is positive. The matrix is therefore positive semidefinite: its eigenvalues are 253\frac{25}{3}325​ and 000.

Positive-semidefinite matrices can be thought of as lying at the boundary of the positive-definite matrices. A positive-definite matrix has positive energy in every nonzero direction; a positive-semidefinite matrix may be flat in one or more directions, but its energy never drops below zero.

The all-ones matrix

Consider the 3×33\times33×3 matrix whose entries are all 111:

J=[111111111].J= \begin{bmatrix} 1&1&1\\ 1&1&1\\ 1&1&1 \end{bmatrix}.J=​111​111​111​​.

All its rows are the same, so its rank is 111. It has one nonzero eigenvalue and two zero eigenvalues. The trace is 333, so the eigenvalues are 3,0,03,0,03,0,0. This matrix is positive semidefinite, but not positive definite, because it has zero eigenvalues.

The matrix has the factorization

J=ATA,A=[111].J=A^TA, \qquad A= \begin{bmatrix} 1&1&1 \end{bmatrix}.J=ATA,A=[1​1​1​].

Indeed, for any vector xxx,

xTJx=∥Ax∥2≥0.x^TJx=\|Ax\|^2\ge 0.xTJx=∥Ax∥2≥0.

Some nonzero vectors are sent to zero by AAA, so their energy is zero rather than positive. This is why JJJ is semidefinite rather than definite.

The same matrix can be understood through its normalized eigenvector. The vector [111]T\begin{bmatrix}1&1&1\end{bmatrix}^T[1​1​1​]T has length 3\sqrt{3}3​, so the corresponding unit vector is 13[111]T\frac{1}{\sqrt{3}}\begin{bmatrix}1&1&1\end{bmatrix}^T3​1​[1​1​1​]T. Its eigenvalue is 333, and the other eigenvalues are zero. This expresses the matrix as a single eigenvector contribution: a rank-one matrix.

For a general matrix AAA, the product ATAA^TAATA is always positive semidefinite because xTATAx=∥Ax∥2x^TA^TAx=\|Ax\|^2xTATAx=∥Ax∥2. It is positive definite exactly when the columns of AAA are independent, so that no nonzero vector xxx satisfies Ax=0Ax=0Ax=0.

Comprehensive review

Positive definiteness is a property of a symmetric matrix that can be understood in several equivalent ways: all eigenvalues are positive; every nonzero vector has positive quadratic energy; the matrix has an appropriate factorization ATAA^TAATA with AAA invertible; all leading principal determinants are positive; and all elimination pivots are positive. These viewpoints are useful in different settings—spectral analysis, energy arguments, factorization, determinant checks, or elimination.

The energy viewpoint also connects linear algebra to optimization. A positive-definite quadratic forms a bowl, and its eigenvalues determine the bowl’s shape. A circular bowl supports direct descent toward its center, while a narrow bowl can slow gradient descent. Positive-semidefinite matrices mark the boundary case: their energy cannot be negative, but it may be zero along some nonzero directions.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent