Quadratic forms: bowls, saddles and valleys
The question
The form x² + 4xy + y² has only positive coefficients. Does its graph rise in every direction from 0, like a bowl?
Set three numbers yourself; the page reads the shape.
- 1 SeeSet three entries to build a shape.
- 2 TryPredict where the form is largest.
- 3 ProveBuild the proof, line by line.
- 4 ApplyProblems to check yourself.
Before you start · 3 quick checks on a matrix times a vector, eigenvectors and the determinant, about 3 min
Two ideas before you start
2 ideasA matrix turns a vector into one number
Figure: a vector v, dashed, and the vector Av, solid, both drawn from 0, for the matrix with rows (3, 1) and (1, −1). It needs JavaScript.
q(1, 0) = 3 + 0 + 0 = 3
v · Av = (1, 0) · (3, 1) = 3
For the matrix with rows (3, 1) and (1, −1), the form is q(x, y) = 3x² + 2xy − y². Its value at v is the dot product v · Av: positive when Av makes an angle under 90° with v, negative when the angle is over 90°.
Exact definition
The form of a matrix. For a symmetric matrix \(A\) with rows \((a, b)\) and \((b, c)\) and a vector \(v = (x, y)\), the quadratic form of \(A\) is
\[\begin{aligned} q(v) &= v^\mathsf{T}Av = v \cdot Av \\ &= ax^2 + 2bxy + cy^2. \end{aligned}\]Every term has degree 2 in \(x\) and \(y\), and every expression \(\alpha x^2 + \beta xy + \gamma y^2\) is the form of exactly one symmetric matrix, the one with \(a = \alpha\), \(b = \beta/2\) and \(c = \gamma\). A matrix that is not symmetric gives the same form as its symmetric part \((A + A^\mathsf{T})/2\), so nothing is lost by taking \(A\) symmetric.
The graph. The graph of \(q\) is the surface \(z = q(x, y)\) above the plane, and a level curve is a set \(q(x, y) = k\) for one number \(k\).
Along each line through 0, the graph is a parabola
Figure: the graph of q along the line through 0 in the direction u, the parabola t ↦ q(u)t², for the same matrix. It needs JavaScript.
q(1, 0) = 3 + 0 + 0 = 3
q(tu) = t² q(u) = 3t² : opens up
Scaling a vector by t scales the form by t². So along the line through 0 in a direction u, the graph is the parabola q(u)t²: it opens up when q(u) > 0, down when q(u) < 0, and is flat when q(u) = 0. This form does all three.
Exact definition
Scaling. For every number \(t\) and vector \(u\), \(q(tu) = t^2q(u)\). So the sign of \(q\) along a line through 0 is the sign of \(q(u)\) for one direction \(u\) of that line.
Shapes. The graph of \(q\) is a bowl when \(q(v) \gt 0\) for every \(v \ne (0, 0)\) (\(A\) is called positive definite), a dome when \(q(v) \lt 0\) for every \(v \ne (0, 0)\) (negative definite), and a saddle when \(q\) takes both signs (indefinite). It is a valley when \(q(v) \ge 0\) for every \(v\) and \(q(v) = 0\) for some \(v \ne (0, 0)\) while \(A \ne 0\) (positive semidefinite but not definite); a ridge is a valley turned upside down, and \(A = 0\) gives a flat graph.
Fine print: eigenvalues, names and more variables
The fact this page uses about symmetric matrices. From the lesson on symmetric matrices (the spectral theorem): a real symmetric \(2 \times 2\) matrix \(A\) has two real eigenvalues \(\lambda_1 \ge \lambda_2\) and two eigenvectors \(w_1\) and \(w_2\) of length 1 that are orthogonal, \(Aw_1 = \lambda_1w_1\) and \(Aw_2 = \lambda_2w_2\). The eigenvalues add up to the trace \(a + c\) and multiply to the determinant \(ac - b^2\).
Names. The graph of a bowl is an elliptic paraboloid, a saddle a hyperbolic paraboloid, and a valley a parabolic cylinder. The same definitions work for an \(n \times n\) symmetric matrix and \(q(v) = v^\mathsf{T}Av\) with \(v\) in \(\mathbb{R}^n\); this page stays with two variables, where everything can be drawn.
Build a shape from three numbers
- Move the sliders for a, b and c, the entries of the matrix A with rows (a, b) and (b, c). The graph of q(x, y) = ax² + 2bxy + cy² and its level curves follow.
- Each round names a target shape. When you think the graph has it, press Check my matrix; the page finds the eigenvalues and says what the shape is.
How the game works
Each entry moves in steps of 0.5 from −3 to 3. The first picture is the graph of \(q\) over the disk of radius 1 around 0, seen from the side. Its heights are scaled so that the largest \(\lvert q\rvert\) on the disk is always drawn the same height: the picture shows the shape, not the size; parts below height 0 are dashed. The second picture maps the level curves \(q(x, y) = k\) for \(k = \pm 1, \pm 2, \pm 4, \pm 8\) on the square \(-2 \le x, y \le 2\). The tiles show \(q\) in four directions.
There are three rounds. You can check as often as you like, and a round ends when its target is reached. After round 3 a table lists your matrices. Start over clears everything.
| Round | Target | Your a, b, c | Eigenvalues | Checks |
|---|
Turn a direction, watch the form
A prediction and a quick guess. The explorer below them opens once both are answered.
Level curves
The explorer opens once both questions above are answered.
Explorer: turn a unit vector
Pick a matrix and turn the unit vector \(u\). The tiles show \(q(u)\) and how far the level curve is along the direction of \(u\).
Goals
Between the eigenvalues. For every unit vector \(u\), \(\lambda_2 \le q(u) \le \lambda_1\), with \(q(u) = \lambda_1\) along the eigenvector \(w_1\) and \(q(u) = \lambda_2\) along \(w_2\). Stage 3 shows why.
Far where the form is small. For \(k \gt 0\) and a unit vector \(u\) with \(q(u) \gt 0\), the point \(ru\) with \(r \gt 0\) lies on the level curve \(q = k\) exactly when \(r^2q(u) = k\), so \(r = \sqrt{k/q(u)}\). For a bowl the level curve is an ellipse with semi-axes \(\sqrt{k/\lambda_1}\) along \(w_1\) and \(\sqrt{k/\lambda_2}\) along \(w_2\): the long axis goes with the smaller eigenvalue. The covariance ellipse \(x^\mathsf{T}\Sigma^{-1}x = 1\) of the lesson on the covariance ellipse uses the inverse matrix \(\Sigma^{-1}\), whose eigenvalues are the reciprocals of those of \(\Sigma\), so there the long axis goes with the larger eigenvalue of \(\Sigma\).
Directions where the form is 0. For a saddle, a direction with \(q(u) = 0\) meets no level curve \(q = k\) with \(k \ne 0\): the level curves are hyperbolas, and these directions are their asymptotes.
When the graph is a bowl
Assumptions. Real numbers \(a\), \(b\) and \(c\) with \(a \gt 0\) and \(ac - b^2 \gt 0\), and the quadratic form \(q(x, y) = ax^2 + 2bxy + cy^2\) of the matrix with rows \((a, b)\) and \((b, c)\). Write \(v = (x, y)\) and \(q(v) = q(x, y)\).
Conclusion. \(q(v) \gt 0\) for every \(v \ne (0, 0)\), so the graph is a bowl, and for every \(k \gt 0\) the level set \(q(v) = k\) is bounded.
Facts the proof uses.
- ordinary algebra of real numbers;
- a square of a real number is at least 0, and it is 0 only when the number is 0;
- multiplying or dividing an inequality by a positive number keeps its direction;
- for numbers \(s\) and \(t\), \(\lvert s + t\rvert \le \lvert s\rvert + \lvert t\rvert\), and \(s^2 \le m\) gives \(\lvert s\rvert \le \sqrt{m}\).
Each option is one step about the numbers \(a\), \(b\), \(c\) of the theorem. Pick the one that is true for every \(a\), \(b\), \(c\) with \(a \gt 0\) and \(ac - b^2 \gt 0\), and for every point it speaks about.
- A dome. If \(a \lt 0\) and \(ac - b^2 \gt 0\), the theorem applies to \(-q\), whose entries \(-a\), \(-b\), \(-c\) give \((-a)(-c) - (-b)^2\), which equals \(ac - b^2\). So \(q(v) \lt 0\) for every \(v \ne (0, 0)\).
- A saddle. If \(ac - b^2 \lt 0\), \(q\) takes both signs. When \(a \ne 0\), \(q(1, 0) = a\) and \(q(-b, a) = a(ac - b^2)\) have opposite signs. When \(a = 0\), \(b \ne 0\) and \(q(x, 1) = 2bx + c\) takes both signs as \(x\) varies.
- A valley. If \(ac - b^2 = 0\) and \(a \gt 0\), line 1 reads \(a\,q(x, y) = (ax + by)^2\): \(q \ge 0\), and \(q = 0\) along the whole line \(ax + by = 0\).
- The eigenvalue test. With the eigenvectors \(w_1\), \(w_2\) of the fine print on the Start tab, every vector is \(v = sw_1 + tw_2\) with \(\lvert v\rvert^2 = s^2 + t^2\), and \(Av = s\lambda_1w_1 + t\lambda_2w_2\), so \[\begin{aligned} q(v) &= v \cdot Av \\ &= \lambda_1s^2 + \lambda_2t^2. \end{aligned}\] Hence \(\lambda_2\lvert v\rvert^2 \le q(v) \le \lambda_1\lvert v\rvert^2\), and the graph is a bowl exactly when both eigenvalues are positive. Since \(\lambda_1\lambda_2 = ac - b^2\) and \(\lambda_1 + \lambda_2 = a + c\), both are positive exactly when \(ac - b^2 \gt 0\) and \(a + c \gt 0\); and when \(ac - b^2 \gt 0\), \(a\) and \(c\) have the same sign, so \(a + c \gt 0\) exactly when \(a \gt 0\). That is the theorem's test.
- Least squares. For a matrix \(X\) and a vector \(y\), \(\lvert X\beta - y\rvert^2\) is a quadratic form in \(\beta\) with matrix \(X^\mathsf{T}X\), plus terms of degree 1 and 0. When the columns of \(X\) are independent, \(X^\mathsf{T}X\) is positive definite, so the graph is a bowl with one lowest point: the least-squares fit of the lesson on projection onto a subspace.
Problems
Each problem has hints and a full solution.
Further reading
- G. Strang, Introduction to Linear Algebra, 5th ed. (Wellesley-Cambridge Press, 2016), section 6.5, "Positive Definite Matrices."
- D. C. Lay, S. R. Lay and J. J. McDonald, Linear Algebra and Its Applications, 5th ed. (Pearson, 2016), section 7.2, "Quadratic Forms."