An expression like 5x² + 4xy + 2y² is a symmetric matrix in disguise. Rotating to the eigenvector axes removes the cross term, which classifies every conic and quadric, and decides whether a matrix is positive definite.
Apostol, not taughtApostol 5.10 to 5.15Strang, Introduction to Linear Algebra, 6.5Axler 7C
In JEE you met ax2+2hxy+by2=1 and memorised which signs make an ellipse or a hyperbola. The xy term is the nuisance: it tilts the curve. This chapter removes it for good. Every such expression is xTAx for a symmetric matrix A, and the spectral theorem (3.1) says that in the eigenvector coordinates A is diagonal, so the cross term vanishes. The same move decides whether a critical point of a function is a minimum (5.6) and whether gradient descent behaves (5.10).
Quick checkFor a symmetric matrix, the eigenvectors for different eigenvalues are:
That is the second fact of 3.1, and it is why the new axes below are a rotation of the old ones.Review: orthogonal eigenvectors
Quick checkIf Q has orthonormal columns, what is ∥Qy∥?
∥Qy∥2=yTQTQy=yTy. Orthogonal matrices preserve length, so the change of axes below does not distort the curve; it only turns it.Review: orthogonal matrices
The picture
Look at what the symmetric map does to the unit square, and turn on the eigenlines: the perpendicular axes along (1,1) and (1,−1) are the natural axes of the matrix. The ellipse xTAx=1 for this A has its long and short axes along exactly these lines. In coordinates along them the matrix is diagonal, and the ellipse’s equation has no cross term.
Where this came from· Principal axes from Euler to Sylvester
Finding the axes of a tilted ellipse or ellipsoid is the oldest form of this problem. Euler met it for spinning bodies in the 1700s, and in the 1820s Cauchy showed that the same equation gives the principal axes of a quadric surface and the secular equation of planetary astronomy. The next question is what stays the same however you diagonalize. In 1852 James Joseph Sylvester published a proof that, for a real quadratic form, the number of positive, negative and zero coefficients never changes, and he named it the “law of inertia”, the name it still has. Carl Jacobi had found a proof earlier, but it appeared only in 1857, after his death.
Definitions and theorems
Definition A
Quadratic form
A quadratic form on Rn is q(x)=xTAx for a symmetric matrix A. In two variables, q(x,y)=ax2+2bxy+cy2 corresponds to A=[abbc]: the cross-term coefficient is split equally between the two off-diagonal entries.
In one lineA function q(x)=xTAx=∑i,jaijxixj with A symmetric: a sum of squares and cross terms.
Why it existsEvery second-degree expression without linear terms is one, and its behaviour is decided entirely by the eigenvalues of A.
Worked example
Write q(x,y)=5x2+4xy+2y2 as xTAx.
Solution.
Diagonal entries. The x2 and y2 coefficients: a11=5, a22=2. xTAx contributes a11x2+a22y2.
Off-diagonal entries. The cross term is (a12+a21)xy=4xy, and symmetry forces a12=a21=2. Splitting equally is what makes A symmetric, so that 3.1 applies.
Let A=QΛQT (spectral theorem). Substituting x=Qy, that is y=QTx (the coordinates of x in the eigenbasis), gives
xTAx=λ1y12+λ2y22+⋯+λnyn2.
The change from x to y turns the axes without stretching anything, because ∥Qy∥=∥y∥. If detQ=−1 the change also flips the picture; negating one eigenvector makes detQ=+1, a pure rotation.
In one lineRotating to an orthonormal eigenbasis of A turns xTAx into λ1y12+⋯+λnyn2, with no cross terms.
Why it is trueSubstitute x = Qy with A = QΛQᵀ: the Q's cancel and only the diagonal Λ is left.
ProofApostol 5.11
The idea: Substitute and let Q^T Q = I cancel.
xTAx=yTQTAQy.
Substitute x=Qy, and (Qy)T=yTQT.
QTAQ=QTQΛQTQ=Λ.
A=QΛQT and QTQ=I on both sides.
yTΛy=∑iλiyi2. ■
A diagonal matrix's quadratic form has no cross terms.
Definition A
Principal axes
The principal axes of q(x)=xTAx are the lines through an orthonormal eigenbasis q1,…,qn of A.
In one lineThe orthonormal eigenvectors of A: the perpendicular directions in which the quadratic form has no cross terms.
Why it existsThey are the natural axes of the ellipse, ellipsoid or saddle that the form describes.
Worked example
Classify the conic 5x2+4xy+2y2=1 and find its axes.
Solution. Each step of the step-through below is one numbered stage of the method: matrix, eigenvalues, axes, rotate, read off.
Answer. An ellipse. Its nearest points to the origin lie along ±(2,1) at distance 61≈0.41, and its farthest points along ±(1,−2) at distance 1. In general, along a unit eigenvector with eigenvalue λ>0 the curve xTAx=1 is at distance λ1, so the biggest eigenvalue gives the nearest points and the smallest gives the farthest.
Quick checkx2−6xy+y2=1: ellipse or hyperbola?
A=[1−3−31] has eigenvalues 4 and −2. Opposite signs mean 4y12−2y22=1, a hyperbola. The signs of the x2 and y2 coefficients alone can mislead when there is a cross term.
Worked example Apostol 5.15 style
Find the principal axes of 7x2+6xy−y2=1 and say what curve it is.
Solution.
Matrix. The cross term 6xy splits as 3+3, so A=[733−1]. Half the cross coefficient goes in each off-diagonal slot.
Eigenvalues. Trace 6, determinant −7−9=−16, so λ2−6λ−16=(λ−8)(λ+2)=0 and λ=8,−2. Characteristic polynomial from trace and determinant (2.8). Opposite signs, because the determinant is negative.
Eigenvectors. For λ=8: A−8I=[−133−9], null vector (3,1). For λ=−2: A+2I=[9331], null vector (1,−3). Their dot product is 3−3=0, perpendicular as 3.1 promises. Divide each by 10 to make them unit vectors.
Rotate. In coordinates y1,y2 along (3,1)/10 and (1,−3)/10 the equation is 8y12−2y22=1. Principal axes theorem: the cross term is gone.
Read off.1/8y12−1/2y22=1 is a hyperbola. It crosses the line along (3,1) at distance 81≈0.35 and never meets the line along (1,−3). On the y2-axis, y1=0 would need −2y22=1, which has no real solution.
Answer. A hyperbola with axes along (3,1) and (1,−3).
Your answerWhat is the largest value of 7x2+6xy−y2 on the unit circle x2+y2=1?
It is the largest eigenvalue.
In principal axes the form is 8y12−2y22 with y12+y22=1. This is at most 8, reached at y=(1,0), that is at the unit vector along (3,1).
Your answerThe ellipse 3x2+2xy+3y2=8 has eigenvalues 4 (along (1,1)) and 2 (along (1,−1)). How long is its half-axis along (1,1)?
Set the other coordinate to 0.
Along (1,1) the equation is 4y12=8, so y1=±2.
Your answerThe curve 2x2+6xy+5y2=1 has matrix [2bb5]. What is b?
Split the cross coefficient equally between two entries.
The cross term 6xy is (a12+a21)xy=2bxy, so 2b=6 and b=3.
Quick checkWhat curve is x2−2xy+y2=1?
A=[1−1−11] has eigenvalues 0 and 2. In principal axes the equation is 2y12=1, so y1=±21: two parallel lines. (Indeed x2−2xy+y2=(x−y)2.) A zero eigenvalue is neither ellipse nor hyperbola.
Positive definite matrices
Definition A
Positive definite
A symmetric matrix A is positive definite if xTAx>0 for every x=O, and positive semidefinite if xTAx≥0 for every x. Negative (semi)definite is defined with the inequalities reversed, and A is indefinite if xTAx takes both signs.
In one lineA symmetric A is positive definite if xTAx>0 for every x=O; equivalently, all its eigenvalues are positive.
Why it existsIt is the matrix version of 'a positive number': a bowl shape, a minimum, a valid covariance, a convex loss.
Theorem AApostol 5.12; Strang 6.5
Positive definite iff positive eigenvalues
A real symmetric matrix A is positive definite if and only if all its eigenvalues are positive.
In one lineA symmetric matrix is positive definite exactly when every eigenvalue is positive.
Why it is trueIn principal axes the form is Σλᵢyᵢ², which is positive for every y ≠ 0 exactly when every λᵢ > 0.
ProofStrang 6.5
The idea: In principal-axis coordinates the form is Σ λᵢ yᵢ². (⇐) all positive coefficients give a positive sum when some yᵢ ≠ 0. (⇒) plug in an eigenvector.
xTAx=∑iλiyi2 with y=QTx.
Principal axes theorem; y=QTx is non-zero exactly when x is, since Q is invertible.
If every λi>0 and x=O, the sum is positive.
(⇐) Each term is ≥0 and some yi=0 gives a positive term.
If A is positive definite, then 0<qiTAqi=qiT(λiqi)=λi. ■
(⇒) Test the form on a unit eigenvector qi.
Worked example
Is A=2−10−12−10−12 positive definite?
Solution.
Use the definition directly.xTAx=2x12+2x22+2x32−2x1x2−2x2x3. Expand; each off-diagonal pair contributes twice.
Write it as a sum of squares.=x12+(x1−x2)2+(x2−x3)2+x32. Expand to check: x12+x12−2x1x2+x22+x22−2x2x3+x32+x32.
Positive unless x=O. All four squares are 0 only if x1=0, x2=x1, x3=x2, so x=O. A sum of squares is zero only when each square is.
Answer. Positive definite. (Its eigenvalues are 2−2,2,2+2, all positive.) This matrix is the discrete second derivative, and it appears in every finite-difference simulation of heat flow.
Beyond the course: for understanding· Quick tests: leading minors (Sylvester's criterion)
A symmetric matrix is positive definite iff all its leading principal minors (the determinants of the top-left 1×1, 2×2, …, n×n blocks) are positive. For [abbc]: a>0 and ac−b2>0. For the 3×3 example: 2, 3, 4, all positive. This is the test behind the 375 second-derivative test (5.6). For two variables you can prove it yourself with trace and determinant (worked example below). The general proof is in Strang 6.5, where the pivots of elimination turn out to be ratios of leading minors.
Worked example
For which k is A=[1kk4] positive definite?
Solution.
Reduce to the eigenvalues. By the theorem, we need both eigenvalues positive. That is the equivalence proved above.
Use trace and determinant. For a 2×2 matrix, the trace is λ1+λ2 and the determinant is λ1λ2. Both eigenvalues are positive exactly when the product is positive and the sum is positive. A positive product means the same sign, and then a positive sum means both are positive. Conversely, two positive numbers have positive sum and product.
Compute. Trace =5>0 always. Determinant =4−k2, which is positive when k2<4. The trace does not involve k, so only the determinant restricts k.
Solve.−2<k<2. k2<4 means ∣k∣<2.
Answer. Positive definite exactly for −2<k<2. At k=±2 the determinant is 0 (positive semidefinite, eigenvalues 0 and 5), and beyond that the matrix is indefinite. This agrees with the leading-minor test: 1>0 and 4−k2>0.
Your answerThe matrix [3kk12] is positive definite exactly when ∣k∣ is less than what number?
Only the determinant restricts k.
Trace 15>0. Determinant 36−k2>0 exactly when ∣k∣<6.
Worked example
Prove: for any real matrix B, the matrix BTB is positive semidefinite, and positive definite when the columns of B are independent.
Solution.
Check it is symmetric.(BTB)T=BT(BT)T=BTB. The definition of positive (semi)definite is for symmetric matrices, so this comes first.
Write the quadratic form.xTBTBx=(Bx)T(Bx). (Bx)T=xTBT.
Recognize a length.(Bx)T(Bx)=∥Bx∥2≥0. A vector dotted with itself is its squared length. This gives semidefinite.
When is it zero?∥Bx∥2=0 only if Bx=O. If the columns are independent, Bx=O forces x=O. That is the definition of independent columns (2.2).
Conclude. For x=O the form is strictly positive.
Answer.BTB is positive semidefinite always, and positive definite when B has independent columns. ■ Test: B=[1111] has dependent columns, BTB=[2222], and x=(1,−1) gives xTBTBx=0: semidefinite but not definite.
Worked example
Prove: if A is positive definite, then A is invertible and A−1 is positive definite. Test on A=[2112].
Solution.
Eigenvalues.A=QΛQT with every λi>0. The theorem above.
Invertible.detA=λ1⋯λn>0, so detA=0. The determinant is the product of the eigenvalues (2.8).
Write the inverse.A−1=(QΛQT)−1=QΛ−1QT. The inverse of a product reverses the order, and Q−1=QT, (QT)−1=Q.
Read off its eigenvalues.Λ−1=diag(λ11,…,λn1), all positive. The reciprocal of a positive number is positive. This is again a spectral decomposition, so these are the eigenvalues of A−1.
Symmetric.(A−1)T=(AT)−1=A−1, so by the theorem A−1 is positive definite.
Test.A−1=31[2−1−12], with eigenvalues 31 and 1, the reciprocals of 3 and 1.
Answer.A−1 exists and is positive definite, with eigenvalues λi1. ■
Quick checkWhich matrix is positive definite?
The first has eigenvalues 3 and 1. The second has all positive entries but eigenvalues 3 and −1 (determinant 1−4<0). The third has a negative diagonal entry, and x=(0,1) gives xTAx=−1. Positive entries are not the test.
Quick checkIf A is positive definite, what can you say about its diagonal entries aii?
Test the form on the standard basis vector ei: eiTAei=aii, and this must be positive. The converse fails: [1221] has positive diagonal and is not positive definite.
Tap the lines in the order a proof would write them. Each line can only use what is already above it.
A is symmetric, so it has an orthonormal eigenbasis.
QT is invertible, so it sends non-zero vectors to non-zero vectors.
You need Q from the spectral theorem first.
Principal axes theorem.
This uses y=QTx, defined in the previous line.
A sum of non-negative terms with at least one positive term is positive.
You need the diagonal form before you can read off its sign.
Where it is used
Used inside maths· Inside maths: maxima, minima and saddles
Near a critical point, Taylor’s theorem in two variables (5.6) says f(a+h)≈f(a)+21hTHh, where H is the symmetric Hessian matrix of second derivatives. Positive definite H: a minimum. Negative definite: a maximum. Indefinite: a saddle. The 375 test ”fxx>0 and fxxfyy−fxy2>0 means a minimum” is Sylvester’s criterion for 2×2.
Used in the real world· Engineering and data: energy, stiffness and covariance
In a structure of springs and beams, the stored energy is 21xTKx where K is the symmetric stiffness matrix; K positive definite means every displacement costs energy, so the structure is stable. Finite-element software checks this before solving. In statistics, a covariance matrix is always positive semidefinite, because the variance of any combination wTX of the variables is wTΣw≥0. Its principal axes are the principal components of 3.4.
Traps
Watch out· Split the cross term in half
ax2+2bxy+cy2 has matrix [abbc], not [a02bc]. The non-symmetric version gives the same q but wrong eigenvalues.
Watch out· Positive entries do not mean positive definite
[1221] has all positive entries and eigenvalues 3,−1: indefinite. Check eigenvalues or minors, never entries.
Problems
check
Write the matrix of q(x,y,z)=x2+3y2−z2+4xz.
Solution
10203020−1.
check
Classify by eigenvalue signs: (a) diag(3,1); (b) diag(3,−1); (c) diag(3,0).
Solution
(a) positive definite, ellipse. (b) indefinite, hyperbola. (c) positive semidefinite; 3x2=1 is a pair of parallel lines.
useApostol 5.15 style
Find the principal axes of 3x2+2xy+3y2=8 and its half-axis lengths.
Solution
A=[3113], eigenvalues 4 along (1,1) and 2 along (1,−1). In those coordinates 4y12+2y22=8, i.e. 2y12+4y22=1: half-axes 2 along (1,1) and 2 along (1,−1).
use
For which k is [2kk8] positive definite?
Solution
Leading minors: 2>0 and 16−k2>0, so −4<k<4.
prove
Prove that ATA is positive semidefinite for any matrix A, and positive definite when A has independent columns.
Solution
xTATAx=(Ax)T(Ax)=∥Ax∥2≥0. If the columns are independent, Ax=O only when x=O, so the form is positive for x=O. (This is why the normal equations of 2.10 have a unique solution.)
prove
Prove that a positive definite matrix is invertible, and that its inverse is positive definite.
Solution
Eigenvalues all positive, so none is 0 and detA=∏λi=0. A−1=QΛ−1QT has eigenvalues λi1>0, so it is positive definite.
stretch
Show that on the unit circle the quadratic form q(x)=xTAx has maximum λmax and minimum λmin. Use it to find the points of the ellipse x2+xy+y2=1 closest to and farthest from the origin.
Solution
In principal axes q=∑λiyi2 with ∑yi2=1, so λmin≤q≤λmax, attained at the eigenvectors. For the ellipse, A=[121211] has eigenvalues 23 along (1,1) and 21 along (1,−1). A point at distance r in the unit direction u has r2q(u)=1, so r=1/q(u). Closest: along (1,1) at r=2/3, the points ±(31,31). Farthest: along (1,−1) at r=2, the points ±(1,−1). Check: 1−1+1=1.
Summary
A quadratic form xTAx uses a symmetric A; the cross-term coefficient is split equally.
Principal axes: rotating to an orthonormal eigenbasis turns the form into ∑λiyi2, with no cross terms.
Conics: same-sign eigenvalues give an ellipse, opposite signs a hyperbola. The JEE rule is detA>0.
Positive definite means xTAx>0 for x=O, equivalently all eigenvalues positive (or all leading minors positive).
This decides minima (Hessians), stability (stiffness matrices) and covariance structure.
Watch and read
The same ideas explained by someone else. Use these when an explanation here does not land.
JEE / CBSE: You classified conics like $ax^2 + 2hxy + by^2 = 1$ with the rule '$h^2 - ab$ negative means ellipse'. This chapter shows that rule is a statement about the signs of two eigenvalues.
MATH 375: The second-derivative test for $f(x, y)$ (Apostol 9.10 to 9.12, end of 375) uses $f_{xx}f_{yy} - f_{xy}^2$, which is the determinant of the Hessian's quadratic form.
AI: A loss function near a minimum is approximately a quadratic form; its eigenvalues decide how fast gradient descent converges (5.10).