Quadratic forms
A quadratic form takes a vector x, transforms it with a square matrix A, and dots the result with x.
On this page 7 sections
01A vector becomes a scalar cost#
A quadratic form takes a vector , transforms it with a square matrix , and dots the result with . Its value is a scalar. Quadratic forms describe costs that depend on how coordinates interact.
For an -entry column vector, the shapes are . The final shape is . Computing first makes the two operations clear.
02Transform, then dot#
Let have rows and let . The matrix-vector product is . Dotting with gives .
Expanding directly gives the same result: . Both off-diagonal entries contribute. Counting just the diagonal would miss the cross-coordinate terms.
A is diagonal with entries (2,3), and x=(1,2). Find xᵀAx.
Show answer and explanation
Ax=(2,6), then x dot Ax=2+12=14.
03Inspect the result#
A scalar result need not be positive. If has diagonal entries and all other entries zero, then gives . Classifying matrices whose forms are always nonnegative comes later.
If you replace by , the form is multiplied by : the scale appears in each copy of the vector. Negating the whole vector therefore leaves the value unchanged.
For a square matrix A and column vector x, what type of result is xᵀAx?
Show answer and explanation
The product shapes reduce to one by one.
Keep the intermediate vector separate from the final scalar . This distinction also matters when differentiating the form: a scalar function can have a vector gradient.
Evaluate a quadratic form on a supplied vector.
- Evaluate a quadratic form on a supplied vector.
Sources & further reading
- [1]Boyd and Vandenberghe, Introduction to Applied Linear Algebra ↗stanford.edu · Article