Tutorials › Linear Algebra › Orthogonal Diagonalization of Quadratic Forms

Quadratic Forms and Definiteness · Tutorial 760 of 1000

Orthogonal Diagonalization of Quadratic Forms

Use an orthonormal eigenbasis to rewrite a real symmetric quadratic form with eigenvalues as its weights.

Advanced 10 min read

What You'll Learn

  • Identify the matrix and hypotheses needed for orthogonal diagonalization of a quadratic form.
  • Relate an orthogonal change of coordinates to the matrix equation \(Q^{\top}AQ=D\).
  • Compute eigenvalues, normalized eigenvectors and the resulting squared-coordinate expression.
  • Verify an orthogonal diagonalization and expand the transformed form back to the original coordinates.
  • Avoid reversing the coordinate-change matrices when applying a congruence.

From a Quadratic Form to Orthogonal Coordinates

A quadratic form in \(\mathbb{R}^n\) can look complicated when written in the original coordinates, particularly when its expression contains mixed terms such as \(x_1x_2\). If its matrix is real and symmetric, the Spectral Theorem supplies an orthonormal basis of eigenvectors. Using those vectors as coordinate axes removes all mixed terms: the form becomes a sum of squared new coordinates, each multiplied by an eigenvalue.

For \(\mathbf{x}\in\mathbb{R}^n\) and a real symmetric matrix \(\mathbf{A}\in\mathbb{R}^{n\times n}\), write the quadratic form as \(q(\mathbf{x})=\mathbf{x}^{\top}\mathbf{A}\mathbf{x}\). An orthogonal matrix \(\mathbf{Q}\) is a square matrix whose columns are orthonormal; equivalently, \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{Q}\mathbf{Q}^{\top}=\mathbf{I}_n\). Its columns can be used as a new orthonormal coordinate system.

Definition: An orthogonal change of coordinates is a substitution \(\mathbf{x}=\mathbf{Q}\mathbf{y}\), where \(\mathbf{Q}\) is orthogonal. The new coordinate vector is \(\mathbf{y}=\mathbf{Q}^{\top}\mathbf{x}\). A quadratic form has an orthogonal diagonalization if, in these coordinates, it is \(\mathbf{y}^{\top}\mathbf{D}\mathbf{y}\) for a diagonal matrix \(\mathbf{D}\).

The distinction between the two coordinate vectors matters: \(\mathbf{x}=\mathbf{Q}\mathbf{y}\) expresses the original vector using the new coordinates, whereas \(\mathbf{y}=\mathbf{Q}^{\top}\mathbf{x}\) extracts those coordinates from the original vector. Substitution into the form gives the matrix \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}\). This is a congruence transformation, and in this setting it will be diagonal.

The Spectral Theorem and the Form of the Answer

Theorem (Orthogonal diagonalization of a quadratic form): Let \(\mathbf{A}\in\mathbb{R}^{n\times n}\) be symmetric. There is an orthogonal matrix \(\mathbf{Q}\) whose columns are unit eigenvectors of \(\mathbf{A}\), and a real diagonal matrix \(\mathbf{D}=\operatorname{diag}(\lambda_1,\dots,\lambda_n)\), such that \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{D}\). For \(\mathbf{x}=\mathbf{Q}\mathbf{y}\), the quadratic form satisfies \(q(\mathbf{x})=\sum_{i=1}^{n}\lambda_i y_i^2\). Conversely, a real matrix that can be written as \(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\), with \(\mathbf{Q}\) orthogonal and \(\mathbf{D}\) real diagonal, is symmetric.

Proof. The Spectral Theorem for finite-dimensional real symmetric matrices states that \(\mathbf{A}\) has an orthonormal basis of real eigenvectors. This is the earlier result being used here; it requires that \(\mathbf{A}\) be real and symmetric. Put those unit eigenvectors into the columns of \(\mathbf{Q}\), and put their corresponding eigenvalues \(\lambda_1,\dots,\lambda_n\) along the diagonal of \(\mathbf{D}\). Orthonormality gives \(\mathbf{Q}^{\top}\mathbf{Q}=\mathbf{I}_n\), and the eigenvector equations give \(\mathbf{A}\mathbf{Q}=\mathbf{Q}\mathbf{D}\). Multiplying on the left by \(\mathbf{Q}^{\top}\) proves \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{D}\). Now substitute \(\mathbf{x}=\mathbf{Q}\mathbf{y}\) into the quadratic form: \(\mathbf{x}^{\top}\mathbf{A}\mathbf{x}=(\mathbf{Q}\mathbf{y})^{\top}\mathbf{A}(\mathbf{Q}\mathbf{y})=\mathbf{y}^{\top}(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q})\mathbf{y}=\mathbf{y}^{\top}\mathbf{D}\mathbf{y}=\sum_{i=1}^{n}\lambda_i y_i^2\). For the converse, if \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\), then \(\mathbf{A}^{\top}=(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top})^{\top}=\mathbf{Q}\mathbf{D}^{\top}\mathbf{Q}^{\top}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}=\mathbf{A}\), since \(\mathbf{D}\) is diagonal and hence symmetric. \(\square\)

The numbers \(\lambda_i\) are the eigenvalues, and \(y_i\) is the coordinate of \(\mathbf{x}\) in the direction of the corresponding unit eigenvector. Thus each term in the new expression is the eigenvalue weight times the square of a coordinate. A zero eigenvalue contributes a zero term. If an eigenvalue is repeated, any orthonormal basis of its eigenspace can be used for the corresponding columns of \(\mathbf{Q}\); the diagonal entries for those columns are the same repeated eigenvalue.

Worked Examples

Worked Example: A Two-Variable Form with a Zero Eigenvalue

Orthogonally diagonalize \(q(\mathbf{x})=\mathbf{x}^{\top}\mathbf{A}\mathbf{x}\) for \(\mathbf{A}=\begin{bmatrix}4&2\\2&1\end{bmatrix}\), and express the answer in new coordinates.

The matrix is symmetric. Its characteristic equation is

$$ \det(\mathbf{A}-\lambda\mathbf{I}_2) =(4-\lambda)(1-\lambda)-4 =\lambda^2-5\lambda =\lambda(\lambda-5). $$

The eigenvalues are \(5\) and \(0\). For \(\lambda=5\), the vector \((2,1)^{\top}\) is an eigenvector because \(\mathbf{A}(2,1)^{\top}=(10,5)^{\top}=5(2,1)^{\top}\). For \(\lambda=0\), \((-1,2)^{\top}\) is an eigenvector because \(\mathbf{A}(-1,2)^{\top}=(0,0)^{\top}\). Each vector has length \(\sqrt{5}\), and their dot product is \(-2+2=0\). Therefore the columns of

$$ \mathbf{Q}=\frac{1}{\sqrt{5}} \begin{bmatrix}2&-1\\1&2\end{bmatrix} $$

are orthonormal. Let \(\mathbf{D}=\begin{bmatrix}5&0\\0&0\end{bmatrix}\). The eigenvector equations give \(\mathbf{A}\mathbf{Q}=\mathbf{Q}\mathbf{D}\), so \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{D}\). With \(\mathbf{x}=\mathbf{Q}\mathbf{y}\), the new coordinates are \(y_1=(2x_1+x_2)/\sqrt{5}\) and \(y_2=(-x_1+2x_2)/\sqrt{5}\), and the form is \(5y_1^2+0y_2^2\).

Check: \(5y_1^2=5(2x_1+x_2)^2/5=(2x_1+x_2)^2=4x_1^2+4x_1x_2+x_2^2\). Directly, \(\mathbf{x}^{\top}\mathbf{A}\mathbf{x}=4x_1^2+4x_1x_2+x_2^2\), so the transformed expression agrees with the original form.

Worked Example: Removing a Mixed Term in Three Variables

For \(\mathbf{A}=\begin{bmatrix}1&2&0\\2&1&0\\0&0&2\end{bmatrix}\), find an orthogonal diagonalization and write the quadratic form using the new coordinates.

The matrix is real and symmetric. The vectors \((1,1,0)^{\top}\), \((1,-1,0)^{\top}\), and \((0,0,1)^{\top}\) are mutually orthogonal. Multiplication gives \(\mathbf{A}(1,1,0)^{\top}=(3,3,0)^{\top}\), \(\mathbf{A}(1,-1,0)^{\top}=(-1,1,0)^{\top}\), and \(\mathbf{A}(0,0,1)^{\top}=(0,0,2)^{\top}\). Thus their eigenvalues are \(3,-1,2\), respectively. Normalizing the first two vectors gives

$$ \mathbf{Q}= \begin{bmatrix} 1/\sqrt{2}&1/\sqrt{2}&0\\ 1/\sqrt{2}&-1/\sqrt{2}&0\\ 0&0&1 \end{bmatrix}, \qquad \mathbf{D}= \begin{bmatrix}3&0&0\\0&-1&0\\0&0&2\end{bmatrix}. $$

The columns of \(\mathbf{Q}\) are orthonormal, so \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{D}\). From \(\mathbf{y}=\mathbf{Q}^{\top}\mathbf{x}\), we have \(y_1=(x_1+x_2)/\sqrt{2}\), \(y_2=(x_1-x_2)/\sqrt{2}\), and \(y_3=x_3\). Therefore \(q(\mathbf{x})=3y_1^2-y_2^2+2y_3^2\).

Check: Expanding the new expression gives \(\frac{3}{2}(x_1+x_2)^2-\frac{1}{2}(x_1-x_2)^2+2x_3^2=x_1^2+4x_1x_2+x_2^2+2x_3^2\). Multiplication by the original matrix gives \(\mathbf{x}^{\top}\mathbf{A}\mathbf{x}=x_1^2+4x_1x_2+x_2^2+2x_3^2\), as required.

Worked Example: A Rotated Eigenbasis

Suppose the orthonormal eigenvectors are the columns of \(\mathbf{Q}=\frac15\begin{bmatrix}3&-4\\4&3\end{bmatrix}\), with eigenvalues \(2\) and \(-1\). Find the original matrix and the quadratic form in both coordinate systems.

The columns have squared lengths \((9+16)/25=1\) and dot product \((-12+12)/25=0\). Thus \(\mathbf{Q}\) is orthogonal. Set \(\mathbf{D}=\begin{bmatrix}2&0\\0&-1\end{bmatrix}\). The original matrix is \(\mathbf{A}=\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\). Multiplying gives

$$ \mathbf{A} =\frac{1}{25} \begin{bmatrix}18&24\\24&32\end{bmatrix} -\frac{1}{25} \begin{bmatrix}16&-12\\-12&9\end{bmatrix} =\frac{1}{25} \begin{bmatrix}2&36\\36&23\end{bmatrix}. $$

Consequently \(q(\mathbf{x})=\frac{2}{25}x_1^2+\frac{72}{25}x_1x_2+\frac{23}{25}x_2^2\). The new coordinates are \(y_1=(3x_1+4x_2)/5\) and \(y_2=(-4x_1+3x_2)/5\), so the diagonal expression is \(2y_1^2-y_2^2\).

Check: Expanding gives \(\frac{2}{25}(3x_1+4x_2)^2-\frac{1}{25}(-4x_1+3x_2)^2=\frac{2}{25}x_1^2+\frac{72}{25}x_1x_2+\frac{23}{25}x_2^2\). This is exactly \(\mathbf{x}^{\top}\mathbf{A}\mathbf{x}\). The eigenpairs also check directly: \(\mathbf{A}(3,4)^{\top}=(6,8)^{\top}=2(3,4)^{\top}\), and \(\mathbf{A}(-4,3)^{\top}=(4,-3)^{\top}=-1(-4,3)^{\top}\).

A Reliable Calculation and a Common Pitfall

For a concrete symmetric matrix, the calculation follows a short sequence. First find its eigenvalues and an eigenvector for each eigenvalue. Next normalize the eigenvectors and place them as columns of \(\mathbf{Q}\). For a symmetric matrix, eigenvectors belonging to distinct eigenvalues are orthogonal; when an eigenvalue is repeated, choose an orthonormal basis within its eigenspace. Then form \(\mathbf{D}\) from the eigenvalues in the same order as the columns of \(\mathbf{Q}\), and use \(\mathbf{y}=\mathbf{Q}^{\top}\mathbf{x}\) to obtain the new coordinates.

1
Find eigenpairs.
Compute the eigenvalues of the real symmetric matrix and solve for eigenvectors.
2
Build an orthonormal eigenbasis.
Normalize the eigenvectors and place them as the columns of \(\mathbf{Q}\).
3
Match the diagonal entries.
Put each eigenvalue in \(\mathbf{D}\) in the same order as its eigenvector in \(\mathbf{Q}\).
4
Change coordinates and verify.
Use \(\mathbf{y}=\mathbf{Q}^{\top}\mathbf{x}\), then check both \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\mathbf{D}\) and the expanded quadratic form.

Common mistake: reversing the two copies of \(\mathbf{Q}\). The coordinate substitution \(\mathbf{x}=\mathbf{Q}\mathbf{y}\) gives \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}\), not \(\mathbf{Q}\mathbf{A}\mathbf{Q}^{\top}\). For the first example, the correct product is \(\mathbf{Q}^{\top}\mathbf{A}\mathbf{Q}=\begin{bmatrix}5&0\\0&0\end{bmatrix}\). Using the reversed product instead gives \(\mathbf{Q}\mathbf{A}\mathbf{Q}^{\top}=\frac15\begin{bmatrix}9&12\\12&16\end{bmatrix}\), which is not diagonal. That calculation does not express the form in the coordinates \(\mathbf{y}=\mathbf{Q}^{\top}\mathbf{x}\); the correction is to substitute \(\mathbf{x}=\mathbf{Q}\mathbf{y}\) into \(\mathbf{x}^{\top}\mathbf{A}\mathbf{x}\) and preserve the resulting order.

What the Diagonal Expression Tells You

Orthogonal diagonalization identifies the directions along which the form has its separate squared-coordinate contributions. In the new coordinates, there are no products \(y_i y_j\) with \(i\ne j\); all contributions appear as \(\lambda_i y_i^2\). Returning to the original coordinates simply rotates or reflects those axes, since the columns of \(\mathbf{Q}\) are orthonormal. The eigenvalues are therefore not just entries produced by a matrix computation: they are the weights attached to the form along its orthogonal eigenvector directions.

This representation also provides a direct check on a result. The diagonal entries must match the eigenvalues corresponding to the columns of \(\mathbf{Q}\), and expanding \(\sum_i\lambda_i y_i^2\) must recover the original expression. These checks catch mismatched eigenvalue order, unnormalized eigenvectors, and an incorrectly oriented coordinate substitution. The signs of the weights can be used for further questions about the form, but the task here is the orthogonal coordinate representation itself.

Check Your Understanding

For each question, keep track of which columns of \(\mathbf{Q}\) correspond to which eigenvalues, and verify a computed expression by substitution or expansion.

  1. For \(\mathbf{A}=\begin{bmatrix}2&1\\1&2\end{bmatrix}\), find an orthogonal \(\mathbf{Q}\) and diagonal \(\mathbf{D}\), then write \(q(\mathbf{x})\) in the new coordinates.
  2. If \(\mathbf{Q}\) is orthogonal and \(\mathbf{x}=\mathbf{Q}\mathbf{y}\), derive the matrix of the quadratic form in \(\mathbf{y}\)-coordinates.
  3. For the matrix in the first worked example, calculate \(\mathbf{Q}^{\top}\mathbf{x}\) and \(\mathbf{Q}\mathbf{y}\), and explain which vector contains the new coordinates.
  4. Why must a real matrix of the form \(\mathbf{Q}\mathbf{D}\mathbf{Q}^{\top}\), with \(\mathbf{Q}\) orthogonal and \(\mathbf{D}\) real diagonal, be symmetric?
  5. For a repeated eigenvalue, what condition must the chosen eigenvectors satisfy before they can be used as columns of an orthogonal matrix?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon