Unit 6, lesson 28

Positive Definite Matrices and Cholesky Factorization

What positive definite and semidefinite matrices are, how completing the square and the Schur complement build the Cholesky factorization, and why leading principal minors test a Hermitian matrix for positive definiteness.

  • Video 28
  • Inertia and Positive Definite Factorization

The real forms x12+6x1x2+10x22x_1^2 + 6x_1x_2 + 10x_2^2 and x12+6x1x2+8x22x_1^2 + 6x_1x_2 + 8x_2^2 look almost the same, with positive coefficients on both squares and the same cross term. Completing the square tells them apart. The first equals (x1+3x2)2+x22(x_1 + 3x_2)^2 + x_2^2 and is positive at every nonzero point, while the second equals (x1+3x2)2−x22(x_1 + 3x_2)^2 - x_2^2 and takes the value −1-1 at (−3,1)(-3, 1). This lesson turns that square completion into the Cholesky factorization A=R∗RA = R^{*}R of every positive definite matrix, with a unique upper triangular factor whose diagonal entries are positive, and into a determinant test for positive definiteness.

Key terms

Positive definite matrix

Definition Let F\mathbb{F} be R\mathbb{R} or C\mathbb{C}. A matrix A∈Fn×nA \in \mathbb{F}^{n \times n} is positive definite if it is Hermitian (real symmetric when F=R\mathbb{F} = \mathbb{R}) and

x∗Ax>0for every nonzero x∈Fn.\begin{gathered} x^{*}Ax > 0 \\[0.4em] \text{for every nonzero } x \in \mathbb{F}^n. \end{gathered}

For a Hermitian AA the following are equivalent. The matrix is positive definite. Every eigenvalue of AA is positive. The inertia of AA is (n,0,0)(n, 0, 0). The matrix equals B∗BB^{*}B for some invertible B∈Fn×nB \in \mathbb{F}^{n \times n}. A positive definite matrix is invertible, its diagonal entries aii=ei∗Aeia_{ii} = e_i^{*}Ae_i are positive, and each leading block, formed by the first kk rows and the first kk columns, is again positive definite, as one sees by testing AA on vectors whose last n−kn - k coordinates are 00. Over R\mathbb{R} the symmetry is part of the definition, because xTAxx^{\mathsf{T}}Ax only detects the symmetric part of AA.

In plain words The form of a positive definite matrix is a bowl. Every direction away from the origin goes up.

Example The matrix

A=[13310]A = \begin{bmatrix} 1 & 3 \\ 3 & 10 \end{bmatrix}

from the opening is positive definite, because xTAx=(x1+3x2)2+x22x^{\mathsf{T}}Ax = (x_1 + 3x_2)^2 + x_2^2 is 00 only when x2=0x_2 = 0 and then x1=0x_1 = 0. The matrix with 88 in place of 1010 is not, although both of its diagonal entries are positive. Positive diagonal entries are necessary, not sufficient.

Positive semidefinite matrix

Definition A matrix A∈Fn×nA \in \mathbb{F}^{n \times n} is positive semidefinite if it is Hermitian and x∗Ax≥0x^{*}Ax \ge 0 for every x∈Fnx \in \mathbb{F}^n. For a Hermitian AA this holds exactly when every eigenvalue is nonnegative, exactly when the inertia is (r,0,n−r)(r, 0, n - r) with r=rank⁡Ar = \operatorname{rank} A, and exactly when A=B∗BA = B^{*}B for some matrix BB with nn columns. The eigenvalue test needs the Hermitian hypothesis, since the real matrix with rows (1,4)(1, 4) and (0,1)(0, 1) has both eigenvalues equal to 11, but its form takes the value −2-2 at (1,−1)(1, -1). For a positive semidefinite matrix the form vanishes exactly on the kernel, since 0=x∗B∗Bx=∥Bx∥20 = x^{*}B^{*}Bx = \lVert Bx \rVert^2 forces Bx=0Bx = 0 and hence Ax=0Ax = 0. A positive semidefinite matrix is positive definite exactly when it is invertible. A singular one has no factorization A=R∗RA = R^{*}R with RR triangular and every diagonal entry positive, because such a factor would give det⁡A=∣det⁡R∣2>0\det A = \lvert \det R \rvert^2 > 0. An indefinite Hermitian matrix has no factorization A=B∗BA = B^{*}B at all, since x∗B∗Bx=∥Bx∥2x^{*}B^{*}Bx = \lVert Bx \rVert^2 is never negative.

In plain words A positive semidefinite form never dips below zero, but it may stay flat along some directions, and those flat directions are exactly the kernel.

Example The all-ones matrix

J=[1111]J = \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}

has form ∣x1+x2∣2≥0\lvert x_1 + x_2 \rvert^2 \ge 0, eigenvalues 22 and 00, and inertia (1,0,1)(1, 0, 1). Its value is 00 at (1,−1)(1, -1), which lies in the kernel. It factors as J=RTRJ = R^{\mathsf{T}}R with RR having rows (1,1)(1, 1) and (0,0)(0, 0), so the second diagonal entry is 00. Triangular factors of singular matrices can also fail to be unique even with a nonnegative diagonal. For diag⁡(0,1)\operatorname{diag}(0, 1), both upper triangular matrices with rows (0,0),(0,1)(0, 0), (0, 1) and with rows (0,1),(0,0)(0, 1), (0, 0) satisfy RTR=diag⁡(0,1)R^{\mathsf{T}}R = \operatorname{diag}(0, 1).

Completing the square

Definition Let A∈Fn×nA \in \mathbb{F}^{n \times n} be Hermitian with first diagonal entry a≠0a \ne 0, which is real because AA is Hermitian, and write

A=[ab∗bC]A = \begin{bmatrix} a & b^{*} \\ b & C \end{bmatrix}

with b∈Fn−1b \in \mathbb{F}^{n-1} and C∈F(n−1)×(n−1)C \in \mathbb{F}^{(n-1) \times (n-1)} Hermitian. Split an input as x=(x1,y)x = (x_1, y) with x1∈Fx_1 \in \mathbb{F} and y∈Fn−1y \in \mathbb{F}^{n-1}. Then

x∗Ax=a∣x1∣2+x1‾ b∗y+y∗b x1+y∗Cy=a∣x1+b∗ya∣2+y∗Sy,\begin{aligned} x^{*}Ax &= a\lvert x_1 \rvert^2 + \overline{x_1}\,b^{*}y \\[0.4em] &\quad + y^{*}b\,x_1 + y^{*}Cy \\[0.4em] &= a\left\lvert x_1 + \frac{b^{*}y}{a} \right\rvert^2 + y^{*}Sy, \end{aligned}

where S=C−bb∗/aS = C - bb^{*}/a. To check the last line, expand the square and use that the conjugate of the scalar b∗yb^{*}y is y∗by^{*}b. Every appearance of x1x_1 is now inside one square, and the rest is a form in yy alone. Repeating the step on SS, as long as the pivots are nonzero, writes x∗Axx^{*}Ax as a sum of real multiples of squared absolute values of triangular combinations of the coordinates.

In plain words Collect every term that contains the first coordinate into one perfect square. What is left over is a smaller quadratic form in the remaining coordinates, and you repeat.

Example For the matrix with rows (9,3)(9, 3) and (3,5)(3, 5) the first pivot is a=9a = 9, and

9x12+6x1x2+5x22=9(x1+13x2)2+4x22=(3x1+x2)2+(2x2)2.\begin{aligned} &9x_1^2 + 6x_1x_2 + 5x_2^2 \\[0.4em] &\quad = 9\left(x_1 + \tfrac{1}{3}x_2\right)^2 + 4x_2^2 \\[0.4em] &\quad = (3x_1 + x_2)^2 + (2x_2)^2. \end{aligned}

The leftover coefficient is 5−32/9=45 - 3^2/9 = 4. Both squares have positive weight, so the form is positive definite, and the last line says xTAx=∥Rx∥2x^{\mathsf{T}}Ax = \lVert Rx \rVert^2 for the triangular matrix RR with rows (3,1)(3, 1) and (0,2)(0, 2).

Schur complement

Definition For a Hermitian AA partitioned as in the previous card, with first diagonal entry a≠0a \ne 0, the Schur complement of the entry aa is the (n−1)×(n−1)(n-1) \times (n-1) Hermitian matrix

S=C−1a bb∗.S = C - \frac{1}{a}\,bb^{*}.

It is exactly what Gaussian elimination leaves in the lower right block after the first column is cleared below the pivot, by subtracting bi/ab_i/a times the first row from row i+1i + 1. That elimination does not change determinants and produces a block triangular matrix with diagonal blocks aa and SS, so det⁡A=adet⁡S\det A = a \det S. The same step inside the leading block of size k+1k + 1 shows that its determinant is aa times the determinant of the leading k×kk \times k block of SS. If AA is positive definite, then a=e1∗Ae1>0a = e_1^{*}Ae_1 > 0 and SS is positive definite. Indeed, for y≠0y \ne 0 choose x1=−b∗y/ax_1 = -b^{*}y/a. The square then vanishes, the input x=(x1,y)x = (x_1, y) is nonzero, and the identity from completing the square gives y∗Sy=x∗Ax>0y^{*}Sy = x^{*}Ax > 0.

In plain words The Schur complement is the smaller matrix left after one step of elimination. It holds the part of the form that has not yet been written as a square, and positive definiteness passes down to it.

Example For

A=[42−2251−213]A = \begin{bmatrix} 4 & 2 & -2 \\ 2 & 5 & 1 \\ -2 & 1 & 3 \end{bmatrix}

we have a=4a = 4 and b=(2,−2)b = (2, -2), so

S=[5113]−14[4−4−44]=[4222].\begin{aligned} S &= \begin{bmatrix} 5 & 1 \\ 1 & 3 \end{bmatrix} - \frac{1}{4}\begin{bmatrix} 4 & -4 \\ -4 & 4 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} 4 & 2 \\ 2 & 2 \end{bmatrix}. \end{aligned}

Then det⁡S=4\det S = 4 and det⁡A=4⋅4=16\det A = 4 \cdot 4 = 16.

Cholesky factorization

Definition Let F\mathbb{F} be R\mathbb{R} or C\mathbb{C}, and let A∈Fn×nA \in \mathbb{F}^{n \times n} be positive definite. Then there is exactly one upper triangular R∈Fn×nR \in \mathbb{F}^{n \times n} with real positive diagonal entries such that

A=R∗R.A = R^{*}R.

When F=R\mathbb{F} = \mathbb{R} the factor is real and A=RTRA = R^{\mathsf{T}}R. Many books write the same factorization as A=LL∗A = LL^{*} with L=R∗L = R^{*} lower triangular. Existence follows by induction on nn. For n=1n = 1 take R=aR = \sqrt{a}. For n>1n > 1 the Schur complement SS is positive definite of size n−1n - 1, so S=R~∗R~S = \tilde{R}^{*}\tilde{R} with R~\tilde{R} upper triangular with positive diagonal, and

R=[ab∗/a0R~]R = \begin{bmatrix} \sqrt{a} & b^{*}/\sqrt{a} \\ 0 & \tilde{R} \end{bmatrix}

satisfies R∗R=AR^{*}R = A, since its lower right block is bb∗/a+R~∗R~=Cbb^{*}/a + \tilde{R}^{*}\tilde{R} = C. For uniqueness, any such factor has r112=ar_{11}^2 = a with r11>0r_{11} > 0, so r11=ar_{11} = \sqrt{a}. The first row equations r11r1j=a1jr_{11}r_{1j} = a_{1j} then force the rest of the first row to be b∗/ab^{*}/\sqrt{a}, and the remaining block must factor the same SS, which by induction has only one such factor. The positive diagonal is what pins the factor down. Multiplying the rows of RR by signs, or over C\mathbb{C} by complex numbers of modulus 11, gives other triangular factors. Conversely, every A=R∗RA = R^{*}R with RR invertible is positive definite, because x∗Ax=∥Rx∥2x^{*}Ax = \lVert Rx \rVert^2.

In plain words Completing squares one coordinate at a time builds RR row by row, and the form becomes a sum of squares, x∗Ax=∥Rx∥2x^{*}Ax = \lVert Rx \rVert^2. Each row of RR holds the coefficients inside one completed square, multiplied by the square root of its pivot.

Example For the 3×33 \times 3 matrix AA above, the first row of RR is (4,2/2,−2/2)=(2,1,−1)(\sqrt{4}, 2/2, -2/2) = (2, 1, -1). The Schur complement SS, with rows (4,2)(4, 2) and (2,2)(2, 2), contributes the row (4,2/2)=(2,1)(\sqrt{4}, 2/2) = (2, 1), and its own Schur complement is 2−22/4=12 - 2^2/4 = 1, with square root 11. So

R=[21−1021001],R = \begin{bmatrix} 2 & 1 & -1 \\ 0 & 2 & 1 \\ 0 & 0 & 1 \end{bmatrix},

and multiplying out RTRR^{\mathsf{T}}R returns AA. As a sum of squares,

xTAx=(2x1+x2−x3)2+(2x2+x3)2+x32.\begin{aligned} x^{\mathsf{T}}Ax &= (2x_1 + x_2 - x_3)^2 \\[0.4em] &\quad + (2x_2 + x_3)^2 + x_3^2. \end{aligned}

Changing the sign of the first row of RR gives another triangular factor, but its first diagonal entry is −2-2.

Sylvester’s criterion

Definition For A∈Fn×nA \in \mathbb{F}^{n \times n} and 1≤k≤n1 \le k \le n, the leading principal submatrix AkA_k is the k×kk \times k block in the first kk rows and the same first kk columns, and the leading principal minor is Δk=det⁡Ak\Delta_k = \det A_k, with Δ0=1\Delta_0 = 1. Sylvester’s criterion says that a Hermitian matrix AA is positive definite if and only if

Δk>0for k=1,…,n.\Delta_k > 0 \qquad \text{for } k = 1, \dots, n.

If AA is positive definite, each AkA_k is positive definite, so Ak=Rk∗RkA_k = R_k^{*}R_k and Δk=∣det⁡Rk∣2>0\Delta_k = \lvert \det R_k \rvert^2 > 0. Conversely, Δ1=a>0\Delta_1 = a > 0, and the Schur complement step gives Δk+1=adet⁡Sk\Delta_{k+1} = a \det S_k, where SkS_k is the leading k×kk \times k block of SS. So every leading principal minor of SS is positive, SS is positive definite by induction, and the identity from completing the square gives x∗Ax>0x^{*}Ax > 0 for every x≠0x \ne 0. Because Ak=Rk∗RkA_k = R_k^{*}R_k with RkR_k the leading block of the Cholesky factor, the pivots satisfy

rkk2=ΔkΔk−1.r_{kk}^2 = \frac{\Delta_k}{\Delta_{k-1}}.

The hypotheses matter. The real matrix with rows (1,−3)(1, -3) and (0,1)(0, 1) has Δ1=Δ2=1\Delta_1 = \Delta_2 = 1, but it is not symmetric and its form x12−3x1x2+x22x_1^2 - 3x_1x_2 + x_2^2 equals −1-1 at (1,1)(1, 1). The criterion also has no semidefinite version with leading minors alone. The matrix diag⁡(0,−1)\operatorname{diag}(0, -1) has Δ1=Δ2=0\Delta_1 = \Delta_2 = 0, yet its form is −1-1 at e2e_2. A Hermitian matrix is positive semidefinite exactly when all of its principal minors, taken from any set of rows and the same set of columns, are nonnegative.

In plain words For a Hermitian matrix, positive definiteness can be read from nn determinants taken from the top left corner outward. When the matrix is positive definite, each ratio of consecutive minors is a pivot of the square completion.

Example For the 3×33 \times 3 matrix AA above, Δ1=4\Delta_1 = 4, Δ2=4⋅5−2⋅2=16\Delta_2 = 4 \cdot 5 - 2 \cdot 2 = 16 and Δ3=det⁡A=16\Delta_3 = \det A = 16, all positive, so AA is positive definite. The ratios 4/14/1, 16/416/4 and 16/1616/16 equal 44, 44 and 11, the squares of the diagonal entries 22, 22 and 11 of RR. By contrast, the matrix with rows (1,2)(1, 2) and (2,1)(2, 1) has Δ1=1\Delta_1 = 1 and Δ2=−3\Delta_2 = -3, so it is not positive definite.

Check yourself

  1. Find the Cholesky factor of the matrix with rows (4,−2)(4, -2) and (−2,10)(-2, 10), and check it against the leading principal minors.
Show the answer

The first pivot gives r11=4=2r_{11} = \sqrt{4} = 2 and then r12=−2/2=−1r_{12} = -2/2 = -1. The Schur complement is 10−(−2)2/4=910 - (-2)^2/4 = 9, so r22=3r_{22} = 3 and

R=[2−103].R = \begin{bmatrix} 2 & -1 \\ 0 & 3 \end{bmatrix}.

Multiplying, RTRR^{\mathsf{T}}R has entries 44, −2-2, −2-2 and 1+9=101 + 9 = 10, which is the matrix. The leading minors are Δ1=4\Delta_1 = 4 and Δ2=40−4=36\Delta_2 = 40 - 4 = 36, and the ratios 44 and 36/4=936/4 = 9 are r112r_{11}^2 and r222r_{22}^2.

  1. For which real numbers cc is the matrix with rows (2,c)(2, c) and (c,8)(c, 8) positive definite? What happens at c=4c = 4?
Show the answer

The matrix is symmetric for every real cc, so Sylvester’s criterion applies. The minors are Δ1=2>0\Delta_1 = 2 > 0 and Δ2=16−c2\Delta_2 = 16 - c^2, so the matrix is positive definite exactly when −4<c<4-4 < c < 4.

At c=4c = 4 the form is

2x12+8x1x2+8x22=2(x1+2x2)2,\begin{aligned} &2x_1^2 + 8x_1x_2 + 8x_2^2 \\[0.4em] &\quad = 2(x_1 + 2x_2)^2, \end{aligned}

which is never negative, so the matrix is positive semidefinite but not positive definite. The form vanishes at (2,−1)(2, -1), and that vector is in the kernel. The Cholesky steps give r11=2r_{11} = \sqrt{2} and r12=4/2=22r_{12} = 4/\sqrt{2} = 2\sqrt{2}, and then r222=8−8=0r_{22}^2 = 8 - 8 = 0, so the last pivot is 00 and no factor with positive diagonal exists. For ∣c∣>4\lvert c \rvert > 4 the determinant is negative, so the eigenvalues have opposite signs and the matrix is indefinite.

  1. Find the Schur complement and the Cholesky factor of the complex Hermitian matrix below, check Sylvester’s criterion, and explain why RTRR^{\mathsf{T}}R is not the matrix.
A=[42+2i2−2i6]A = \begin{bmatrix} 4 & 2 + 2i \\ 2 - 2i & 6 \end{bmatrix}
Show the answer

Here a=4a = 4, the column below it is b=2−2ib = 2 - 2i, and b∗=2+2ib^{*} = 2 + 2i. The Schur complement is

S=6−∣2−2i∣24=6−84=4.\begin{aligned} S &= 6 - \frac{\lvert 2 - 2i \rvert^2}{4} \\[0.4em] &= 6 - \frac{8}{4} = 4. \end{aligned}

So r11=2r_{11} = 2, r12=(2+2i)/2=1+ir_{12} = (2 + 2i)/2 = 1 + i and r22=4=2r_{22} = \sqrt{4} = 2, which gives

R=[21+i02],R∗R=[42+2i2−2i∣1+i∣2+4]=A.\begin{aligned} R &= \begin{bmatrix} 2 & 1 + i \\ 0 & 2 \end{bmatrix}, \\[0.4em] R^{*}R &= \begin{bmatrix} 4 & 2 + 2i \\ 2 - 2i & \lvert 1 + i \rvert^2 + 4 \end{bmatrix} \\[0.4em] &= A. \end{aligned}

The minors are Δ1=4\Delta_1 = 4 and Δ2=24−∣2+2i∣2=16\Delta_2 = 24 - \lvert 2 + 2i \rvert^2 = 16, both positive, and 16/4=4=r22216/4 = 4 = r_{22}^2. Without the conjugate, RTRR^{\mathsf{T}}R has lower left entry 2+2i2 + 2i and lower right entry (1+i)2+4=4+2i(1 + i)^2 + 4 = 4 + 2i, so it is not even Hermitian. Over C\mathbb{C} the factorization uses R∗R^{*}.

How this lesson connects

It also uses Gaussian elimination and pivots.