- Learn
- Mathematics
- University Math
- Linear Algebra 1
- Symmetric Matrices and Quadratic Forms
Symmetric Matrices and Quadratic Forms
Symmetric Matrices, Quadratic Forms and the SVD
IntermediateLesson 9 of 9 in Linear Algebra 1 Course
What you will learn
- Recognize symmetric and orthogonal matrices, state and use the spectral theorem, compute an orthogonal diagonalization, and write a symmetric matrix as a weighted sum of projections.
- Work with symmetric and orthogonal matricesIdentify symmetric and orthogonal matrices, use their algebraic properties, and show why eigenvectors of a symmetric matrix that belong to different eigenvalues are orthogonal.
- State and apply the spectral theoremKnow exactly what the spectral theorem guarantees for a real symmetric matrix, why the converse holds, and which tempting conclusions do not follow.
- Compute an orthogonal diagonalizationGo from the characteristic polynomial to an orthonormal eigenvector matrix, handle eigenspaces of dimension two or more with Gram–Schmidt, and check the result.
- Write a symmetric matrix as a sum of projectionsExpress a symmetric matrix through its spectral decomposition, a weighted sum of rank-one projection matrices, and use it to compute products, powers and inverses.
- Work with symmetric and orthogonal matrices
- Write quadratic forms with symmetric matrices, remove cross-product terms with an orthogonal change of variable, decide definiteness, and find maximum and minimum values on the unit sphere.
- Write a quadratic form with a symmetric matrixTranslate between a homogeneous quadratic polynomial and the symmetric matrix of the form, evaluate the form, and use its basic properties.
- Remove cross terms with a change of variableUse an orthogonal diagonalization to rewrite a quadratic form without cross-product terms, and describe its level curves and graph through the principal axes.
- Classify forms as definite, semidefinite or indefiniteDecide definiteness with eigenvalues, the 2×2 determinant test, leading principal minors or pivots, and connect definiteness to matrices of the form B^T B, invertibility and minima.
- Find constrained maximum and minimum valuesFind the largest and smallest values of a quadratic form on the unit sphere and where they occur, and use further orthogonality constraints and the Rayleigh quotient.
- Write a quadratic form with a symmetric matrix
- Find singular values and singular vectors of any matrix, factor it as , and read rank, the four fundamental subspaces, the condition number and least-squares solutions from the factorization.
- Find singular values and their geometric meaningCompute singular values from the eigenvalues of A^T A, interpret them as the stretch factors of A, and distinguish them from eigenvalues.
- Build the factorization A = UΣV^TAssemble U, Σ and V for square and rectangular matrices step by step, check the product, and interpret the factorization as rotate, stretch, rotate.
- Read subspaces, rank and least-squares solutions from the SVDUse singular vectors as orthonormal bases of the four fundamental subspaces, write the reduced SVD and the pseudoinverse, and judge sensitivity with the condition number.
- Find singular values and their geometric meaning
- Truncate the SVD to get the best low-rank approximation of a matrix, measure its error with singular values, and explain how principal components come from the SVD of centered data.
- Build the best rank-k approximationTruncate the outer-product expansion of the SVD, measure the error with the discarded singular values, and weigh storage against accuracy.
- Connect the SVD to principal component analysisCenter a data matrix, form its covariance matrix, and show that the principal components are eigenvectors of that matrix and left singular vectors of the centered data.
- Build the best rank-k approximation
Symmetric Matrices and Quadratic Forms study guide
1Use perpendicular eigenvector axes
A symmetric matrix can be understood by choosing perpendicular axes along its eigenvectors. This chapter develops the spectral theorem, explains why those axes exist, and shows how to compute them even when an eigenvalue repeats. You will then use rank-one projections to describe the action of the matrix one direction at a time. The main checks are concrete: unit-length columns, matching eigenvalues, and a product that reconstructs the original matrix.
1.1 Symmetry and orthonormal columns
Symmetry concerns entries; orthogonality concerns lengths and angles. Both properties involve a transpose, but they answer different questions about a matrix.
Read the two conditions
A square matrix is symmetric when . Its entry in position equals the entry in position . For example, is symmetric. The diagonal entries need not agree. For every rectangular matrix , both and are symmetric: transposing the product reverses the factors and returns the same product.
An orthogonal matrix is a square matrix with orthonormal columns: every column has length 1, and different columns have dot product 0. This is exactly , because the entries of that product are the column dot products. It follows that and that the rows are orthonormal too.
For , each column has squared length and their dot product is . In contrast, has perpendicular columns of length . Here . Divide each column by before using its transpose as its inverse.
Why lengths are preserved
For any vectors ,
Thus dot products, lengths, and angles are unchanged. An orthogonal matrix has determinant 1 or −1. In the plane these are rotations and reflections; the displayed matrix rotates through the angle with cosine . Orthogonality does not require symmetry: a rotation usually fails .
Why different eigenvalues give perpendicular vectors
Suppose is symmetric and , . Move the matrix across the dot product by transposing it:
Therefore . When the eigenvalues differ, the dot product must be 0. The step replacing by is where symmetry enters. If the eigenvalues are equal, the final equation is and places no restriction on the dot product. For instance, every nonzero vector is an eigenvector of , but two such vectors need not be perpendicular. Choosing an orthonormal basis within that eigenspace is a separate step.
For , the eigenvectors and have eigenvalues 3 and 1; their dot product is 0. This guarantee fails for a nonsymmetric matrix: has eigenvectors and for eigenvalues 1 and 2, and their dot product is 1.
Vectors here are columns. The product is a scalar dot product; reversing the order to gives a matrix. Keeping that distinction clear matters when building projections.
Key Takeaways
- Symmetry means ; an orthogonal matrix is square with orthonormal columns.
- For an orthogonal matrix, and multiplication preserves dot products.
- Eigenvectors of a symmetric matrix for distinct eigenvalues are perpendicular.
- Perpendicular columns must also be normalized to make an orthogonal matrix.
1.2 What the spectral theorem guarantees
The spectral theorem turns symmetry into a complete set of usable coordinate axes. It guarantees more than real eigenvalues: it guarantees enough eigenvectors, with the right perpendicularity, to form an orthonormal basis.
The theorem and its meaning
Every real symmetric matrix has real eigenvalues and an orthonormal basis of eigenvectors. If those unit eigenvectors are the columns of , then
where contains the matching eigenvalues. This is orthogonal diagonalization. An eigenvalue repeated as a root of the characteristic polynomial has an eigenspace of that same dimension. Eigenspaces belonging to distinct eigenvalues are mutually perpendicular. The eigenvalues together form the spectrum.
To understand the factorization, start with : multiplying each column of by multiplies it by its own eigenvalue. Since , multiplication on the right gives . For a vector , the coordinates in this basis are . The matrix acts by scaling each new coordinate by its eigenvalue.
The converse is useful
If a real matrix has an orthogonal diagonalization, then
Thus a real square matrix is orthogonally diagonalizable exactly when it is symmetric. You can decide whether such a factorization exists by checking mirrored entries before finding a characteristic polynomial.
Ordinary diagonalization is less restrictive. For example, has two distinct eigenvalues and can be diagonalized, but its two eigenvector directions are not perpendicular. Its eigenvector matrix cannot be made orthogonal just by normalizing columns.
Real, repeated, and zero eigenvalues
For , the characteristic polynomial has discriminant
So both eigenvalues are real. They coincide only if and , giving . In higher dimensions repeated eigenvalues are common, and the theorem still provides a full eigenbasis. This differs from , whose repeated eigenvalue 1 has only one independent eigenvector.
Symmetry does not ensure invertibility or positive eigenvalues. The symmetric matrix has eigenvalues 2 and 0. It still has an orthonormal eigenbasis, although it is singular. A diagonal matrix with a negative diagonal entry is another symmetric matrix, so negative eigenvalues are allowed too.
Why answers can look different
Changing the sign of a unit eigenvector keeps it a unit eigenvector. Reordering the columns of works if the same reordering is made in . In a repeated eigenspace, any orthonormal basis works. The eigenvalues are fixed apart from order, but the axes need not have unique signs or unique choices within repeated eigenspaces.
Key Takeaways
- Every real symmetric matrix has an orthonormal eigenbasis and real eigenvalues.
- The eigenspace dimension equals the multiplicity of its eigenvalue.
- A real square matrix is orthogonally diagonalizable exactly when it is symmetric.
- Symmetry allows zero and negative eigenvalues.
- Signs, matching order, and bases within repeated eigenspaces can vary.
1.3 Build and check an orthogonal diagonalization
Finding eigenvectors is only part of orthogonal diagonalization. The columns must also have unit length, be mutually perpendicular, and match the eigenvalues in the same order.
A two-dimensional calculation
Take . It is symmetric, so the spectral theorem applies. Its characteristic equation is
For eigenvalue 7, the equation gives the vector . For eigenvalue 2, gives . Their dot product is 0, as expected for distinct eigenvalues. Both lengths are . Normalize and place the larger eigenvalue first:
Check and . The latter checks one eigenvector equation per column, so it catches an incorrect eigenvalue order. As arithmetic checks, the eigenvalues sum to the trace, , and multiply to the determinant, .
A repeated eigenvalue needs a basis inside its eigenspace
Consider . To see its eigenvalues directly, write , where every entry of is 1. For any vector, has each coordinate equal to . Thus , while sends the sum-zero plane to zero. Adding gives eigenvalues 4 along the first line and 1 throughout that plane, so the eigenvalues of are 4, 1, and 1. The eigenvalue 4 has eigenvector . For eigenvalue 1, the equation is . A basis for that plane is and .
These two vectors have dot product 1, so they are not perpendicular. Apply Gram–Schmidt within the plane:
Scale the last vector to and normalize. A valid choice is
Each linear combination stayed inside the eigenvalue-1 plane. That is why the orthogonalized vectors remain eigenvectors. Vectors from distinct eigenspaces already are perpendicular; combining them generally destroys the eigenvector property. For instance, adding and gives , and is not a scalar multiple.
Finish with the right checks
Forgetting to normalize the two-dimensional example gives a column matrix with . It would produce , not . An opposite sign on any one unit eigenvector is harmless, but pairing that vector with the wrong eigenvalue is not. Use to check the basis and to check the matching; together they prove the claimed factorization.
Key Takeaways
- Find each eigenspace, then make its basis orthonormal.
- Apply Gram–Schmidt within a repeated eigenspace.
- Keep eigenvector columns and diagonal eigenvalues in matching order.
- Check both and .
- Trace and determinant provide quick checks on eigenvalues.
- Different valid eigenbases can give different-looking correct factorizations.
1.4 Describe a matrix one projection at a time
An orthogonal diagonalization can be expanded into a sum of simple matrices. Each piece projects onto one eigenvector direction and then multiplies that component by an eigenvalue.
Outer products are projection matrices
For a unit column vector , let . Then
This is the orthogonal projection onto the line through . The matrix is symmetric, has rank 1, and satisfies : projecting twice gives the same result as projecting once. The expression is a scalar; is an outer product, with one entry for each pair of coordinates.
If is an orthonormal basis, its projection matrices satisfy when and . Every vector is the sum of its components along those perpendicular directions.
Expand a diagonalization
Multiplying column by row gives the spectral decomposition
For , the unit eigenvectors are and . Their projection matrices are
Now , while . At , the two projected components are and . Their weighted sum is , which agrees with direct multiplication by .
Powers and inverses become scalar operations
Because different projections multiply to zero, powers do not create mixed terms:
For this example,
If every eigenvalue is nonzero, the inverse is . Here this gives
A zero eigenvalue prevents this reciprocal formula for the inverse: the matrix has collapsed that direction.
Normalize before forming the outer product
For the unnormalized vector , the outer product is , five times the projection. The correct formula for a nonzero vector of any length is . Dropping small-magnitude eigenvalue terms leaves a lower-rank symmetric matrix. The SVD extends this idea to arbitrary matrices, using different input and output directions in each rank-one term.
Key Takeaways
- For a unit vector, projects onto its line.
- A symmetric matrix is .
- Powers replace each eigenvalue by its power; inverses use reciprocals when all eigenvalues are nonzero.
2Understand quadratic forms
A quadratic form assigns a number to a vector using squares and cross terms. Its symmetric matrix connects algebraic expressions to geometry: eigenvectors give the principal axes, and eigenvalues give growth along them. This chapter shows how to remove cross terms, classify the signs a form can take, and find its extreme values under a length constraint. The same ideas explain why covariance matrices and squared lengths have nonnegative values.
2.1 Translate a quadratic form into a matrix
A quadratic form is a scalar function built from terms of total degree 2. Squares and products of two variables are allowed; linear and constant terms are absent. Writing the form as a matrix product makes the spectral theorem available.
Where each coefficient goes
For a symmetric matrix,
The diagonal entries are the square coefficients. Each cross term comes from two positions, so put half its coefficient in each mirrored position. The form therefore has matrix .
Evaluate at in two ways. Direct substitution gives . The matrix calculation gives and then . The middle result is a vector, but the final answer is a number.
More variables use the same rule
For , the matrix is
Expanding by positions explains the split: the entries and contribute . Since the scalar coordinates commute and the matrix is symmetric, these combine into . The coefficient 6 is split into two entries of 3. The coefficient −4 is split into two entries of −2. There is no term, so both corresponding positions are zero. For a diagonal matrix, all cross terms disappear; gives .
Why require a symmetric matrix?
Putting the full cross coefficient in just one position can reproduce the form but gives a nonsymmetric matrix. For example, gives the same scalar form as the symmetric matrix above. Putting 4 in both off-diagonal positions would instead give a cross coefficient of 8, which is wrong.
Every square matrix gives the same form as its symmetric part, . To see why, the scalar equals its transpose, , so averaging changes nothing. Requiring symmetry gives one unique matrix for each form and allows orthogonal diagonalization.
Scaling is quadratic
At the zero vector, . Scaling the input gives , so a form keeps the same sign along a line through the origin, except at the origin. It is not a linear function. Expanding a sum gives
Squared length is the form . More generally, . These examples connect quadratic forms to nonnegative quantities, energy models, and variance calculations.
Key Takeaways
- The matrix of a quadratic form is symmetric, and the output is a scalar.
- Each off-diagonal entry is half the matching cross coefficient.
- Missing cross terms give zero entries in both mirrored positions.
- Quadratic scaling means .
2.2 Rotate the axes to remove cross terms
Cross terms often make a quadratic form difficult to recognize. An orthonormal eigenvector basis gives coordinates in which the form is a sum of squares with eigenvalue coefficients.
Change coordinates in the correct direction
Write and substitute . Then
This is the principal axes theorem. The columns of are the principal axes. The inverse coordinate change is : each new coordinate is the dot product with a unit eigenvector. Orthogonality preserves lengths and angles during this change.
For , use and . The form becomes
At the new coordinates give , agreeing with the original form.
Read an ellipse from its coefficients
The level becomes , or . It is an ellipse with semi-axis along and semi-axis along . For positive eigenvalues and positive level , the lengths are . The larger eigenvalue gives the shorter axis because the form reaches the specified level sooner in that direction.
Keep the zero level separate
For , the symmetric matrix has eigenvalues 3 and −7, with directions and . In unit coordinates,
At level 21 this is , a hyperbola with vertices at distance along the positive-eigenvalue axis. At level 0 it is instead a pair of intersecting lines, .
If one eigenvalue is zero, the level equation is with . It gives two parallel lines if , one line if , and no points if . For , the level 2 gives and hence . The zero level gives the single line . The level −1 is empty, since a real square cannot be negative. In each nonempty case the second principal coordinate is free; zero eigenvalue means that moving along its axis does not change the form.
Normalization preserves the intended geometry
Using unnormalized columns and in the first example gives coefficients 35 and 10, not 7 and 2. That substitution also rescales length. With unit eigenvectors the graph of the form is easy to classify: positive eigenvalues give an upward bowl, negative ones a downward bowl, opposite signs a saddle, and a positive and a zero eigenvalue a flat-bottomed trough.
Key Takeaways
- Use and recover coordinates with .
- The new square coefficients are the eigenvalues when the axes are orthonormal.
- For an ellipse, a larger positive eigenvalue gives a shorter semi-axis.
- Opposite eigenvalue signs give a hyperbola at nonzero levels and intersecting lines at level zero.
- A single nonzero eigenvalue can give two parallel lines, one line, or an empty level set.
2.3 Determine the signs a quadratic form can take
Definiteness describes the values of a quadratic form over all vectors. Checking one positive value does not establish positive definiteness; the claim must hold in every nonzero direction.
Classify by eigenvalue signs
After an orthogonal change of coordinates, . Each squared coordinate is nonnegative, so the eigenvalue signs give an exact test.
| Class | Values of the form | Eigenvalues |
|---|---|---|
| Positive definite | Positive at every nonzero vector | All positive |
| Negative definite | Negative at every nonzero vector | All negative |
| Positive semidefinite | Nonnegative everywhere | All nonnegative |
| Negative semidefinite | Nonpositive everywhere | All nonpositive |
| Indefinite | Both positive and negative values | At least one of each sign |
A positive definite matrix also counts as positive semidefinite. The zero matrix belongs to both semidefinite classes. The matrix has eigenvalues 6 and 1 and is positive definite. The form has eigenvalues 2 and 0; it is positive semidefinite but vanishes at the nonzero vector .
Efficient tests
For , the determinant is the product of the eigenvalues. A negative determinant means indefinite. A positive determinant means both eigenvalues have the same sign: use to choose positive definite if or negative definite if . A zero determinant makes the matrix semidefinite; the remaining eigenvalue can also be zero.
For a larger symmetric matrix, Sylvester's criterion says that positive definiteness is equivalent to all leading principal minors being positive. These are the determinants of the successive upper-left square submatrices. For
they are 2, 3, and 4. Elimination without row exchanges has positive pivots . Its eigenvalues confirm the result.
Positive diagonal entries alone do not suffice. The matrix has eigenvalues 4 and −2, and its form gives −4 at . Nonnegative leading minors do not test positive semidefiniteness either: has leading minors 0 and 0 but takes negative values. Use eigenvalue signs for that test.
The distinction between definite and semidefinite also appears when solving . For a positive semidefinite matrix, write . A sum of these nonnegative terms is zero exactly when every coordinate with vanishes. The remaining coordinates lie in the zero-eigenvalue eigenspace. Thus exactly on . For a positive definite matrix that space contains only the origin; for a singular semidefinite matrix it gives the flat directions.
Squared lengths and minima
For any , . It is strictly positive at all nonzero inputs exactly when the columns of are independent. A positive definite matrix has a Cholesky factorization with upper triangular and positive diagonal. For example, gives .
To find that Cholesky factor directly, write with positive . Matching to gives , , and . Solve in order: , , . The factor makes the form , with no nonzero input sent to zero.
A positive definite form has a strict minimum of 0 at the origin; an indefinite form has a saddle there. In the second-derivative test, apply these signs to the Hessian at a critical point: positive definite gives a local minimum, negative definite a local maximum, and indefinite a saddle. For , the Hessian has eigenvalues 3 and 1, so the origin is a minimum.
Key Takeaways
- Eigenvalue signs classify definiteness; a zero eigenvalue rules out strict definiteness.
- Positive definite also implies positive semidefinite.
- For a symmetric 2×2 matrix, a negative determinant means indefinite.
- Positive leading principal minors test positive definiteness.
- Positive entries or diagonal entries alone do not establish positive definiteness.
- Every is positive semidefinite; independent columns of make it positive definite.
- A positive definite Hessian at a critical point gives a local minimum.
2.4 Find extreme values under a length constraint
A quadratic form usually has no largest value over the whole space: scaling a vector multiplies the value by the square of the scale factor. A fixed-length constraint makes its extreme values meaningful.
On the unit sphere
Let be symmetric, with eigenvalues and orthonormal eigenvectors . On ,
Unit vectors in the top and bottom eigenspaces attain the corresponding bounds. For a simple top eigenvalue the maximizers are and . A repeated top eigenvalue allows every unit vector in its eigenspace.
To prove the bounds, write . Since is orthogonal, . The form is a weighted average of eigenvalues:
Equality at the top requires all components outside the top eigenspace to vanish. The lower bound works the same way.
Compute a value and its location
For , the eigenvalues are 7 and 2. The maximum on the unit circle is 7 at , and the minimum is 2 at . At the first vector, direct substitution gives . Reporting the vector alone would omit the maximum value; reporting 7 alone would omit where it occurs if both are requested.
For a diagonal example, has maximum 9 at and minimum 3 at on the unit sphere. The coefficients already are the eigenvalues.
Additional orthogonality constraints
If a unit vector must also be perpendicular to , its first coordinate in the eigenbasis is zero. The largest remaining eigenvalue is . Requiring perpendicularity to makes the maximum . For , the largest value is 4 along . On the unit vectors perpendicular to that line, the form is always 1.
Remove the length dependence
The Rayleigh quotient is
It is unchanged by nonzero scaling, and its extreme values are the same largest and smallest eigenvalues. Therefore . On a sphere of radius , multiply both unit-sphere extremes by . In the two-dimensional example, does not contradict a maximum of 7 on the unit circle: that input has length . Applying these bounds to will identify the largest stretch of an arbitrary matrix.
Key Takeaways
- On the unit sphere, the extreme values are the smallest and largest eigenvalues.
- Unit eigenvectors locate the extremes; repeated eigenvalues can give whole sets of maximizers.
- Additional orthogonality constraints remove the corresponding eigenvector coordinates.
- The Rayleigh quotient is unchanged by nonzero scaling.
- On a radius- sphere, extreme values are multiplied by .
3Compute and use the SVD
The singular value decomposition describes every real matrix, including rectangular matrices and matrices that cannot be diagonalized. It gives perpendicular input directions, perpendicular output directions, and a nonnegative stretch between each pair. Here you will compute those directions, assemble the factors with the correct dimensions, and use them to identify subspaces and solve least-squares problems. Small singular values also reveal sensitivity.
3.1 Measure a matrix’s stretches with singular values
A matrix can stretch vectors very differently in different directions. Singular values measure its stretches along a special orthonormal set of input directions, even when the matrix is rectangular.
Start from a symmetric matrix
For an matrix , the matrix is symmetric and positive semidefinite. Indeed, . Let its ordered eigenvalues be with orthonormal eigenvectors . The singular values are .
For a unit eigenvector,
Thus is the length of the image of . The largest singular value is the maximum of over all unit inputs. The eigenvalue of is a squared stretch; take its square root to get a length.
Work through a nonsymmetric example
For ,
Its eigenvalues are 45 and 5, with unit eigenvectors and . Therefore and . Direct multiplication gives and ; their lengths confirm these values.
The eigenvalues of itself are 5 and 3. They are not its singular values. For a symmetric matrix, singular values are the absolute values of the eigenvalues, sorted again by size. The matrix has eigenvalues 3 and −7 but singular values 7 and 3. For a symmetric positive semidefinite matrix, the eigenvalues already are nonnegative, so the two lists agree.
Geometry and rank
The image of the unit circle in the example is an ellipse with semi-axis lengths and . Its axis directions are the images . These images are perpendicular because, for distinct indices,
A zero singular value means an input direction is sent to zero. For , the matrix has eigenvalues 10 and 0. The rank is 1, the number of positive singular values, and the circle collapses to a segment. In higher dimensions the same construction describes ellipsoids and their collapsed versions.
For a tall or wide matrix, either or can find the positive singular values. They have the same nonzero eigenvalues with multiplicity; the larger matrix has extra zeros. Choosing the smaller product saves arithmetic, but its eigenvalues still need square roots. For a square matrix the product of all singular values is ; in the example it is .
Key Takeaways
- Singular values are square roots of the eigenvalues of .
- The largest singular value is the largest stretch of a unit input.
- The rank is the number of nonzero singular values.
- For symmetric matrices, singular values are absolute eigenvalues, sorted by size.
3.2 Construct the singular value decomposition
The SVD pairs each special input direction with an output direction. It describes a matrix as a change of input coordinates, a nonnegative stretch, and a change of output coordinates.
Keep the dimensions visible
Every real matrix has a factorization
The matrices and are square orthogonal matrices of sizes and . Their columns are the left and right singular vectors. The middle matrix has size , just like . Its first diagonal positions contain , and every other entry is zero.
First find an orthonormal eigenbasis of and put its vectors into in decreasing eigenvalue order. Take square roots to build . For each positive singular value, calculate
These vectors already are orthonormal. For example, . For different indices the numerator is zero, and for equal indices it is . Dividing by the two singular values therefore gives the required dot products, zero and one. If fewer than are present, complete them with an orthonormal basis of . Never divide by a zero singular value.
Match the two sets of vectors
For , use
The images of the columns are and . Dividing by their corresponding singular values gives
Check , , and . The last equality matches every input vector to the correct output vector. Computing eigenvectors of separately can choose incompatible signs. Changing just one left vector reverses a rank-one term; changing both members of a pair together leaves the SVD unchanged.
A rectangular example needs completion
For , the product has eigenvalues 3 and 1. Use the same right vectors and . The left vectors are and . Complete them with , which satisfies . Here
The extra zero row makes the dimensions work: gives .
Why does the construction reproduce the whole matrix? For a zero eigenvalue of , the identity forces . Therefore all columns of are either matched images or zero columns. Those are exactly the columns of . Multiplying by gives , including all collapsed directions.
For a repeated positive singular value, a new orthonormal basis may be chosen in its right eigenspace. Apply to each of those new vectors to get the matching left basis. Both sides change together. Merely choosing two unrelated bases in the left and right repeated spaces need not reconstruct , even though both bases are orthonormal.
Interpret the factors
For , apply the rightmost factor first. The transpose expresses the input in its singular-vector basis, scales and adjusts the coordinate count, and places the output in its final directions. Equivalently,
Repeated singular values allow different matched orthonormal bases in their subspaces. For a symmetric positive semidefinite matrix, an orthogonal diagonalization already is an SVD with and .
Key Takeaways
- The full SVD exists for every real matrix, including rectangular and singular ones.
- Use only for positive singular values.
- Complete in when needed.
- The matrix has the same dimensions as .
- Check orthonormality and the matching equation .
- Apply the factors in the order , then , then .
3.3 Use the SVD for subspaces and least squares
The SVD separates directions that a matrix transmits from directions it collapses. This gives bases of the four fundamental subspaces and a way to solve least-squares problems even when an inverse does not exist.
Read the four subspaces
For a rank- matrix , the first columns of span ; its remaining columns span . The first columns of span ; its remaining columns span . The left vectors live in the output space and the right vectors in the input space .
For , the positive singular value is . The vectors and span the column and row spaces. The remaining vectors and span the left and right null spaces. Direct multiplication confirms and .
Reduce the factors
Keeping only the positive singular values gives the reduced SVD
The factors have sizes , , and before the final transpose. This is an exact factorization, not an approximation. In the rank-one example it is , which returns both columns .
Invert only the surviving stretches
The pseudoinverse is . It maps an output back by taking its components along the surviving left directions and dividing by their stretches. The vector minimizes the residual length and has the smallest length among all least-squares solutions. Also, projects onto . With independent columns, ; for a square invertible matrix it is the ordinary inverse.
For ,
At this gives and fitted vector . The residual has dot product 0 with each column of , which verifies least squares.
To see why the selected input has minimum length, note that belongs to : it is a combination of the first right singular vectors. Any other equally good fit has the same fitted output, the projection of , so it differs by a vector . These two input subspaces are perpendicular. Hence
A nonzero null-space addition changes no predicted output but increases the input length. For the rank-one example, exact inputs with all produce . The input is perpendicular to and has length ; gives the same output but has length 2.
Small stretches cause sensitivity
For an invertible square matrix, . A small output component along the last left singular vector is divided by the smallest singular value when solving. A large ratio therefore permits strong amplification of relative changes in the data. The matrix has condition number 3, while has a condition number about 40,000. Singular matrices have infinite condition number. In floating-point work, values tiny relative to the largest singular value may be treated as zero to determine numerical rank.
Key Takeaways
- Left singular vectors describe column and left null spaces; right vectors describe row and null spaces.
- The reduced SVD keeps every positive singular value and remains exact.
- The pseudoinverse inverts positive singular values and selects the minimum-length least-squares solution.
- The fitted vector is the orthogonal projection of the data onto the column space.
- A large condition number signals possible sensitivity when solving a system.
4Approximate matrices and explain variance
A large matrix often has a useful description with far fewer numbers. The SVD orders its rank-one pieces by size, so keeping the first few gives a precise way to balance accuracy and storage. This chapter develops the error formulas and then applies the same construction to centered observations. In principal component analysis, the retained directions capture the greatest variance, and the singular values tell you exactly how much variance remains.
4.1 Keep the most useful rank-one terms
The SVD writes a matrix as ordered rank-one pieces. Truncating that expansion gives a low-rank approximation with an error that can be read directly from the discarded singular values.
Keep whole terms
For a rank- matrix,
For , the approximation has rank exactly . Each term is a full matrix, not a row or column. Deleting rows or rounding individual entries does not perform this truncation.
Two norms describe different kinds of error. The spectral norm is the largest length over unit inputs and equals the largest singular value. The Frobenius norm is the square root of the sum of all squared entries, also equal to the square root of the sum of squared singular values.
Read the best possible error
The Eckart–Young theorem states that minimizes both errors among matrices of rank at most :
A gap makes the Frobenius-norm minimizer unique. The spectral-norm minimizer need not be unique even with a gap. For , both and have rank 1 and spectral error 1. Only the first has the smallest Frobenius error.
A complete rank-one example
For , its leading term is
The residual is . Its squared entry sum is 5, so its Frobenius norm is . This equals the discarded singular value, and also the spectral error, because only one term was discarded. The original squared Frobenius norm is ; the retained part contributes 45, or 90%.
Balance accuracy and storage
The retained share of squared Frobenius norm is . A relative spectral error test instead uses . These criteria need not select the same rank.
Storing the original matrix takes numbers. Storing the factors for rank takes : the left vectors, right vectors, and singular values. A 600×400 image needs 240,000 values; rank 20 needs 20,020, about 8.3% as many. Savings occur only if . Rapidly decreasing singular values make a small rank attractive. Small values can often be associated with noise, but the singular values alone do not establish which measured features are noise.
Key Takeaways
- Truncation keeps the largest singular values and their entire rank-one terms.
- The optimal spectral error is .
- The optimal Frobenius error includes the squares of all discarded singular values.
- A singular-value gap gives uniqueness in Frobenius norm, not necessarily in spectral norm.
- Factor storage requires numbers.
- Retained squared Frobenius norm and relative spectral error measure different aspects of accuracy.
4.2 Find principal directions from centered data
Principal component analysis finds perpendicular directions of variation in data. Its linear algebra is an eigenvalue problem for covariance, and an SVD of the centered observations gives the same directions directly.
Center each variable
Store observations as columns of a matrix. Compute their mean vector and subtract it from every column to obtain . Every row of sums to zero. For , the sample covariance is
This matrix is symmetric positive semidefinite. Its diagonal entries are variable variances, its off-diagonal entries are covariances, and its trace is the total variance. Many statistics tools store observations as rows; with that convention use the transpose of this data layout, and right singular vectors give the variable directions.
Compute a small example
The observations have mean . Subtracting it gives
The unit eigenvectors are and , with eigenvalues 12 and 4. These are the principal directions. The score of an observation on direction is . Along the first direction, the scores are . Their sample variance is .
Why the first direction is best
The variance along any unit vector is . Its maximum is the largest eigenvalue of , so the first principal direction captures the greatest variance. Choose an orthonormal eigenbasis, including within repeated eigenspaces. Different score variables then have zero covariance; unit eigenvectors that are not perpendicular do not provide this guarantee.
If , then
Here the singular values are 6 and , giving variances 12 and 4. The first component explains . Keeping the first directions is the truncated SVD ; its retained variance share equals its retained squared Frobenius share. The same example gives .
For the worked data, retaining the first direction also gives an explicit reconstruction. Multiply its unit vector by its row of scores:
The residual rows are and , with squared entry sum 12. Thus the Frobenius error is , exactly the discarded singular value. The discarded variance is . To reconstruct observations in their original coordinates, add the mean vector back to every approximated column. The centered approximation describes deviations; adding the mean restores their location.
Check centering, scale, and meaning
Skipping centering can make the leading direction describe the mean's position rather than the spread around it. The raw example has a first direction about , while the centered direction is . A singular value itself is not a variance: square it and divide by . Using instead rescales all variances but leaves directions and percentages unchanged.
Units also change variance. Measuring the same length in millimeters instead of meters multiplies its variance by . For variables with positive standard deviations, dividing each centered variable by its standard deviation gives correlation-based PCA when their scales differ. Computing the SVD directly avoids forming a covariance product that squares the singular-value ratio and can lose numerical accuracy.
Key Takeaways
- Subtract the mean vector before analyzing variation.
- With observations as columns, .
- Principal directions are an orthonormal covariance eigenbasis, ordered by variance.
- They are left singular vectors of centered column data, with .
- The retained variance share uses squared singular values.
- Changing units can change the principal directions; standardization changes the problem to correlation-based PCA.
Symmetric Matrices and Quadratic Forms examples
1Build perpendicular eigenvector axes
17 steps
- 1IntroductionFind axes that make the matrix simple
Find perpendicular eigenvector axes for a symmetric matrix, then normalize them and check the factorization. We will handle a repeated eigenvalue and use projections to compute the matrix’s action, powers, and inverse.
- 2ExplanationSeparate symmetry from orthogonality
Symmetric means . An orthogonal matrix is square with orthonormal columns: .
The columns of are perpendicular but have length . Divide them by before using the transpose as the inverse.
- 3Key InsightSee why different eigenvalues separate directions
Let and for symmetric . Transposing the first product gives
If , the dot product is zero. Symmetry is what lets us replace the transpose of by in the middle. Repeated eigenvalues do not force two chosen vectors to be perpendicular.
- 4ChallengeCheck a proposed orthogonal matrix
A square matrix has columns and . Is it orthogonal, and what common scaling makes it orthogonal?
---reveal---
The columns have dot product 0 but lengths 2, so the matrix is not orthogonal. Divide the whole matrix by 2. Its columns then have unit length and remain perpendicular; the resulting matrix has column dot-product matrix instead of .
- 5ExplanationUse the whole spectral theorem
The spectral theorem gives every real symmetric matrix real eigenvalues and a complete orthonormal eigenbasis, even for repeated roots.
Putting unit eigenvectors in and matching eigenvalues in gives . Zero eigenvalues prevent inversion but still allow this factorization.
- 6ChallengeDecide before computing eigenvalues
Can have a real orthogonal diagonalization? Explain without solving its characteristic equation.
---reveal---
No. If with real diagonal, then transposing would give . The displayed entries 3 and 0 do not match across the diagonal. The matrix has distinct eigenvalues and an ordinary diagonalization, but an orthogonal one requires symmetry.
- 7ExampleFind the eigenvalues of the worked matrix
Use the symmetric matrix . Its characteristic equation is
Factoring gives , so list 7 before 2. Their sum 9 matches the trace, and their product 14 matches the determinant. These checks help catch an arithmetic error before building the vectors.
- 8ExampleSolve and normalize each direction
For eigenvalue 7, gives . For eigenvalue 2, gives . Both vectors have length .
The dot product of the unnormalized vectors is zero. After normalization, . Checking verifies the eigenvalue attached to each column.
- 9ExampleKeep a repeated eigenspace intact
For , eigenvalue 4 has direction . The repeated eigenvalue 1 has eigenspace .
A basis is and . They belong to the same eigenspace, but their dot product is 1. The theorem guarantees an orthonormal choice; it does not make an arbitrary basis orthogonal.
- 10ExampleOrthogonalize within that plane
Subtract the projection of onto :
Scale this to . Normalizing gives and . Both remain in the eigenvalue-1 plane. Alongside , they form an orthonormal eigenbasis.
- 11ChallengeDiagnose a missing normalization
For the earlier 2×2 matrix, let and . What does equal, and how can it be repaired?
---reveal---
It equals . Each column has squared length 5, so and both outer factors contribute . Use on both sides of . The eigenvector equations were correct; the coordinate matrix was not orthogonal.
- 12ExplanationTurn a unit vector into a projection
For a unit column vector, is a projection matrix:
The dot product extracts the component; multiplication places it on the line. For a nonunit spanning vector, divide the outer product by its squared length.
- 13ExampleExpand the two projection terms
The unit eigenvectors of give
Then . The identity says that these two perpendicular components reconstruct every vector. Their product is zero: a vector projected onto one axis has no component left on the perpendicular axis.
- 14Key InsightCompute powers without repeated matrix products
Because and mixed projections multiply to zero,
Powers change the coefficients, keeping the same axes. Inverting requires nonzero eigenvalues: a collapsed component cannot be recovered.
- 15ChallengeApply a spectral decomposition
A symmetric matrix has orthogonal spectral projections and . What is ?
---reveal---
The cross products vanish, while each projection squares to itself. The second eigenvalue is −1, whose square is positive 1. Keeping a negative second coefficient would confuse an even matrix power with the original sign of the eigenvalue.
- 16ChallengeCheck a different-looking answer
A learner replaces the first column of an orthogonal eigenvector matrix by its negative and leaves unchanged. Is the factorization still correct? Explain using its rank-one terms.
---reveal---
Yes. The changed term is , so the reconstructed matrix is unchanged. Unit length, perpendicularity, and the eigenvalue equation are also preserved. A sign change differs from pairing a column with another eigenvalue.
- 17RecapKeep the checks and the interpretation together
Check and : these verify unit perpendicular columns and matching eigenvalues. Gram–Schmidt stays inside a repeated eigenspace.
The expansion splits the action into scaled projections and makes powers scalar calculations.
2Turn quadratic forms into geometry and bounds
19 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionRead a form through its eigenvectors
- 2ExplanationSplit the cross coefficient
- 3ChallengeWrite a new form as a matrix
- 4ExplanationChange both occurrences of the vector
- 5ExampleUse the worked axes
- 6Key InsightTreat zero levels separately
- 7ChallengeFind a degenerate level set
- 8ExplanationClassify all directions at once
- 9ExampleUse the short 2×2 test
- 10ExplanationTest a larger matrix
- 11ConnectionRecognize a squared-length form
- 12ChallengeChoose the exact definiteness class
- 13ConnectionConnect definiteness to a critical point
- 14ExplanationUse the unit constraint as weights
- 15ExampleSeparate the value from its location
- 16ExplanationAdd a radius or an excluded direction
- 17ChallengeOptimize with two constraints
- 18ChallengeConnect geometry, signs, and optimization
- 19RecapUse eigenvalues for three different questions
3Compute stretches, subspaces, and least squares
19 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMatch input axes to output axes
- 2ExplanationBuild a nonnegative eigenvalue problem
- 3ExampleCalculate the stretches in the worked example
- 4Key InsightRead geometry and rank from the stretches
- 5ChallengeCompute values and rank in a new case
- 6ExplanationBuild the factors with the right shapes
- 7ExampleMatch the left vectors in the worked example
- 8ExampleComplete a rectangular output basis
- 9ConnectionFollow the factors from right to left
- 10ChallengeFix a mismatched sign
- 11ChallengeAssemble a small full SVD
- 12ExplanationAssign input and output subspaces
- 13ExplanationReduce the factors without approximating
- 14ExplanationReverse the surviving stretches
- 15ExampleVerify a least-squares fit
- 16ChallengeFind the minimum-length exact solution
- 17Key InsightUnderstand the smallest singular value
- 18ChallengeCompare sensitivity after solving directions
- 19RecapKeep the sides, scales, and dimensions consistent
4Approximate matrices and find principal directions
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionTrade rank for accuracy
- 2ExplanationKeep complete rank-one terms
- 3ExplanationDistinguish the two errors
- 4ExampleCalculate a rank-one approximation
- 5ChallengeCheck accuracy and storage together
- 6TipDo not overclaim uniqueness
- 7ExplanationSubtract the mean before looking for variation
- 8ExampleCenter the worked observations
- 9ExampleFind the direction with greatest variance
- 10ConnectionConvert singular values into variances
- 11ChallengeRecover a variance share from data stretches
- 12Key InsightCheck the effect of units
- 13ChallengeLink discarded variance to approximation error
- 14RecapRead approximation and PCA from the same spectrum
Symmetric Matrices and Quadratic Forms practice questions
Set 1: Axes, definiteness, and SVD construction10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Eigenvectors, forms, and singular values10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Least squares, approximation, and principal components10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Connect the methods and check the edge cases10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
C
Centered data matrix
Cholesky factorization
Condition number
Constrained maximum
Cross term
D
Degenerate level set
Dot product
E
Eckart–Young theorem
Eigenspace
Eigenvalue bounds
Eigenvalue multiplicity
Eigenvector matrix
Explained variance ratio
F
Frobenius norm
Full SVD
G
Gram–Schmidt process
I
Image ellipsoid
Indefinite matrix
L
Leading principal minor
Left null space
Left singular vector
Level set
M
Matrix rank
Maximum stretch
Minimum-length least-squares solution
N
Negative definite matrix
Negative semidefinite matrix
Normalization
Numerical rank
O
Orthogonal change of coordinates
Orthogonal diagonalization
Orthogonal matrix
Orthonormal set
Outer product
P
Positive definite matrix
Positive semidefinite matrix
Principal axes
Principal direction
Principal-component score
Projection matrix
Pseudoinverse
Q
Quadratic form
Quadratic scaling
R
Rank-one matrix
Rayleigh quotient
Reduced SVD
Retained squared share
Right singular vector
S
Sample covariance matrix
Semi-axis
Singular value
Singular value decomposition
Singular-value gap
Singular-vector pair
Spectral decomposition
Spectral norm
Spectral theorem
Spectrum
Standardization
Symmetric matrix
Symmetric part
T
Trace
Truncated SVD
U
Uncorrelated components
Unit sphere
- 1Systems of Linear Equations
- 2Linear Transformations
- 3Matrix Algebra
- 4Determinants
- 5Vector Spaces
- 6Dimension and Rank
- 7Eigenvalues and Eigenvectors
- 8Orthogonality, Projections and Least Squares
- 9Symmetric Matrices and Quadratic Forms
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.