Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 33

Symmetric Matrices and Quadratic Forms

Recommended resources

Hello! Welcome to the final lesson in our module on the spectral theory of symmetric matrices.

In our last session, we established a powerful and practical tool: the eigenvalue test. We learned that we can classify a symmetric matrix as positive definite, semi-definite, or indefinite simply by checking the signs of its eigenvalues. We also got a visual preview of how these classifications correspond to different geometric shapes, like bowls and saddles.

Today, we will formalize this connection. Our goal is to relate the definiteness of a symmetric matrix to the properties of the quadratic form it defines. This concept is the bridge between the algebra of matrices and the geometry of multivariable functions. It's a cornerstone of optimization theory, which is the engine that drives training for deep learning models.

1. What is a Quadratic Form?

A quadratic form is a special type of function that contains only second-degree terms. For any symmetric matrix , the function is a quadratic form.

For example, if and , the quadratic form is:

The "definiteness" of the matrix is defined by the behavior of this function. The following video provides an excellent introduction to classifying quadratic forms and visualizing their shapes.

Classifying Quadratic Forms - Linear Algebra - F10

This video introduces the concept of classifying quadratic forms and shows what they look like graphically.

Watch the first five minutes of the video (from 0:00 to 5:06). Pay attention to the definitions of positive definite, semi-definite, and indefinite forms, and how they correspond to the graphs of a 'cup', a 'trough', and a 'saddle'.

As the video explains, we classify the quadratic form as:

  • Positive Definite: if for all non-zero vectors .
  • Positive Semi-definite: if for all .
  • Negative Definite: if for all non-zero vectors .
  • Negative Semi-definite: if for all .
  • Indefinite: if takes on both positive and negative values.

These classifications correspond directly to the shapes you saw in the last lesson.

Quadratic form with a positive definite matrix (top left), a negative definite matrix (top right), a singular yet positive semi-definite matrix (bottom left), and an indefinite matrix (bottom right).

The geometric shapes of various quadratic forms. A positive definite matrix creates a convex 'bowl' (or paraboloid). A positive semi-definite matrix creates a 'trough'. An indefinite matrix creates a 'saddle'. These shapes are determined by the definiteness of the matrix A.


2. The Principal Axis Theorem: Why Eigenvalues Dictate the Shape

So, why does the eigenvalue test from our last lesson work? The connection is revealed through the Principal Axis Theorem, which is a direct application of the Spectral Theorem. It states that we can always find a change of coordinates that simplifies the quadratic form by removing the cross-product terms (like the term in our earlier example).

Here's the logic:

  1. Since is symmetric, we can diagonalize it as , where is a diagonal matrix of eigenvalues and is an orthogonal matrix whose columns are the corresponding eigenvectors.
  2. We substitute this into the quadratic form:
  3. Because is orthogonal, . The operation can be seen as a rotation of the coordinate system. Let's define a new set of coordinates .
  4. The quadratic form in the new coordinates becomes much simpler:

This final expression has no cross-product terms! It's just a weighted sum of squares, where the weights are the eigenvalues of .

The following resource walks through this exact derivation with an example.

ENGG1410F Tutorial Quadratic Forms

These tutorial slides show the practical steps of converting a quadratic expression into its matrix form and then using diagonalization to simplify it.

Read through slides 7 to 10. Slide 8 shows how to construct the symmetric matrix A from a polynomial. Slide 9 contains the key derivation showing how x^T A x becomes y^T D y.

From the simplified form , the connection is clear:

  • If all , then is a sum of positive terms and must be positive. The form is positive definite.
  • If all , then can never be negative. The form is positive semi-definite.
  • If there's a mix of positive and negative , we can choose to isolate either a positive or negative term, making positive or negative. The form is indefinite.
Test your understanding!

A symmetric matrix has eigenvalues and . What is the shape of the graph of the quadratic form ? Is the form positive definite, negative definite, or indefinite?

Show answer

Since the matrix has one positive and one negative eigenvalue, the quadratic form is indefinite. After changing to the eigenvector basis, the form looks like . This is the equation for a saddle shape. It goes up in the direction and down in the direction.


3. Application: Convexity, Loss Functions, and Optimization

This relationship between definiteness and the shape of a quadratic function is not just a geometric curiosity; it's fundamental to optimization, especially in machine learning.

Consider a more general quadratic function, which includes linear and constant terms:

This is a canonical form for many problems. For example, in deep learning, a core task is to minimize a loss function that measures how poorly a model is performing. Near a minimum, many loss functions can be approximated by a quadratic function like this one.

Since you've studied multivariable calculus, you know about using the gradient and the Hessian matrix to analyze functions. For our function :

  • The gradient is .
  • The Hessian matrix (the matrix of second partial derivatives) is simply .

Recall the second derivative test: at a critical point where , the point is a local minimum if the Hessian is positive definite. Here, the Hessian is the constant matrix . This leads to a powerful conclusion:

If the symmetric matrix is positive definite, the quadratic function is convex (it's a "bowl" shape everywhere). This means it has a unique global minimum, which occurs at the point where the gradient is zero, i.e., the solution to .

The following reading explains this connection beautifully.

Understanding Positive Definite Matrices

This article provides a fantastic explanation of why positive definite matrices are central to optimization, using the language of multivariable calculus.

Read the section titled 'Quadratic programming'. It starts with the univariate case f(x) = (1/2)ax^2 - bx + c to build intuition and then extends it to the multivariate case, connecting the positive definiteness of A to the convexity of the function and the existence of a global minimum.

Professor Strang also emphasizes this link to deep learning. This short clip will reinforce the idea.

5. Positive Definite and Semidefinite Matrices

Professor Strang directly connects the 'bowl' shape of a positive definite quadratic form to the concept of a loss function in deep learning.

Watch the segments from 12:22 to 14:37 and 18:38 to 20:00. Notice how he discusses the 'upward bowl' as the ideal shape for a function you want to minimize, and identifies this property as 'convexity'.


Conclusion

Today, we've closed the loop on symmetric matrices and their properties. We moved from the algebraic definition of definiteness () to the practical eigenvalue test, and have now connected it back to the geometric shape of the function that the matrix defines.

Key Takeaways:

  • A quadratic form is a function . Its definiteness classification (e.g., positive definite, indefinite) depends on the sign of its output.
  • The Principal Axis Theorem allows us to simplify any quadratic form into a sum of squares, , by rotating to the eigenvector coordinate system.
  • This simplified form makes it obvious that the signs of the eigenvalues of determine the definiteness of the quadratic form.
  • A positive definite matrix defines a quadratic form that is shaped like a convex "bowl," with a unique minimum at the origin.
  • This property is crucial in optimization: a quadratic objective function is convex and has a unique global minimum if and only if is positive definite.

Preview of the Next Lesson:

Our study so far has heavily relied on symmetric matrices and their special properties, like having real eigenvalues and being diagonalizable. But what about matrices that are rectangular or not symmetric? In our next module, we will introduce the Singular Value Decomposition (SVD). The SVD is a powerful generalization of diagonalization that applies to any matrix and is one of the most important and widely used matrix decompositions in modern data analysis and deep learning.