9 Symmetric Positive Definite Matrices
For some symmetric matrices, the scalar \(\bx^T\bA\bx\) is positive for every nonzero vector. This property will permit a factorization with only one triangular factor and no row interchanges. We first examine what the scalar measures, then construct the factorization by eliminating one variable at a time.
9.1 Positive Quadratic Energy
The expression \(\bx^T\bA\bx\) is called a quadratic form. For a symmetric matrix of order two, it is \[ \begin{align} \bx^T\bA\bx=a_{11}x_1^2+2a_{12}x_1x_2+a_{22}x_2^2. \end{align} \] Positive diagonal entries alone do not ensure positivity of this expression, because the mixed term can have either sign. We require positivity in every direction.
Expand the quadratic forms for \(\begin{pmatrix}2&1\\1&2\end{pmatrix}\) and \(\begin{pmatrix}1&2\\2&1\end{pmatrix}\). For the first, express the result as a sum of positive multiples of squares. For the second, find a vector that makes the result negative. Both matrices have positive diagonal entries. What distinguishes them?
A real matrix \(\bA\in\fR^{n\times n}\) is symmetric positive definite, abbreviated SPD, if \(\bA=\bA^T\) and \[ \begin{align} \bx^T\bA\bx>0 \qquad\text{for every }\bx\neq\bzero. \end{align} \] It is symmetric positive semidefinite if the strict inequality is replaced by \(\bx^T\bA\bx\geq0\).
If \(\bA\) is SPD, then every diagonal entry is positive, every principal submatrix is SPD, and \(\bA\) is nonsingular.
We test positive definiteness with vectors chosen to isolate the desired entries.
The coordinate vector \(\be_i\) is nonzero. Therefore \[ \begin{align} a_{ii}=\be_i^T\bA\be_i>0. \end{align} \]
Let \(I=(i_1,...,i_k)\) be a set of selected indices, and let \(\bB=\bA_{I,I}\). Given nonzero \(\by\in\fR^k\), form \(\bx\in\fR^n\) by placing \(y_j\) in position \(i_j\) and zeros in all other positions. This \(\bx\) is nonzero. Expanding both quadratic forms shows \[ \begin{align} \by^T\bB\by =\sum_{p,q=1}^k y_p a_{i_pi_q}y_q =\bx^T\bA\bx>0. \end{align} \] The submatrix is symmetric because \(a_{i_pi_q}=a_{i_qi_p}\). It is therefore SPD.
If \(\bA\bx=\bzero\) for some nonzero \(\bx\), then \(\bx^T\bA\bx=0\), contradicting positive definiteness. Thus the null space is trivial, and the square matrix is nonsingular.
Let \(\bA\) be SPD and let \(\bP\) be a permutation matrix. Prove directly that \(\bP\bA\bP^T\) is SPD. Then consider \(\bD\bA\bD\) for a nonsingular diagonal matrix \(\bD\). Explain why changing the order or scale of the unknowns in this way preserves positive definiteness.
If \(\bA\) is SPD, then \[ \begin{align} \langle\bx,\by\rangle_{\bA}=\bx^T\bA\by, \qquad \|\bx\|_{\bA}=\sqrt{\bx^T\bA\bx} \end{align} \] define an inner product and its induced norm. The scalar \(\bx^T\bA\bx\) is often called the energy of \(\bx\).
Verify the inner-product axioms directly, identifying the use of symmetry and of positive definiteness. Then obtain the triangle inequality from the inner-product result proved earlier. What fails if \(\bA\) is only positive semidefinite?
For \[ \begin{align} \bA=\begin{pmatrix}4&0\\0&1\end{pmatrix}, \end{align} \] the unit-energy curve is \(4x_1^2+x_2^2=1\). A displacement in the first coordinate costs four times as much energy as the same displacement in the second. A norm chosen this way also expresses which errors matter in the model.
9.2 Cholesky Factorization
Every SPD matrix \(\bA\in\fR^{n\times n}\) has a unique factorization \[ \begin{align} \bA=\bL\bL^T, \end{align} \] where \(\bL\) is lower triangular with positive diagonal entries.
We construct the factor one block at a time. In addition to existence, the positive choice of diagonal will determine each new block uniquely.
We proceed by induction on \(n\). For \(n=1\), \(\bA = (\alpha)\) with \(\alpha > 0\), so \(\bL = (\sqrt{\alpha})\) is the unique positive square root. For the induction step, partition \(\bA \in \fR^{n \times n}\) as \[ \begin{align} \bA = \begin{pmatrix} \alpha & \br^T \\ \br & \bB \end{pmatrix}. \end{align} \] Since \(\bA\) is SPD, \(\alpha = \be_1^T\bA\be_1 > 0\). Set \(\ell_{11} = \sqrt{\alpha}\) and \(\boldsymbol{\ell} = \br / \ell_{11}\). The first diagonal entry \(\alpha\) is positive by testing the quadratic form with the first coordinate vector. Thus its positive square root and all divisions by it are defined.
Form the Schur complement \[ \begin{align} \bS = \bB - \boldsymbol{\ell}\boldsymbol{\ell}^T = \bB - \frac{\br\br^T}{\alpha}. \end{align} \] For any nonzero \(\by \in \fR^{n-1}\), choose \(\bx = (-\boldsymbol{\ell}^T\by / \ell_{11}, \by^T)^T \in \fR^n\). Expanding the quadratic form: \[ \begin{align} \bx^T\bA\bx &= \begin{pmatrix} -\frac{\boldsymbol{\ell}^T\by}{\ell_{11}} \\ \by \end{pmatrix}^T \begin{pmatrix} \alpha & \br^T \\ \br & \bB \end{pmatrix} \begin{pmatrix} -\frac{\boldsymbol{\ell}^T\by}{\ell_{11}} \\ \by \end{pmatrix} \\ &= \alpha\left(\frac{\boldsymbol{\ell}^T\by}{\ell_{11}}\right)^2 - 2\frac{(\boldsymbol{\ell}^T\by)(\br^T\by)}{\ell_{11}} + \by^T\bB\by \\ &= (\boldsymbol{\ell}^T\by)^2 - 2(\boldsymbol{\ell}^T\by)^2 + \by^T\bB\by \\ &= \by^T(\bB - \boldsymbol{\ell}\boldsymbol{\ell}^T)\by = \by^T\bS\by. \end{align} \] Since \(\by \neq \bzero\), the vector \(\bx\) is nonzero, so \(\by^T\bS\by = \bx^T\bA\bx > 0\). Hence \(\bS\) is SPD. By induction, \(\bS = \bK\bK^T\) for a unique lower triangular \(\bK\) with positive diagonal entries. Block multiplication gives \[ \begin{align} \bA = \begin{pmatrix} \ell_{11} & \bzero^T \\ \boldsymbol{\ell} & \bK \end{pmatrix} \begin{pmatrix} \ell_{11} & \boldsymbol{\ell}^T \\ \bzero & \bK^T \end{pmatrix} = \begin{pmatrix} \ell_{11}^2 & \ell_{11}\boldsymbol{\ell}^T \\ \ell_{11}\boldsymbol{\ell} & \boldsymbol{\ell}\boldsymbol{\ell}^T + \bK\bK^T \end{pmatrix} = \begin{pmatrix} \alpha & \br^T \\ \br & \bB \end{pmatrix}. \end{align} \] The positivity of the diagonal requires \(\ell_{11} = \sqrt{\alpha}\), which uniquely fixes \(\boldsymbol{\ell} = \br / \ell_{11}\), and uniqueness of \(\bK\) makes the entire factor \(\bL\) unique.
Complete the block calculation in the proof of the referenced result: verify exactly that \(\bx^T\bA\bx=\by^T\bS\by\). Then prove the converse statement that if \(\alpha>0\) and \(\bS\) is SPD, the block matrix \(\bA\) is SPD.
For a real symmetric matrix \(\bA\), the following statements are equivalent.
\(\bx^T\bA\bx>0\) for every nonzero \(\bx\).
\(\bA=\bL\bL^T\) for a lower triangular \(\bL\) with positive diagonal.
\(\bA=\bW^T\bW\) for a nonsingular matrix \(\bW\).
Every leading principal minor is positive.
We prove the first three equivalences, then connect them to the leading principal minors.
If \(\bA\) is SPD, the Cholesky theorem supplies \(\bA=\bL\bL^T\) with positive diagonal entries. A triangular matrix with nonzero diagonal is nonsingular. Taking \(\bW=\bL^T\) gives the third representation, \(\bA=\bW^T\bW\).
Conversely, suppose \(\bA=\bW^T\bW\) with \(\bW\) nonsingular. A nonzero \(\bx\) cannot have \(\bW\bx=\bzero\). Therefore \[ \begin{align} \bx^T\bA\bx=(\bW\bx)^T(\bW\bx)=\|\bW\bx\|_2^2>0. \end{align} \] This proves positive definiteness and completes the equivalence of statements (1), (2), and (3).
Next suppose \(\bA\) is SPD. Every leading principal block \(\bA_j\) is SPD by the referenced result. Its Cholesky factor has positive diagonal, so \[ \begin{align} \det(\bA_j)=\det(\bL_j)\det(\bL_j^T) =\prod_{i=1}^j\ell_{ii}^2>0. \end{align} \] Thus (1) implies (4).
For the converse, assume every leading principal minor is positive. We use induction on the dimension. For dimension one, this is exactly the positive-definiteness condition. In a larger dimension, write \[ \begin{align} \bA=\begin{pmatrix}\alpha&\br^T\\\br&\bB\end{pmatrix}, \qquad \bS=\bB-\br\br^T/\alpha. \end{align} \] The first leading minor is \(\alpha>0\). For a leading block of size \(j\) in \(\bS\), subtracting \(r_i/\alpha\) times the first row from each lower row of \(\bA_{j+1}\) gives a block upper triangular matrix with diagonal blocks \(\alpha\) and \(\bS_j\). These row subtractions leave the determinant unchanged, so \[ \begin{align} \det(\bS_j)=\frac{\det(\bA_{j+1})}{\alpha}>0. \end{align} \] The Schur complement is symmetric and has positive leading minors. The induction hypothesis makes it SPD.
Finally complete the square for an arbitrary vector \((s,\by^T)^T\): \[ \begin{align} \begin{pmatrix}s\\\by\end{pmatrix}^T\bA\begin{pmatrix}s\\\by\end{pmatrix} &=\alpha s^2+2s\br^T\by+\by^T\bB\by\\ &=\alpha\left(s+\frac{\br^T\by}{\alpha}\right)^2+\by^T\bS\by. \end{align} \] If \(\by\neq\bzero\), the second term is positive. If \(\by=\bzero\) and the full vector is nonzero, then \(s\neq0\) and the first term is positive. Thus \(\bA\) is SPD, proving (4) implies (1). This is Sylvester’s criterion (Meyer 2000; Horn and Johnson 2012).
Let \(\bX\in\fR^{m\times n}\) with \(m\geq n\). Prove that \(\bX^T\bX\) is SPD exactly when the columns of \(\bX\) are linearly independent. State what remains true when they are dependent.
After the spectral theorem is available, one more characterization follows directly. A real symmetric matrix is SPD exactly when all its eigenvalues are positive. The Cholesky argument does not need this fact, so we postpone it and keep the present argument self-contained.
9.3 The Cholesky Algorithm
The entries of the factor in \(\bA=\bL\bL^T\) are computed column by column: \[ \begin{align} \ell_{jj} &=\sqrt{a_{jj}-\sum_{k=1}^{j-1}\ell_{jk}^2},\\ \ell_{ij} &=\frac{a_{ij}-\sum_{k=1}^{j-1}\ell_{ik}\ell_{jk}}{\ell_{jj}}, \qquad i=j+1,...,n. \end{align} \] For an SPD matrix every expression under a square root is positive. A nonpositive pivot signals that the input is not positive definite, apart from the effects of rounding.
We derive one column at a time from the identity \(\bA=\bL\bL^T\).
For \(i\geq j\), triangularity gives \[ \begin{align} a_{ij}=(\bL\bL^T)_{ij} =\sum_{k=1}^n\ell_{ik}\ell_{jk} =\sum_{k=1}^{j}\ell_{ik}\ell_{jk}. \end{align} \] Terms with \(k>j\) vanish because \(\ell_{jk}=0\).
Put \(i=j\) and separate the last term: \[ \begin{align} a_{jj}=\sum_{k=1}^{j-1}\ell_{jk}^2+\ell_{jj}^2. \end{align} \] The Cholesky convention chooses the positive square root, so \[ \begin{align} \ell_{jj}=\sqrt{a_{jj}-\sum_{k=1}^{j-1}\ell_{jk}^2}. \end{align} \] Existence of the Cholesky factor for an SPD matrix ensures that the radicand is strictly positive in exact arithmetic.
For \(i>j\), move the known terms to the other side: \[ \begin{align} a_{ij}-\sum_{k=1}^{j-1}\ell_{ik}\ell_{jk}=\ell_{ij}\ell_{jj}. \end{align} \] Division by \(\ell_{jj}>0\) gives the stated update. All quantities on its right side come from preceding columns or from the diagonal entry just computed.
For \[ \begin{align} \bA=\begin{pmatrix}4&2&-2\\2&10&2\\-2&2&6\end{pmatrix}, \end{align} \] the algorithm gives \[ \begin{align} \ell_{11}=2,&\quad \ell_{21}=1,\quad \ell_{31}=-1,\\ \ell_{22}=3,&\quad \ell_{32}=1,\quad \ell_{33}=2. \end{align} \] Thus \[ \begin{align} \bL=\begin{pmatrix}2&0&0\\1&3&0\\-1&1&2\end{pmatrix}, \qquad \bL\bL^T=\bA. \end{align} \] To solve \(\bA\bx=\bb\), first solve \(\bL\by=\bb\) and then \(\bL^T\bx=\by\).
9.4 Cost and Stability
Dense Cholesky factorization requires \(n^3/3+O(n^2)\) floating-point operations. Only one triangular half of the matrix and factor need be stored. The two triangular solves for one right-hand side require \(2n^2+O(n)\) further operations.
In column \(j\), there are \(n-j+1\) entries on and below the diagonal. Each uses a sum with \(j-1\) products. Counting a multiplication and addition as two operations, the leading inner-product work is \[ \begin{align} 2\sum_{j=1}^n(n-j+1)(j-1). \end{align} \] Set \(k=j-1\). Then \(n-j+1=n-k\), so the sum becomes \[ \begin{align} 2\sum_{k=0}^{n-1}(n-k)k &=2n\sum_{k=0}^{n-1}k-2\sum_{k=0}^{n-1}k^2\\ &=2n\frac{n(n-1)}2-2\frac{(n-1)n(2n-1)}6\\ &=\frac{n^3-n}{3}. \end{align} \] There are at most \(n(n-1)/2\) divisions, \(n\) square roots, and \(O(n^2)\) additional scalar operations. They do not change the cubic leading term. Hence the total is \(n^3/3+O(n^2)\) flops under the usual convention of counting each scalar operation once.
Only the lower triangle of the factor needs to be stored. It contains \(1+2+\cdots+n=n(n+1)/2\) entries.
Cholesky needs no pivoting for an SPD matrix. Moreover, the identity \[ \begin{align} a_{ii}=\sum_{k=1}^i\ell_{ik}^2 \end{align} \] implies \(|\ell_{ik}|\leq\sqrt{a_{ii}}\), so the factor cannot exhibit the element growth possible in general elimination. In standard floating-point arithmetic, and absent overflow or underflow, the computed factor is the exact Cholesky factor of a nearby symmetric matrix. This is the appropriate backward-stability statement. It does not say that an ill-conditioned system has an accurate forward solution.
Once singular values are available, the referenced result gives \[ \begin{align} \kappa_2(\bA)=\frac{\lambda_{\max}(\bA)}{\lambda_{\min}(\bA)}, \qquad \kappa_2(\bL)=\sqrt{\kappa_2(\bA)}. \end{align} \] These are spectral interpretations of structure already visible in the energy and the factorization.
9.5 Sparse Cholesky and the Elimination Graph
For a sparse SPD matrix, the Cholesky factor can have many more nonzero entries than the matrix itself. These new entries are called fill. Fill determines the memory and the arithmetic of a sparse factorization, and it depends strongly on the order in which the unknowns are eliminated. A graph associated with the matrix predicts the fill before any arithmetic is done.
The graph of a symmetric matrix \(\bA\in\fR^{n\times n}\) has vertices \(1,...,n\) and an edge \(\{i,j\}\) for each pair \(i\neq j\) with \(a_{ij}\neq0\). The neighbors of a vertex \(v\) are the vertices joined to \(v\) by an edge, and the degree of \(v\) is the number of its neighbors.
Let \(\bA\) be SPD with graph \(G\), and partition \(\bA\) as in the proof of the referenced result, with first column \((\alpha,\br^T)^T\) and trailing block \(\bB\). The first column of \(\bL\) is nonzero exactly in the rows of the neighbors of vertex \(1\). Apart from exact numerical cancellation, the graph of the Schur complement \(\bS=\bB-\br\br^T/\alpha\) is obtained from \(G\) by deleting vertex \(1\) and joining every pair of its neighbors by an edge.
Partition the matrix around the first variable as \(\bA=\begin{pmatrix}\alpha&\br^T\\\br&\bB\end{pmatrix}\). In its Cholesky factor, the first entry is \(\sqrt\alpha\), and the remaining first-column entries satisfy \(\ell_{i1}\sqrt\alpha=r_i\). Hence \[ \begin{align} \ell_{i1}=r_i/\sqrt\alpha. \end{align} \] Since \(\alpha>0\), this entry is nonzero precisely when \(r_i\) is nonzero. Those positions are the neighbors of the eliminated vertex in the matrix graph.
The remaining factorization acts on the Schur complement \[ \begin{align} \bS=\bB-\frac{\br\br^T}{\alpha},\qquad s_{ij}=b_{ij}-\frac{r_ir_j}{\alpha}. \end{align} \] If \(i,j\) are both neighbors, then \(r_ir_j\neq0\). Even when \(b_{ij}=0\), the update introduces a nonzero entry at that position. Thus elimination can connect every pair of neighbors, forming a clique in the structural graph.
If one of the two vertices is not a neighbor, the corresponding factor \(r_i\) or \(r_j\) is zero and no entry is introduced by this elimination step. Existing nonzero entries may occasionally cancel numerically, so the graph statement concerns the pattern predicted in the absence of cancellation. Repeating this local rule explains fill in the Cholesky factor (Davis 2006).
Consider an SPD matrix of order five whose only off-diagonal nonzeros lie in its first row and column. Its graph is a star. Draw the elimination graphs with the center first and with the center last; count the nonzeros of \(\bL\) in each case, assuming no cancellation.
Applying the referenced result repeatedly describes the whole factorization. Eliminating a vertex turns its remaining neighbors into a clique, and the nonzero pattern of column \(k\) of \(\bL\) is the set of neighbors of vertex \(k\) at the moment it is eliminated. Reordering the unknowns by a permutation \(\bP\) and factoring \(\bP\bA\bP^T\) changes the elimination order and therefore the fill, without changing the solution.
(An arrow matrix) Let \(\bA\) be SPD with nonzero entries only on the diagonal and in the first row and column. Its graph is a star with center \(1\). If the center is eliminated first, its \(n-1\) neighbors become a clique, the Schur complement is full, and \(\bL\) has about \(n^2/2\) nonzero entries. If the center is eliminated last, every leaf has the center as its only neighbor, no edges are added, and \(\bL\) has \(2n-1\) nonzero entries. The two orders give the same solution at costs of \(O(n^3)\) and \(O(n)\) flops.
(Fill-reducing orderings) Finding the ordering with the least fill is NP-complete (Yannakakis 1981), so practical codes use heuristics. The minimum degree heuristic always eliminates a vertex of smallest current degree, which bounds the fill created at each step by the square of that degree. The degrees change after every elimination, and an efficient implementation stores the vertices in a bucket queue, with one doubly linked list of vertices for each degree. Moving a vertex to a new bucket then takes constant time, and the next vertex is found by scanning upward from the lowest nonempty bucket (Davis 2006). Nested dissection instead removes a small set of vertices that separates the graph into two parts, orders the separator last, and recurses on the parts.
Nested dissection determines the cost of sparse Cholesky for the Poisson problem. On an \(N\times N\) grid with \(n=N^2\) unknowns, the natural row-by-row order gives a factor with bandwidth \(N\), so \(\bL\) has about \(n^{3/2}\) nonzero entries and the factorization costs about \(n^2\) flops. Nested dissection with grid lines as separators reduces these to \(O(n\log n)\) nonzero entries and \(O(n^{3/2})\) flops (George 1973). On an \(N\times N\times N\) grid, separators are planes with \(n^{2/3}\) vertices, and nested dissection leaves \(O(n^{4/3})\) nonzero entries and \(O(n^2)\) flops. The growth of the factor with \(n\) is the reason that large three-dimensional problems are solved by the iterative methods of the referenced section.
9.6 Further Exercises
Compute the Cholesky factor of \[ \begin{align} \bA=\begin{pmatrix}9&3&-6\\3&26&-7\\-6&-7&9\end{pmatrix} \end{align} \] by hand, then use it to solve \(\bA\bx=(6,44,2)^T\).
Prove that the largest entry of an SPD matrix in absolute value lies on the main diagonal. Begin with a two by two principal submatrix and choose a useful vector, or use its positive determinant.
Use the referenced result to prove that, apart from cancellation, \(\ell_{ij}\neq0\) for \(i>j\) exactly when \(G\) contains a path from \(i\) to \(j\) whose interior vertices all precede \(j\) in the elimination order.
Assemble the five-point Poisson matrix on an \(N\times N\) grid for \(N=20,40,80\). Factor it with a sparse direct solver using the natural order and a minimum degree order, and report the number of nonzero entries in the factors and the factorization times.
Show that \(\|\bx\|_{\bA}=\|\bL^T\bx\|_2\). Use this identity to interpret the \(\bA\)-unit sphere as the inverse image of the Euclidean unit sphere, without mentioning eigenvalues.