Linear Algebra / Unit 7, Symmetric Matrices / Topic 7.2
Unit 7. Symmetric Matrices
A symmetric matrix A gives a function of a vector, xTAx, which is called a quadratic form. This topic studies the matrices whose quadratic form is positive for each nonzero vector. They are called positive definite matrices. The topic gives four tests for them, and it connects them to ellipses, to the minimum of a function, and to energy in physics.
You need Topics 3.4, 3.6, 5.2, and 7.1 for this topic.
Let A be a symmetric matrix and x a vector. The number xTAx is the dot product of x with Ax. For a 2 by 2 matrix with the rows a, b and b, d, and x = (x, y),
xTAx = ax² + 2bxy + dy²Each term has the total degree 2, which is the reason for the name quadratic form. The diagonal entries are the coefficients of x² and y². The entry b appears twice in the matrix, so the coefficient of xy is 2b.
Put the coefficients of x² and y² on the diagonal, and put half of the coefficient of xy in each of the other two places.
3x² − 4xy + 5y² gives A = 3−2−25With three variables the rule is the same. The coefficient of xz is divided between the entry in row 1, column 3 and the entry in row 3, column 1.
A symmetric matrix A is called positive definite when xTAx is positive for each vector x except the zero vector. The other cases have names as well.
| Name | Values of the form for nonzero vectors | Example of a form |
|---|---|---|
| Positive definite | Always positive | x² + y² |
| Positive semidefinite | Never negative, and zero for some vectors | x², which is zero at (0, 1) |
| Negative definite | Always negative | −x² − 2y² |
| Indefinite | Positive for some vectors and negative for others | x² − y² |
The entries of a positive definite matrix do not all have to be positive, and a matrix with positive entries does not have to be positive definite. Part 3 gives tests that decide.
For a symmetric matrix A, each of the following statements is true exactly when A is positive definite. If one of them is true, all of them are true.
For a 2 by 2 matrix with the rows a, b and b, d, the determinant test reads: a is positive and ad − b² is positive.
For the matrix with the rows 2, 1 and 1, 2, the eigenvalues are 3 and 1. The pivots are 2 and 3/2. The upper left determinants are 2 and 3. All of these numbers are positive, so the matrix is positive definite.
Write A = QΛQT from Topic 7.1, and let y = QTx. The components of y are the components of x along the eigenvectors.
xTAx = xTQΛQTxsubstitute A = QΛQTxTAx = yTΛywith y = QTxxTAx = λ₁y₁² + λ₂y₂² + … + λₙyₙ²Λ is diagonalIn the eigenvector basis the form has no mixed terms. The sum is positive for each nonzero y exactly when each λ is positive.
Elimination on the matrix is the same calculation as completing the square on the form.
2x² + 2xy + 2y² = 2(x + y/2)² + 3/2y²The coefficients 2 and 3/2 outside the squares are the pivots, and the 1/2 inside the first square is the multiplier of the elimination step. A sum of squares with positive coefficients is positive unless both squares are zero, which happens only at x = 0 and y = 0.
For a positive definite matrix, the LU factorization of Topic 3.6 can be arranged as A = LLT, with one lower triangular matrix L. This is called the Cholesky factorization. Computer programs use it as a fast test for a positive definite matrix.
The points where xTAx = 1 form a curve in the plane. In the eigenvector basis the equation is λ₁y₁² + λ₂y₂² = 1.
The eigenvector directions are called the principal axes of the form.
Try it: a quadratic form and its curves
The sliders set the entries of the symmetric matrix with the rows a, b and b, d. The green curve is the set of points where the form is equal to 1, and the dashed red curve is the set where the form is equal to −1. The thin curves are the sets where the form is equal to 4 and 9, or to −4 and −9. The gray lines are the principal axes. Drag the point to read the value of the form there.
For a unit vector x, the components y₁, …, yₙ along the eigenvectors satisfy y₁² + … + yₙ² = 1. The form λ₁y₁² + … + λₙyₙ² is then a weighted average of the eigenvalues.
For the example, the form on unit vectors takes the values from 1 to 3.
Quantum mechanics uses the same fact. The average result of an energy measurement is a quadratic form in the state, and it can never be below the smallest eigenvalue of the energy matrix. Topic 9.3 develops this.
Near a point where both first derivatives of a function f(x, y) are zero, the function behaves like a quadratic form. The matrix of the form holds the second derivatives.
H = fxxfxyfxyfyyThe second derivative test of calculus is the determinant test of Part 3: a minimum needs a positive fxx and a positive fxxfyy − fxy².
In physics, the potential energy of a system near a stable equilibrium is a quadratic form (1/2)xTKx, where x holds the displacements and K is a symmetric matrix of spring constants. The equilibrium is stable when K is positive definite, because each displacement then raises the energy. The kinetic energy (1/2)vTMv is a quadratic form in the velocities with a positive definite matrix of masses.
For any matrix A, with any number of rows, the matrix ATA is symmetric. Its quadratic form is a squared length.
xTATAx = (Ax) · (Ax)group the factors as (Ax)T(Ax)xTATAx = |Ax|²the dot product of a vector with itselfA squared length is never negative, so ATA is always positive semidefinite. It is positive definite when Ax is zero only for x = 0, which means that the columns of A are independent. This is the reason that the normal equations of Topic 6.4 have exactly one solution when the columns of A are independent. Topic 7.3 builds on the matrix ATA.
| Fact | Statement |
|---|---|
| Quadratic form | xTAx = ax² + 2bxy + dy² for the rows a, b and b, d |
| Positive definite | xTAx is positive for each nonzero x |
| Tests | Positive eigenvalues, positive pivots, positive upper left determinants, or A = BTB with independent columns |
| 2 by 2 test | a is positive and ad − b² is positive |
| Curve xTAx = 1 | An ellipse with the half-lengths 1/√λ along the eigenvectors |
| Values on unit vectors | From the smallest eigenvalue to the largest eigenvalue |
| ATA | Positive semidefinite, and positive definite when the columns of A are independent |
Work each problem on paper first. Then open the answer to check your work.
A = 1334.
det A = 4 − 9 = −5
A negative determinant means one positive eigenvalue and one negative eigenvalue, so the form is indefinite.
Yes. The upper left entry 4 is positive, and the determinant 12 − 1 = 11 is positive.
The upper left entry is 1, which is positive. The determinant is c − 4.
The matrix is positive definite for c greater than 4.
x² + 4xy + 6y² = (x + 2y)² + 2y².
The pivots are 1 and 2. Both are positive, so the form is positive definite.
The form is x² + 4xy + y².
value at (1, 1) = 1 + 4 + 1 = 6value at (1, −1) = 1 − 4 + 1 = −2
The matrix is 5222. From Topic 7.1, its eigenvalues are 6 and 1, with the eigenvectors (2, 1) and (1, −2).
The curve is an ellipse. Its half-length is 1/√6 along (2, 1), and 1 along (1, −2).
The @ sign multiplies a vector by a matrix, and it also takes the dot product of two vectors. The expression x @ A @ x is therefore the number xTAx.
Python
The form 2x² + 2xy + 2y² has the value 2 − 2 + 2 = 2 at the point (1, −1). Now find its value at the point (3, 1).
Python
The instruction np.linalg.eigvalsh gives only the eigenvalues of a symmetric matrix, from the smallest to the largest. The matrix is positive definite when the first number in the result is positive.
Python
The eigenvalues 1 and 3 are positive, so the matrix is positive definite. Now test the matrix with the rows 1, 2 and 2, 1.
Python
One eigenvalue is negative and one is positive, so this matrix is indefinite.
The instruction np.linalg.cholesky writes a positive definite matrix as A = LLT with a lower triangular matrix L. The code below finds L and multiplies the factors again.
Python
The factorization exists only for a positive definite matrix. The next box tries it on the indefinite matrix of Step 2. Press Run to see what Python does.
Python
Python stops with an error that says the matrix is not positive definite. A program can use this instruction as a test.
From Part 7, the matrix BTB is positive definite when the columns of B are independent. The matrix B below has 3 rows and 2 independent columns.
Python
Both eigenvalues are positive. Now change the second column of B so that it is 2 times the first column. The columns are then dependent.
Python
The smaller eigenvalue is now 0, apart from a very small rounding error. The matrix BTB is positive semidefinite, and it is not positive definite.
The code below calculates the form at 360 unit vectors around the unit circle and prints the smallest and the largest value. The instruction np.radians(k) changes the angle of k degrees to radians. From Topic 5.4, the line that starts with for repeats the indented lines. The instruction vals.append adds one more number to the list named vals. The last line rounds the two results to 6 decimal places.
Python
The smallest value is 1 and the largest value is 3, which are the two eigenvalues, as Part 5 states.
This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.
Choose how your answers are checked
1. The quadratic form 3x² + 8xy + 7y² is equal to xT Ax for a symmetric matrix A. Find the entry of A in row 1, column 2.
The coefficient of xy is divided equally between the two entries off the diagonal, so each of them is 8/2 = 4. The matrix has the rows 3, 4 and 4, 7.
2. Which of these matrices is positive definite?
For the second matrix, the upper left entry 2 is positive and the determinant 3 is positive. The first matrix has the determinant −3, so it is indefinite. The third is negative definite. The fourth has the eigenvalue 0, so it is only positive semidefinite.
3. Find the smallest whole number c for which the matrix 233c is positive definite.
The upper left entry 2 is positive. The determinant 2c − 9 must also be positive, so c must be greater than 4.5. The smallest whole number is 5.
4. A symmetric matrix has the eigenvalues 4 and −1. Which word describes its quadratic form?
In the basis of the eigenvectors the form is 4y₁² − y₂². It is positive along the first eigenvector and negative along the second, so it is indefinite.
5. Let A = 3113. Find the largest value of xT Ax over all unit vectors x.
The largest value of the form on unit vectors is the largest eigenvalue. The eigenvalues are 4 and 2, and the value 4 is reached at the unit vector (1, 1)/√2.