Back to the Electrical Engineering roadmap
Linear Algebra I · Real symmetric matrices and orthogonal diagonalization
Prerequisites: eigenspaces and diagonalization, dot products, orthonormal bases and Gram–Schmidt, and the preceding lesson’s conjugate transpose and complex norms. Goals: prove why real symmetry supplies an orthonormal eigenbasis, construct and validate A=QDQᵀ, handle repeated eigenvalues, and interpret quadratic forms through eigenvector coordinates. Work through the examples and lab, then attempt the open-book assessment before opening its point-by-point rubric.
Review orthonormal bases · Review diagonalization · Review conjugation and complex norms
Symmetric and orthogonal mean different things
A real square matrix A is symmetric when Aᵀ=A, equivalently aᵢⱼ=aⱼᵢ. A real square matrix Q is orthogonal when QᵀQ=I, so Q⁻¹=Qᵀ and its columns form an orthonormal basis. Orthogonal means mutually perpendicular unit columns, not that every entry is perpendicular. A=[3 1;1 3] is symmetric but not orthogonal; the quarter-turn [0 −1;1 0] is orthogonal but not symmetric. A non-square matrix with orthonormal columns has QᵀQ=I but is not invertible, so this lesson’s diagonalization uses square Q.
The real spectral theorem: a real n×n matrix is symmetric if and only if A=QDQᵀ for a real orthogonal Q and real diagonal D. Equivalently, it has an orthonormal basis of real eigenvectors. Repeated eigenvalues are allowed; their eigenspaces still have full required dimension. This is stronger than ordinary diagonalization, where P⁻¹ need not equal Pᵀ. The theorem here requires real symmetry. For complex matrices, the corresponding condition is Hermitian A*=A, not merely Aᵀ=A; for example [i] is complex symmetric and has a nonreal eigenvalue.
Why the theorem holds
First, every eigenvalue is real. Allow a complex eigenvector v≠0 temporarily. Since A is real symmetric, A*=A. The scalar s=v*Av is real because s̄=v*A*v=v*Av. From Av=λv, s=λ(v*v), and v*v>0 is real, so λ=s/(v*v) is real. Existence of at least one complex eigenvalue follows from the Fundamental Theorem of Algebra applied to the characteristic polynomial. Writing v=u+iw, the real and imaginary parts satisfy Au=λu and Aw=λw; at least one of u,w is nonzero, giving a real eigenvector.
Second, distinct eigenspaces are orthogonal. If Au=λu and Av=μv for real vectors, then λuᵀv=(Au)ᵀv=uᵀAv=μuᵀv. Thus (λ−μ)uᵀv=0, and λ≠μ forces uᵀv=0. For equal eigenvalues this equation says nothing about orthogonality. Within one eigenspace, Gram–Schmidt and normalization preserve the eigenvector property because that eigenspace is closed under linear combinations. Do not infer that any two eigenvectors of a symmetric matrix must be perpendicular.
To prove a full eigenbasis exists, use induction on n. The n=1 case is immediate. Choose a real unit eigenvector q₁. Its perpendicular complement W is invariant: for w∈W, q₁ᵀAw=(Aq₁)ᵀw=λq₁ᵀw=0, so Aw∈W. Choose an orthonormal basis U for W using Gram–Schmidt; the restriction has real symmetric matrix B=UᵀAU of size n−1. By induction B has an orthonormal eigenbasis. Mapping those vectors back by U and adjoining q₁ gives n orthonormal eigenvectors of A. Their columns Q satisfy AQ=QD and QᵀQ=I, hence A=QDQᵀ. Conversely, (QDQᵀ)ᵀ=QDᵀQᵀ=QDQᵀ, proving symmetry.
Construction, coordinates, and quadratic forms
- Check that A is real symmetric. Find its real eigenvalues and a basis for each eigenspace. Orthonormalize separately within each repeated eigenspace, then place all unit eigenvectors in Q. Put each matching eigenvalue in the same column position in D.
- Validate QᵀQ=I and AQ=QD. Then A=QDQᵀ. Coordinates of x are c=Qᵀx, and x=Qc. This change of coordinates preserves length: ||Qc||²=cᵀQᵀQc=cᵀc. It does not say A itself preserves length.
- For integer n≥0, Aⁿx=QDⁿQᵀx; define A⁰=D⁰=I even when an eigenvalue is zero. For a real quadratic form q(x)=xᵀAx, substitution x=Qc gives q(x)=cᵀDc=∑λⱼcⱼ². Also A=∑λⱼqⱼqⱼᵀ, a sum of scaled orthogonal projections.
For real symmetric A, positive definite means q(x)>0 for every nonzero x; the eigenvalue criterion is all λⱼ>0. Positive semidefinite means q(x)≥0 for every x; all λⱼ≥0, allowing zero. Negative definite and semidefinite reverse the inequalities. Indefinite means q takes both positive and negative values, equivalently eigenvalues of both signs. Proof: use q=∑λⱼcⱼ², and test c=eⱼ for necessity. The zero matrix is both positive and negative semidefinite, but neither definite nor indefinite. Positive entries alone do not imply positive definiteness, and nonnegative eigenvalues alone imply this quadratic-form conclusion only under the real-symmetry assumption used here.
Worked examples
- Two distinct eigenvalues: A=[3 1;1 3]. Its characteristic polynomial is (λ−3)²−1=(λ−4)(λ−2). Take q₁=(1,1)/√2 and q₂=(1,−1)/√2, so Q=(1/√2)[1 1;1 −1] and D=diag(4,2). Check QᵀQ=I and AQ=QD. For x=(3,1), c=(2√2,√2), giving A²x=Q(32√2,4√2)=(36,28). Direct updates (10,6),(36,28) confirm it. The form 3x²+2xy+3y² becomes 4c₁²+2c₂² and is positive definite.
- Repeated eigenvalue in 3D: A=[3 1 0;1 3 0;0 0 2] has λ=4 with q₁=(1,1,0)/√2 and λ=2 with eigenspace span{(1,−1,0),(0,0,1)}. Choose q₂=(1,−1,0)/√2,q₃=(0,0,1) to obtain D=diag(4,2,2). Within E₂, both u=(1,−1,0) and w=(1,−1,1) are eigenvectors, yet uᵀw=2≠0. Gram–Schmidt changes w to w−(uᵀw/uᵀu)u=(0,0,1), preserving E₂. Repetition causes non-uniqueness of an orthonormal eigenbasis, not failure of the theorem.
- Positive entries can give an indefinite form: B=[1 2;2 1] has unit eigenvectors (1,1)/√2 and (1,−1)/√2 with eigenvalues 3 and −1. Thus q=3c₁²−c₂². At those two unit vectors q is 3 and −1 respectively, proving indefiniteness even though every entry of B is positive. By contrast C=[1 1;1 1] has eigenvalues 2,0 and q=(x+y)²≥0, but q(1,−1)=0, so it is positive semidefinite and singular, not positive definite.
- An exact rational orthogonal basis: Q=(1/5)[3 −4;4 3], D=diag(4,1). Multiplication gives A=(1/25)[52 36;36 73], which is symmetric, and QᵀQ=I. For x=(3,4), c=Qᵀx=(5,0), so ||x||²=||c||²=25. Two updates give D²c=(80,0) and A²x=(48,64). Also xᵀAx=4·25=100. This illustrates the diagram and first lab command; Q preserves coordinate length, whereas applying A twice increases this particular vector’s length from 5 to 80.
Common mistakes and checks
Normalize eigenvectors before replacing an inverse by a transpose. For repeated eigenvalues, choose an orthonormal basis within the eigenspace; arbitrary eigenvectors need not be perpendicular. Keep each eigenvalue aligned with its column. Verify symmetry before using the real spectral theorem, and do not confuse positive entries with a positive quadratic form. A zero eigenvalue is allowed in orthogonal diagonalization but rules out invertibility. Length preservation belongs to Q, not generally A. Check QᵀQ, AQ−QD, and the reconstruction A−QDQᵀ; a small floating-point residual supports a computation but does not prove an exact theorem.
Practice
- Orthogonally diagonalize A=[2 −1;−1 2], then compute A²(1,0) and classify its quadratic form.
- For A=diag(2,2,5), use eigenvectors u=(1,0,0),v=(1,1,0),w=(0,0,1). Apply Gram–Schmidt where necessary and explain why merely normalizing v is insufficient.
- For C=[1 1;1 1], express q(x,y) in orthonormal eigenvector coordinates. Give one nonzero zero-form vector and decide definiteness and invertibility.
- N=[1 1;0 2] has real distinct eigenvalues. Can a real orthogonal Q diagonalize it? Explain using the converse spectral theorem rather than confusing real roots with symmetry.
Fully worked solutions
- χ=(λ−2)²−1 gives 1,3. Use Q=(1/√2)[1 1;1 −1], D=diag(1,3); QᵀQ=I and AQ=QD. For (1,0), c=(1/√2,1/√2); D²c=(1/√2,9/√2), so A²(1,0)=(5,−4). Both eigenvalues are positive, hence positive definite.
- u is already unit; subtract its projection from v to get v−u=(0,1,0). Together with w this yields Q=I,D=A. Normalizing v alone gives v/√2 with dot product 1/√2 against u, not zero, so it does not produce an orthogonal Q.
- Use q₁=(1,1)/√2,q₂=(1,−1)/√2. Then c₁=(x+y)/√2,c₂=(x−y)/√2 and q=2c₁². The vector (1,−1) gives q=0. The form is positive semidefinite, not definite; det(C)=0 and the zero eigenvalue makes C noninvertible.
- No: if N=QDQᵀ with real diagonal D, then Nᵀ=N. But Nᵀ=[1 0;1 2]≠N. Ordinary diagonalization is possible with eigenvectors (1,0),(1,1), but this eigenbasis is not orthogonal.
Assessment · Open book · 18 points
Open book: use books, lesson notes, cited readings, calculators, and relevant free software. Explain your own reasoning, assumptions, units, and checks; identify references or software you use. Attempt the questions before opening the answer key. Suggested study time: 40–60 minutes; this is a self-study guide, not a timed restriction.
Use references and relevant free software. Show your construction, assumptions, and independent checks. The application question adds 6 points to these 12.
- For M=[5 2;2 2], construct an orthogonal diagonalization and compute M²(1,0), checking directly. (5)
- A real symmetric matrix has eigenvalues 4,0,−2 and orthonormal eigenvectors q₁,q₂,q₃ in that order. Express q(x) in eigenvector coordinates, classify the form, give positive, negative, and zero directions, and decide invertibility. (4)
- Prove that two real eigenvectors of a real symmetric matrix with distinct eigenvalues are orthogonal. Explain why the same argument does not force perpendicularity for equal eigenvalues. (3)
Application and reasoning · 6 points
For A=diag(2,2,5), a reviewer chooses P=[1 1 0;0 1 0;0 0 1] from eigenvectors and claims A=PDPᵀ for D=diag(2,2,5). Diagnose the error by computing PᵀP and PDPᵀ (2). Repair the eigenbasis using Gram–Schmidt within the repeated eigenspace (2). Explain why mixing e₁ and e₃ into w=(e₁+e₃)/√2 would instead destroy the eigenvector property (2).
Complete answer key and scoring rubric
- χ=λ²−7λ+6 gives 6,1 (1). Q=(1/√5)[2 −1;1 2],D=diag(6,1) (1). Check QᵀQ=I and MQ=QD (1). For x=(1,0), c=(2,−1)/√5, giving M²x=Q(72,−1)/√5=(29,14) (1). Direct Mx=(5,2),M(5,2)=(29,14) (1).
- q=4c₁²−2c₃² (1). It is indefinite because it takes both signs (1). q(q₁)=4,q(q₃)=−2,q(q₂)=0 give the requested directions (1). It is singular because of the zero eigenvalue (1). A zero eigenvalue alone does not imply semidefiniteness.
- Symmetry gives (Au)ᵀv=uᵀAv (1). Substituting eigenvector equations gives (λ−μ)uᵀv=0; λ≠μ implies uᵀv=0 (1). If λ=μ this is only 0=0; e.g. (1,0),(1,1) for 2I are eigenvectors with nonzero dot product (1).
Application and reasoning · 6 points
PᵀP=[1 1 0;1 2 0;0 0 1]≠I, so Pᵀ is not P⁻¹; PDPᵀ=[4 2 0;2 2 0;0 0 5]≠A (1 each check). The first vector is e₁; subtract its projection from (1,1,0) to get e₂, then retain e₃. Thus Q=I,D=A is an orthogonal diagonalization (1 projection, 1 repaired factorization). Aw=(2e₁+5e₃)/√2 cannot equal λw because it would require λ=2 and λ=5 simultaneously (1 calculation, 1 conclusion). Linear combinations within one eigenspace preserve its eigenvalue, but combinations across distinct eigenspaces generally do not.
Scoring: existing questions 12 + application problem 6 = 18 points. Award the stated method and reasoning marks, not only final answers.
Download the orthogonal-modes lab
Download the exact-fraction Python lab
Objective: build a real symmetric A=Q diag(λ,μ)Qᵀ with fixed Q=(1/5)[3 −4;4 3], compare orthogonal coordinates and direct matrix powers, and classify xᵀAx. Install free Python 3 for Windows, macOS or Linux from the official link below. Save the file, open a terminal in its folder, and run each command; Windows can use py -3 instead of python3. No account, university login, paid license or extra packages are needed. It runs offline after installation. Arguments are λ,μ,n,x,y; λ,μ,x,y are −4 to 6 in half steps and n is an integer from 0 to 8. Negative fractions such as -1/2 are accepted.
python3 ee-symmetric-matrices.py 4 1 2 3 4
python3 ee-symmetric-matrices.py 2 2 3 3 4
python3 ee-symmetric-matrices.py 0 2 2 3 4
python3 ee-symmetric-matrices.py -1 2 3 3 4
python3 ee-symmetric-matrices.py 0 0 0 3 4
python3 ee-symmetric-matrices.py 0 0 1 3 4
Procedure: before running, predict A’s definiteness, the coordinates Qᵀx, the quadratic form, and the final vector. The six final vectors are (48,64),(24,32),(0,0),(−3,−4),(3,4),(0,0). Their initial quadratic-form values are 100,50,0,−25,0,0. The fourth matrix is indefinite even though this particular input gives a negative value; use its other eigenvector to find a positive value. For repeated λ=μ the eigenspace has dimension 2 and Q is one of many valid bases. Compare all quantities with the browser activity. Python checks QᵀQ=I, symmetry, AQ=QD, direct powers, norm preservation under Q, and equality of the two quadratic-form calculations using exact fractions.
Questions with answers: Why can an indefinite matrix produce zero for a nonzero vector? Positive and negative modal contributions may cancel; e.g. for diag(1,−1), (1,1) gives zero. Why does n=0 return the input for a zero matrix? A⁰=I and no update occurs. Does observing q(x)>0 for one input prove positive definiteness? No; the condition concerns every nonzero vector. The browser uses floating point, six-decimal displays and entrywise scaled tolerance 10⁻⁹·max(1,|reference|). A rounded zero residual is not an exact proof. This fixed-basis synthetic model is not a general numerical eigensolver, a physical energy measurement, or a replacement for instrumentation and safety practice.
Free primary readings and next step
Read Rutgers Lecture 27 for the real spectral theorem, its proof, and quadratic forms, then MIT’s Lecture 25 and accompanying summary for symmetric matrices and positive definiteness. The linked materials are publicly readable without an account or paid textbook. Use the proof above and the lab to connect orthogonality to validation, rather than treating Qᵀ as a shortcut for every inverse. A coverage review and cumulative Linear Algebra I assessment remain before declaring this course complete; the other EE Year 1 subjects are still in progress.
- Rutgers · Lecture 27: symmetric matrices, spectral theorem, quadratic forms
- MIT 18.06SC · Lecture 25: symmetric matrices and positive definiteness
- Python Software Foundation · Free Python 3 downloads
- Python documentation · Exact rational arithmetic
Orthogonal modes lab · Coordinates and quadratic forms
For fixed Q=(1/5)[3 −4;4 3], compare A=Q diag(λ,μ)Qᵀ with orthogonal modes and classify xᵀAx.
Free tool built into this page. Use it in your browser without an account or download.
Procedure
Try (λ,μ,n,x,y)=(4,1,2,3,4),(2,2,3,3,4),(0,2,2,3,4),(−1,2,3,3,4),(0,0,0,3,4),(0,0,1,3,4). Predict classification, coordinates, quadratic form, and final vector before running. Compare with the Python download above.
Expected results and answer check
Final vectors: (48,64),(24,32),(0,0),(−3,−4),(3,4),(0,0). Initial quadratic forms: 100,50,0,−25,0,0. Case 4 is indefinite: q₁ gives a negative value and q₂ a positive one. For λ=μ every nonzero vector is an eigenvector, but an arbitrary pair need not be orthonormal.
Python checks exact rational identities. Browser arithmetic is floating point with entrywise scaled tolerance 1e−9 and rounded displays. This fixed orthogonal-basis family is not a general eigensolver or a physical energy experiment.