Bilinear and quadratic forms — theory with skatepark ramps, the bowl, the channel and the saddle (and the cross term I did not split in half)

In the first quiz on this topic I got a really easy question wrong because I did not split the cross term in half. I was given w=x2+6xy+2y2w = x^2 + 6xy + 2y^2 and wrote the matrix with a 6 off the diagonal, in both entries. With that matrix, XtAXX^tAX gives x2+12xy+2y2x^2 + 12xy + 2y^2: twice what was there. The 6 of the cross term is shared between the two entries that produce it, 3 and 3, and that detail, which looks trivial, changes the classification, the conjugate vectors and everything that follows.

For this topic it helps me to think about a skatepark. The height of the ground around the lowest point of a ramp is, close up, a quadratic form: an expression like x2+y2x^2 + y^2 or x2−y2x^2 – y^2 in which every term has degree 2. Depending on the form, the ramp is a bowl (it rises in every direction), a channel (the half-pipe, flat along its length and rising towards the sides) or a saddle (it rises in one direction and falls in another). Today we see how each form is written with a symmetric matrix, how it is diagonalised so it can be read at a glance and how it is classified without drawing anything. First comes the tool that holds it all up, the bilinear form, which is a dot product with different rules. You are coming from linear transformations and diagonalisation, and here you will use symmetric matrices and elementary operations all the time. After this theory comes the guided practice with problems solved step by step.

In a nutshell: a bilinear form assigns a number to each pair of vectors and is linear in each of them, f(u⃗,v⃗)=XtAYf(\vec u, \vec v) = X^tAY; a quadratic form is w(u⃗)=f(u⃗,u⃗)=XtAXw(\vec u) = f(\vec u, \vec u) = X^tAX, with AA symmetric. It is classified (definite, semidefinite or indefinite) by the signs of its diagonalised matrix or with Sylvester’s criterion.

Before you start. For this topic all you need is to multiply row by matrix by column, work out small determinants, do elementary row operations and know what a basis and coordinates are (and, for one section, the eigenvalues from topic 5). Nothing else. The topic has three big ideas, in this order: a rule that takes two vectors and returns a number (the bilinear form), with its matrix and how it changes basis; the height of the ramp, which comes from putting the same vector in twice (the quadratic form), with its symmetric matrix, its polar form and conjugate vectors; and how to tell which ramp it is without drawing it (diagonalising, the signature and Sylvester’s criterion). At the end the circle closes with the dot product from topic 4. If you get lost at any point, go back to the skatepark: the whole topic can be told with it.

What a bilinear form is

Before the definition, look at what the dot product you already know does: a bilinear form is that with other numbers. Take u⃗=(1,2) \vec u = (1, 2) and v⃗=(3,−1) \vec v = (3, -1) : u⃗⋅v⃗=3−2=1 \vec u \cdot \vec v = 3 – 2 = 1 . Now nudge the vectors a little and watch what happens to the result:

TestCalculationResultWhy
The original(1,2)⋅(3,−1) (1, 2) \cdot (3, -1) 1Starting point
u⃗ \vec u doubled(2,4)⋅(3,−1)=6−4 (2, 4) \cdot (3, -1) = 6 – 4 2Each term carries a single coordinate of u⃗ \vec u : if they all double, the total doubles
u⃗ \vec u split in two pieces(1,0)⋅(3,−1)+(0,2)⋅(3,−1)=3−2 (1, 0) \cdot (3, -1) + (0, 2) \cdot (3, -1) = 3 – 2 1(1,2)=(1,0)+(0,2) (1, 2) = (1, 0) + (0, 2) : each piece contributes its share and they add up
v⃗ \vec v doubled(1,2)⋅(6,−2)=6−4 (1, 2) \cdot (6, -2) = 6 – 4 2The same with the second vector

Scaling a vector scales the result, and splitting it into pieces splits the result: that is being linear in that vector. The dot product is linear in both, hence the «bi» in bilinear. The clue to spot it: each term carries exactly one coordinate from each vector, like x1y1 x_1y_1 or x2y1 x_2y_1 .

Check you’ve got it: is the rule f(u, v) = x1y1 + x2 bilinear?

No. Step by step: with u⃗=(1,2) \vec u = (1, 2) and v⃗=(3,−1) \vec v = (3, -1) it gives 3+2=5 3 + 2 = 5 . If you double v⃗ \vec v , it gives (1,2) (1, 2) with (6,−2) (6, -2) : 6+2=8 6 + 2 = 8 , not 10. The term x2 x_2 carries no coordinate of v⃗ \vec v , so it does not notice that you have doubled v⃗ \vec v . Quicker still, with a property that comes a bit further down: with v⃗=0⃗ \vec v = \vec 0 it should give 0, and it gives x2=2 x_2 = 2 .

And the skatepark? The height of the ramp will come from a rule like this by putting the same vector in twice: u⃗⋅u⃗=x2+y2 \vec u \cdot \vec u = x^2 + y^2 is the bowl. First the rule; the ramp, later. Now, the official names.

A bilinear form on a vector space VV is a rule ff that takes two vectors and returns a real number:

f:V×V→R,(u⃗,v⃗)↦f(u⃗,v⃗) f : V \times V \to \mathbb{R}, \qquad (\vec u, \vec v) \mapsto f(\vec u, \vec v)

and that is linear in each vector when the other one is held fixed:

f(λ1u⃗1+λ2u⃗2,  v⃗)=λ1f(u⃗1,v⃗)+λ2f(u⃗2,v⃗) f(\lambda_1\vec u_1 + \lambda_2\vec u_2,\; \vec v) = \lambda_1 f(\vec u_1, \vec v) + \lambda_2 f(\vec u_2, \vec v)
f(u⃗,  λ1v⃗1+λ2v⃗2)=λ1f(u⃗,v⃗1)+λ2f(u⃗,v⃗2) f(\vec u,\; \lambda_1\vec v_1 + \lambda_2\vec v_2) = \lambda_1 f(\vec u, \vec v_1) + \lambda_2 f(\vec u, \vec v_2)

The example you already know is the dot product from topic 4: u⃗⋅v⃗=x1y1+x2y2\vec u \cdot \vec v = x_1y_1 + x_2y_2, with u⃗=(x1,x2)\vec u = (x_1, x_2) and v⃗=(y1,y2)\vec v = (y_1, y_2). A bilinear form is the same thing with other coefficients. For instance,

f(u⃗,v⃗)=2x1y1+x1y2+x2y1+3x2y2 f(\vec u, \vec v) = 2x_1y_1 + x_1y_2 + x_2y_1 + 3x_2y_2

is like a dot product that «weighs» each direction differently. With u⃗=(1,0)\vec u = (1, 0) and v⃗=(0,1)\vec v = (0, 1) it gives f=1f = 1, even though those vectors are perpendicular under the usual dot product.

Two properties that follow from linearity and come up in the test:

  1. f(u⃗,0⃗)=f(0⃗,v⃗)=0f(\vec u, \vec 0) = f(\vec 0, \vec v) = 0: if either of them is zero, the result is 0.
  2. f(−u⃗,v⃗)=f(u⃗,−v⃗)=−f(u⃗,v⃗)f(-\vec u, \vec v) = f(\vec u, -\vec v) = -f(\vec u, \vec v).

Confusing a bilinear form with a linear transformation. A transformation returns a vector; a bilinear form returns a number and takes two vectors. If an expression has products xiyjx_iy_j (one coordinate from each vector), it is bilinear; if each coordinate of the result is a sum of xix_i, it is a transformation.

The matrix of a bilinear form

Before the rule, a question: why are four numbers enough to know all of f f ? Because of linearity. Write u⃗=x1e⃗1+x2e⃗2 \vec u = x_1\vec e_1 + x_2\vec e_2 and v⃗=y1e⃗1+y2e⃗2 \vec v = y_1\vec e_1 + y_2\vec e_2 . Linearity in the first vector lets you take x1 x_1 and x2 x_2 outside, and linearity in the second, y1 y_1 and y2 y_2 . You are left with four pieces, one for each pair of basis vectors:

f(u⃗,v⃗)=x1y1 f(e⃗1,e⃗1)+x1y2 f(e⃗1,e⃗2)+x2y1 f(e⃗2,e⃗1)+x2y2 f(e⃗2,e⃗2) f(\vec u, \vec v) = x_1y_1\, f(\vec e_1, \vec e_1) + x_1y_2\, f(\vec e_1, \vec e_2) + x_2y_1\, f(\vec e_2, \vec e_1) + x_2y_2\, f(\vec e_2, \vec e_2)

If you know f f on those four pairs, you know it on any pair. With the f f of the example, f(e⃗1,e⃗1)=2 f(\vec e_1, \vec e_1) = 2 , f(e⃗1,e⃗2)=1 f(\vec e_1, \vec e_2) = 1 , f(e⃗2,e⃗1)=1 f(\vec e_2, \vec e_1) = 1 and f(e⃗2,e⃗2)=3 f(\vec e_2, \vec e_2) = 3 . With u⃗=(1,2) \vec u = (1, 2) and v⃗=(3,−1) \vec v = (3, -1) , piece by piece:

Piecexi x_i yj y_j f(e⃗i,e⃗j) f(\vec e_i, \vec e_j) ContributesWhy
x1y1 x_1y_1 1326First coordinate of both, with its weight 2
x1y2 x_1y_2 1−1 -1 1−1 -1 First of u⃗ \vec u with second of v⃗ \vec v
x2y1 x_2y_1 2316Second of u⃗ \vec u with first of v⃗ \vec v : it is a different piece, even if it weighs the same
x2y2 x_2y_2 2−1 -1 3−6 -6 Second of both, with its weight 3
Total5The four pieces are added up

Those four numbers, placed in a 2×2 2 \times 2 table with the row for the first vector and the column for the second, are the matrix of f f . That is exactly what the definition says.

As with transformations, everything is decided in a basis. If B={e⃗1,…,e⃗n}B = \{\vec e_1, \dots, \vec e_n\}, the associated matrix of ff in BB is the one with the number

aij=f(e⃗i,e⃗j) a_{ij} = f(\vec e_i, \vec e_j)

in entry (i,j)(i, j), and with it, writing the coordinates of u⃗\vec u as a row and those of v⃗\vec v as a column,

f(u⃗,v⃗)=XtAY=(x1    x2    ⋯ )(a11a12⋯a21a22⋯⋮⋱)(y1y2⋮) f(\vec u, \vec v) = X^tAY = (x_1 \;\; x_2 \;\; \cdots) \begin{pmatrix} a_{11} & a_{12} & \cdots \\ a_{21} & a_{22} & \cdots \\ \vdots & & \ddots \end{pmatrix}\begin{pmatrix} y_1 \\ y_2 \\ \vdots \end{pmatrix}

With the standard basis there is a quick rule: the coefficient of xiyjx_iy_j goes in row ii, column jj. The xx picks the row and the yy, the column. In the example above:

f=2x1y1+1x1y2+1x2y1+3x2y2  ⇒  A=(2113) f = 2x_1y_1 + 1x_1y_2 + 1x_2y_1 + 3x_2y_2 \;\Rightarrow\; A = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}
The rule for writing the matrixThe four terms 2x1y1, 1x1y2, 1x2y1 and 3x2y2 go to entries (1,1), (1,2), (2,1) and (2,2): the index of x gives the row and that of y the column. Result: the matrix (2 1; 1 3).y₁y₂x₁x₂21132x₁y₁→ (1, 1)1x₁y₂→ (1, 2)1x₂y₁→ (2, 1)3x₂y₂→ (2, 2)x picks the rowy picks the columnf = Xᵗ A Y
Coefficient of xᵢyⱼ in row i, column j.

Let us do a calculation to see that the product works. With u⃗=(1,2)\vec u = (1, 2) and v⃗=(3,−1)\vec v = (3, -1), first AYAY and then the row times that:

AY=(2113)(3−1)=(50),Xt(AY)=(1    2)(50)=5 AY = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} 3 \\ -1 \end{pmatrix} = \begin{pmatrix} 5 \\ 0 \end{pmatrix}, \qquad X^t(AY) = (1 \;\; 2)\begin{pmatrix} 5 \\ 0 \end{pmatrix} = 5

And substituting into the expression: 2⋅3+1⋅(−1)+2⋅3+3⋅2⋅(−1)=6−1+6−6=52 \cdot 3 + 1 \cdot (-1) + 2 \cdot 3 + 3 \cdot 2 \cdot (-1) = 6 – 1 + 6 – 6 = 5. It matches.

Writing XAYtXAY^t or putting the coordinates of u⃗\vec u in a column. The order is row · matrix · column: the first vector as a row (transposed), the second as a column. With a matrix that is not symmetric, changing the order changes the result.

Symmetric and antisymmetric

A bilinear form is:

  • Symmetric if f(u⃗,v⃗)=f(v⃗,u⃗)f(\vec u, \vec v) = f(\vec v, \vec u) for every pair of vectors, that is, if its matrix is symmetric (At=AA^t = A). The example above and the dot product are.
  • Antisymmetric if f(u⃗,v⃗)=−f(v⃗,u⃗)f(\vec u, \vec v) = -f(\vec v, \vec u), that is, if At=−AA^t = -A. An example with history: f(u⃗,v⃗)=x1y2−x2y1f(\vec u, \vec v) = x_1y_2 – x_2y_1 is the determinant ∣x1y1x2y2∣\begin{vmatrix} x_1 & y_1 \\ x_2 & y_2 \end{vmatrix}, the signed area of the parallelogram spanned by u⃗\vec u and v⃗\vec v, the one you saw in topic 5.

Not every bilinear form is one or the other: x1y1+2x1y2−x2y2x_1y_1 + 2x_1y_2 – x_2y_2 has matrix (120−1)\begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix}, which is neither symmetric nor antisymmetric.

Change of basis: congruent matrices

If you change basis, the matrix of ff changes, and the formula is not the one from topic 5. If CC is the change-of-basis matrix from the new basis B′B' to the old one BB (the vectors of B′B' in columns):

A′=CtAC A' = C^tAC

The reason: if X=CX′X = CX' and Y=CY′Y = CY', then XtAY=(CX′)tA(CY′)=X′t(CtAC)Y′X^tAY = (CX')^tA(CY') = X'^t(C^tAC)Y'. The two CC matrices come from the two vectors that ff takes.

There is another way to compute A′A', straight from the definition: aij′=f(e⃗i′,e⃗j′)a'_{ij} = f(\vec e'_i, \vec e'_j). It is slower, but useful as a check.

Two matrices with A′=CtACA' = C^tAC (with CC invertible) are called congruent. They have the same rank, called the rank of the bilinear form. But, careful, in general they do not have the same determinant or the same eigenvalues.

Linear transformation (topic 5)Bilinear form (topic 6)
TakesOne vectorTwo vectors
ReturnsA vectorA number
ExpressionY=AXY = AXf=XtAYf = X^tAY
Change of basisA′=C−1ACA' = C^{-1}AC (similar)A′=CtACA' = C^tAC (congruent)
PreservedDeterminant, trace, eigenvalues, rankThe rank (and the signs of the diagonal, as you will see)

With the example and the basis B′={(1,0),  (1,−2)}B' = \{(1, 0),\; (1, -2)\}:

C=(110−2),AC=(2113)(110−2)=(201−5),A′=Ct(AC)=(101−2)(201−5)=(20010) C = \begin{pmatrix} 1 & 1 \\ 0 & -2 \end{pmatrix}, \quad AC = \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} 1 & 1 \\ 0 & -2 \end{pmatrix} = \begin{pmatrix} 2 & 0 \\ 1 & -5 \end{pmatrix}, \quad A' = C^t(AC) = \begin{pmatrix} 1 & 0 \\ 1 & -2 \end{pmatrix}\begin{pmatrix} 2 & 0 \\ 1 & -5 \end{pmatrix} = \begin{pmatrix} 2 & 0 \\ 0 & 10 \end{pmatrix}

Diagonal, and not by chance: f((1,0),(1,−2))=2⋅1+1⋅(−2)+0+0=0f((1, 0), (1, -2)) = 2 \cdot 1 + 1 \cdot (-2) + 0 + 0 = 0. The two basis vectors are «perpendicular for ff». That is called being conjugate, and it is the idea behind almost everything left in this topic.

Using C−1ACC^{-1}AC with a bilinear form. That is the formula for transformations. Here, CtACC^tAC: no inverses, with the transpose. If you start from a symmetric matrix and get one that is not symmetric, you used the wrong formula (CtACC^tAC always preserves symmetry).

The new matrix, entry by entry

CtAC C^tAC gives A′ A' in one go; the other way, aij′=f(e⃗i′,e⃗j′) a'_{ij} = f(\vec e'_i, \vec e'_j) , shows what each entry means. The new vectors are e⃗1′=(1,0) \vec e'_1 = (1, 0) and e⃗2′=(1,−2) \vec e'_2 = (1, -2) , and the rule is f=2x1y1+x1y2+x2y1+3x2y2 f = 2x_1y_1 + x_1y_2 + x_2y_1 + 3x_2y_2 :

EntryPairCalculationResultWhy
a11′ a'_{11} (1,0) (1, 0) with (1,0) (1, 0) 2⋅1⋅1+0+0+0 2 \cdot 1 \cdot 1 + 0 + 0 + 0 2e⃗1′ \vec e'_1 is the old e⃗1 \vec e_1 : the entry does not change
a12′ a'_{12} (1,0) (1, 0) with (1,−2) (1, -2) 2⋅1⋅1+1⋅1⋅(−2)+0+0 2 \cdot 1 \cdot 1 + 1 \cdot 1 \cdot (-2) + 0 + 0 0The 2 and the −2 -2 cancel: the two vectors are conjugate
a21′ a'_{21} (1,−2) (1, -2) with (1,0) (1, 0) 2⋅1⋅1+0+1⋅(−2)⋅1+0 2 \cdot 1 \cdot 1 + 0 + 1 \cdot (-2) \cdot 1 + 0 0The form is symmetric: it has to give the same as a12′ a'_{12}
a22′ a'_{22} (1,−2) (1, -2) with (1,−2) (1, -2) 2−2−2+3⋅(−2)⋅(−2) 2 – 2 – 2 + 3 \cdot (-2) \cdot (-2) 10The four pieces, with x2=y2=−2 x_2 = y_2 = -2

The same A′ A' as with the product, and you can see where the 10 comes from: f f of the second vector with itself.

Look at the determinants: det⁡A=6−1=5 \det A = 6 – 1 = 5 and det⁡A′=20 \det A' = 20 . They do not match, as warned above, but they do not change at random: det⁡A′=det⁡(Ct)det⁡Adet⁡C=(det⁡C)2det⁡A=(−2)2⋅5 \det A' = \det(C^t)\det A\det C = (\det C)^2 \det A = (-2)^2 \cdot 5 . Since (det⁡C)2 (\det C)^2 is always positive, the sign of the determinant is preserved.

Quadratic forms: the height of the ramp

Before the formula, get on the ramp: work out the height at a few points on the ground for the bowl x2+y2 x^2 + y^2 , the half-pipe x2 x^2 and the saddle x2−y2 x^2 – y^2 :

PointBowl x2+y2 x^2 + y^2 Half-pipe x2 x^2 Saddle x2−y2 x^2 – y^2 Why
(1,0) (1, 0) 111One step in the x x direction: all three rise
(0,1) (0, 1) 10−1 -1 One step in the y y direction: the bowl rises, the half-pipe stays flat, the saddle falls
(2,0) (2, 0) 444Twice as far as (1,0) (1, 0) : four times higher, not twice
(−1,0) (-1, 0) 111Backwards it rises as much as forwards: the signs disappear when squaring
(1,1) (1, 1) 210In the saddle, what it gains in x x it loses in y y

Three things come out on their own. At the origin, height 0. Going twice as far multiplies the height by 4: the mark that every term has degree 2. And the height at u⃗ \vec u is the dot product of u⃗ \vec u with itself: (1,1)⋅(1,1)=2 (1, 1) \cdot (1, 1) = 2 , exactly what the bowl gives.

Check you’ve got it: which ramp is w = -x², and what height does it have at (0, 3) and at (2, 0)?

It is the upside-down half-pipe: w(0,3)=0 w(0, 3) = 0 and w(2,0)=−4 w(2, 0) = -4 . Step by step: at (0,3) (0, 3) the x x is 0, so the height is 0: flat along its length. At (2,0) (2, 0) , −(22)=−4 -(2^2) = -4 : towards the sides it falls, four times more than at (1,0) (1, 0) . It never rises and there are points other than the origin with height 0: negative semidefinite.

A quadratic form is exactly that, a vector «with itself», but with any symmetric bilinear form instead of the dot product.

If you put the same vector twice into a symmetric bilinear form, you get a quadratic form:

w(u⃗)=f(u⃗,u⃗)=XtAX w(\vec u) = f(\vec u, \vec u) = X^tAX

With the example, w(x,y)=2x2+xy+yx+3y2=2x2+2xy+3y2w(x, y) = 2x^2 + x y + y x + 3y^2 = 2x^2 + 2xy + 3y^2. Every term has degree 2: squares x2x^2, y2y^2 and cross products xyxy. With the usual dot product, w(u⃗)=u⃗⋅u⃗=x2+y2=∥u⃗∥2w(\vec u) = \vec u \cdot \vec u = x^2 + y^2 = \|\vec u\|^2: the squared length.

This is where the skatepark comes in. If (x,y)(x, y) is the position on the ground measured from the lowest point of a ramp, the height at each point is, close up, a quadratic form. Three ramps, three forms:

  • The bowl: w=x2+y2w = x^2 + y^2. It rises in every direction.
  • The half-pipe (channel): w=x2w = x^2. It rises towards the sides and is flat along its length (in the yy direction, the height does not change).
  • The saddle ramp: w=x2−y2w = x^2 – y^2. It rises in the xx direction and falls in the yy direction.
Three ramps, three quadratic formsThree height maps seen from above. The bowl, x² + y², is coral everywhere except the center and its level curves are circles. The half-pipe, x², is coral at the sides and white along the vertical axis, with straight level curves. The saddle, x² − y², is coral left and right and indigo above and below, with hyperbolas.Bowlw = x² + y²positive definiteHalf-pipew = x²positive semidefiniteSaddlew = x² − y²indefinitegoes up (w > 0)goes down (w < 0)
The colour says whether the ramp goes up or down; the curves join points at the same height.

Properties of a quadratic form you will be asked about:

  1. w(0⃗)=0w(\vec 0) = 0: at the lowest point, height zero.
  2. w(λu⃗)=λ2w(u⃗)w(\lambda\vec u) = \lambda^2 w(\vec u): if you go twice as far in the same direction, the height is multiplied by 4. That is why it is «quadratic».
  3. w(u⃗+v⃗)=w(u⃗)+w(v⃗)+f(u⃗,v⃗)+f(v⃗,u⃗)w(\vec u + \vec v) = w(\vec u) + w(\vec v) + f(\vec u, \vec v) + f(\vec v, \vec u).

From the expression to the matrix: the cross term is split in half

The matrix of ww is that of its symmetric bilinear form, so it is always symmetric. To write it from the expression:

  • The coefficients of the squares xi2x_i^2 go on the diagonal.
  • The coefficient of each cross term xixjx_ix_j is divided by 2 and goes in entries (i,j)(i, j) and (j,i)(j, i).

The reason is the one from my story: XtAXX^tAX adds aijxixja_{ij}x_ix_j and ajixjxia_{ji}x_jx_i, which are the same term. If you put 6 in both entries, you get 6xy+6xy=12xy6xy + 6xy = 12xy.

w=x2+6xy+2y2  ⇒  A=(1332) w = x^2 + 6xy + 2y^2 \;\Rightarrow\; A = \begin{pmatrix} 1 & 3 \\ 3 & 2 \end{pmatrix}

Check: (x    y)(1332)(xy)=x2+3xy+3yx+2y2=x2+6xy+2y2(x \;\; y)\begin{pmatrix} 1 & 3 \\ 3 & 2 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = x^2 + 3xy + 3yx + 2y^2 = x^2 + 6xy + 2y^2.

The cross term is sharedThe form x² + 6xy + 2y². Left: the matrix with 6 in both cross entries, which multiplies out to 12xy, double. Right: the matrix with 3 in each entry, giving 3xy + 3yx = 6xy.w = x² + 6xy + 2y²Wrong: 6 in both1662→ x² + 12xy + 2y²Right: 6 / 2 = 3 in each1332→ x² + 3xy + 3yx + 2y²= x² + 6xy + 2y²
Entries (1, 2) and (2, 1) produce the same term: each takes half.

The polar form: the symmetric bilinear form behind it

One quadratic form comes from infinitely many bilinear forms: 2x1y22x_1y_2, x1y2+x2y1x_1y_2 + x_2y_1 and 3x1y2−x2y13x_1y_2 – x_2y_1 all give 2xy2xy when u⃗=v⃗\vec u = \vec v. But only one is symmetric: the polar form, computed as

fp(u⃗,v⃗)=12[w(u⃗+v⃗)−w(u⃗)−w(v⃗)] f_p(\vec u, \vec v) = \frac{1}{2}\big[w(\vec u + \vec v) – w(\vec u) – w(\vec v)\big]

or, faster, with the symmetric matrix: fp(u⃗,v⃗)=XtAYf_p(\vec u, \vec v) = X^tAY. For w=x2+6xy+2y2w = x^2 + 6xy + 2y^2:

fp(u⃗,v⃗)=(x1    x2)(1332)(y1y2)=x1y1+3x1y2+3x2y1+2x2y2 f_p(\vec u, \vec v) = (x_1 \;\; x_2)\begin{pmatrix} 1 & 3 \\ 3 & 2 \end{pmatrix}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix} = x_1y_1 + 3x_1y_2 + 3x_2y_1 + 2x_2y_2

Some Campus quizzes give as «associated bilinear form» an expression with the cross term not shared out, for example −2x1y2-2x_1y_2 in one entry and nothing in the other. That bilinear form gives the same ww, so it is not false that it is «associated», but the polar form, the one that defines the matrix of ww, is the symmetric one, with the term split in half. In the written exam, always the symmetric one.

The polar form formula, in words

The formula for fp f_p comes from the last property of the quadratic form. If f f is symmetric, f(u⃗,v⃗) f(\vec u, \vec v) and f(v⃗,u⃗) f(\vec v, \vec u) are the same number, and the property becomes w(u⃗+v⃗)=w(u⃗)+w(v⃗)+2f(u⃗,v⃗) w(\vec u + \vec v) = w(\vec u) + w(\vec v) + 2f(\vec u, \vec v) . Read aloud: the height of the sum is the height of each one plus twice what they «share». Solve for what they share and you have the polar form: from the height of the sum you take away the two separate heights and split what is left by 2.

With w=x2+6xy+2y2 w = x^2 + 6xy + 2y^2 , u⃗=(1,0) \vec u = (1, 0) and v⃗=(0,1) \vec v = (0, 1) :

StepCalculationResultWhy
Height of the sumw(1,1)=1+6+2 w(1, 1) = 1 + 6 + 2 9u⃗+v⃗=(1,1) \vec u + \vec v = (1, 1)
Height of u⃗ \vec u w(1,0) w(1, 0) 1Only the x2 x^2 is left
Height of v⃗ \vec v w(0,1) w(0, 1) 2Only the 2y2 2y^2 is left
What is left over9−1−2 9 – 1 – 2 6It is the whole cross term, the 6xy 6xy
Divided by 26/2 6 / 2 3It is entry (1,2) (1, 2) of the matrix

The 3 in the matrix comes out again, this time only from heights.

Conjugate vectors: perpendicular for the ramp

Two vectors u⃗\vec u and v⃗\vec v are conjugate with respect to ww if

fp(u⃗,v⃗)=XtAY=0 f_p(\vec u, \vec v) = X^tAY = 0

It is the idea of «perpendicular» with the rule of ff instead of the usual dot product. With the usual dot product, conjugate and orthogonal are the same.

All the vectors conjugate to a given one (or to a set) form a subspace. You compute it by writing the known vector as a row and the unknown (x,y,… )(x, y, \dots) as a column: you get a linear equation (or several), that is, implicit equations like the ones in topic 3.

With w=2x2+2xy+3y2w = 2x^2 + 2xy + 3y^2 (matrix (2113)\begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}), the vectors conjugate to (1,0)(1, 0):

(1    0)(2113)(xy)=(2    1)(xy)=2x+y=0 (1 \;\; 0)\begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = (2 \;\; 1)\begin{pmatrix} x \\ y \end{pmatrix} = 2x + y = 0

A line of R2\mathbb{R}^2, with basis {(1,−2)}\{(1, -2)\}. It is exactly the second vector of the basis that gave us the diagonal matrix in the change-of-basis section. In the picture, the curve w=1w = 1 is a tilted ellipse, and the conjugate vectors are the directions of two diameters that «share» the ellipse: the tangent at the tip of one is parallel to the other.

Two conjugate directionsThe tilted ellipse w = 1 of the form 2x² + 2xy + 3y². An orange arrow in direction (1, 0) and a violet one in direction (1, −2). The dashed line tangent to the ellipse at the tip of the orange arrow is parallel to the violet one.w = 2x² + 2xy + 3y²curve w = 1(1, 0) and (1, −2) are conjugate:(1 0) A (1, −2)ᵗ = 2 − 2 = 0With the usual dot productthey are not perpendicular:(1, 0) · (1, −2) = 1The tangent at the tip of(1, 0) is parallel to (1, −2).
Conjugate means «perpendicular» under the rule of w, not the usual one.

Checking whether two vectors are conjugate by looking at their usual dot product. (1,0)(1, 0) and (1,−2)(1, -2) are not perpendicular (1⋅1+0⋅(−2)=11 \cdot 1 + 0 \cdot (-2) = 1), but they are conjugate with respect to this ww. Always XtAYX^tAY with the matrix of the form.

Classifying a quadratic form: which ramp is it?

Classifying ww means saying what sign it has for every non-zero vector. There are five types:

TypeCondition (for every u⃗≠0⃗\vec u \neq \vec 0)RampExample in R2\mathbb{R}^2
Positive definitew(u⃗)>0w(\vec u) > 0Bowl: rises in every directionx2+y2x^2 + y^2
Negative definitew(u⃗)<0w(\vec u) < 0Mound: falls in every direction−x2−y2-x^2 – y^2
Positive semidefinitew(u⃗)≥0w(\vec u) \ge 0, with some u⃗≠0⃗\vec u \neq \vec 0 giving 0Half-pipe: rises or stays flatx2x^2
Negative semidefinitew(u⃗)≤0w(\vec u) \le 0, with some u⃗≠0⃗\vec u \neq \vec 0 giving 0Upside-down half-pipe−y2-y^2
IndefiniteTakes positive and negative valuesSaddlex2−y2x^2 – y^2

With these «clean» expressions (only squares) you see it at a glance. With w=2x2+2xy+3y2w = 2x^2 + 2xy + 3y^2 you no longer do: the cross term could make the total negative for some vector. The strategy is to get rid of the cross terms: find a basis in which the matrix is diagonal, because then w=d1x′2+d2y′2+⋯w = d_1x'^2 + d_2y'^2 + \cdots and you read the type from the signs of d1,d2,…d_1, d_2, \dots

The five types of quadratic formFive-row table: positive definite, all signs positive, signature (n, 0), all minors positive; negative definite, all negative, (0, n), minors alternating from negative; positive and negative semidefinite, with some zero, signatures (r, 0) and (0, r); indefinite, with positive and negative entries. For the last three, Sylvester does not decide.TypeSigns of D (ℝ³)SignatureSylvesterPositive definite(+, +, +)(n, 0)Δ₁ > 0, Δ₂ > 0, Δ₃ > 0Negative definite(−, −, −)(0, n)Δ₁ < 0, Δ₂ > 0, Δ₃ < 0Positive semidefinite(+, +, 0)(r, 0), r < nSylvester does not decideNegative semidefinite(−, 0, 0)(0, r), r < nSylvester does not decideIndefinite(+, −, …)(p, q)Sylvester does not decide
The diagonal signs decide; Sylvester only works for the first two rows.

The signature and the law of inertia

When you diagonalise ww, the numbers on the diagonal are not unique: they depend on the operations you do. But there is something that never changes: how many are positive, how many negative and how many zero. That is Sylvester’s law of inertia. That is why we define the signature

sig⁡(w)=(p,q) \operatorname{sig}(w) = (p, q)

with pp the number of positive entries on the diagonal and qq the number of negative ones. Also, rg⁡(w)=p+q\operatorname{rg}(w) = p + q, and if dim⁡V=n\dim V = n:

SignatureType
(n,0)(n, 0)Positive definite
(0,n)(0, n)Negative definite
(r,0)(r, 0) with r<nr < nPositive semidefinite
(0,r)(0, r) with r<nr < nNegative semidefinite
(p,q)(p, q) with p>0p > 0 and q>0q > 0Indefinite

Diagonalising by congruence

Before the algorithm, do it in your head: complete the square. Take the hidden saddle from the example coming up, w=x2+4xy+3y2 w = x^2 + 4xy + 3y^2 . The terms with x x are x2+4xy x^2 + 4xy , and (x+2y)2=x2+4xy+4y2 (x + 2y)^2 = x^2 + 4xy + 4y^2 has both of them, but with 4y2 4y^2 too many. So you take them away:

w=(x+2y)2−4y2+3y2=(x+2y)2−y2 w = (x + 2y)^2 – 4y^2 + 3y^2 = (x + 2y)^2 – y^2

If you call x′=x+2y x' = x + 2y and y′=y y' = y , the form is w=x′2−y′2 w = x'^2 – y'^2 : no cross terms, and you can read that it is a saddle. That is diagonalising. The new basis comes from undoing the change: y=y′ y = y' and x=x′−2y′ x = x' – 2y' , so the first new vector (x′=1,y′=0 x' = 1, y' = 0 ) is (1,0) (1, 0) and the second (x′=0,y′=1 x' = 0, y' = 1 ) is (−2,1) (-2, 1) . The algorithm will give exactly this basis.

With three or more variables it is easy to get lost completing squares; the algorithm does the same, in order: the operation r2→r2−2r1 r_2 \to r_2 – 2r_1 is the «+2y + 2y » in x+2y x + 2y , and what is left on the diagonal are the numbers in front of each square. With the R3 \mathbb{R}^3 example that comes later it is the same: x2+2y2+3z2+2xy−2yz=(x+y)2+(y−z)2+2z2 x^2 + 2y^2 + 3z^2 + 2xy – 2yz = (x + y)^2 + (y – z)^2 + 2z^2 , and the numbers in front, 1, 1 and 2, are those of its D D .

Check you’ve got it: complete the square of w = 2x² + 2xy + 3y². Which ramp is it?

w=2(x+12y)2+52y2 w = 2\left(x + \tfrac12 y\right)^2 + \tfrac52 y^2 : a bowl, positive definite. Step by step: 2x2+2xy=2(x2+xy) 2x^2 + 2xy = 2(x^2 + xy) , and the square that starts with x2+xy x^2 + xy is (x+12y)2=x2+xy+14y2 (x + \tfrac12 y)^2 = x^2 + xy + \tfrac14 y^2 , so 2(x+12y)2=2x2+2xy+12y2 2(x + \tfrac12 y)^2 = 2x^2 + 2xy + \tfrac12 y^2 : you have overshot by 12y2 \tfrac12 y^2 , and of 3y2 3y^2 you have 52y2 \tfrac52 y^2 left. Both numbers in front are positive: signature (2,0) (2, 0) . With the basis from the change of basis we got 2 and 10: different numbers, same signs. That is the law of inertia.

This is the exam method. It looks for a basis of conjugate vectors (the basis B′B') in which the matrix is diagonal, D=CtACD = C^tAC, using elementary operations.

The algorithm:

  1. Write AA and, to its right, the identity: (A∣I)(A \mid I).
  2. Do an elementary row operation on the whole strip (left and right) and, right after it, the same operation on the columns, but only on the left part. That way the left part stays symmetric.
  3. Repeat until the left is diagonal: that is DD. On the right you are left with CtC^t, and its rows are the vectors of the basis B′B'.
Diagonalising by congruenceThree steps on the strip (A | I) for A = (1 2; 2 3). First row 2 minus twice row 1, across the whole strip. Then column 2 minus twice column 1, only in the A part. D = diag(1, −1) is left on the left and C transposed on the right, whose rows are the basis (1, 0) and (−2, 1).(A | I)12102301f₂ → f₂ − 2f₁12100-1-21c₂ → c₂ − 2c₁10100-1-21row: across the whole stripcolumn: only in AD = diag(1, −1)Cᵗ: its rows are B' = {(1, 0), (−2, 1)}
Every row operation is followed by the same one on the columns of A.

An example in ℝ²: the hidden saddle

w=x2+4xy+3y2w = x^2 + 4xy + 3y^2, with A=(1223)A = \begin{pmatrix} 1 & 2 \\ 2 & 3 \end{pmatrix} (the 4 is split into 2 and 2). We need a 0 below the 1:

(12102301)→ r2→r2−2r1 (12100−1−21)→ c2→c2−2c1 (10100−1−21) \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 2 & 3 & 0 & 1 \end{array}\right) \xrightarrow{\, r_2 \to r_2 – 2r_1 \,} \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & -1 & -2 & 1 \end{array}\right) \xrightarrow{\, c_2 \to c_2 – 2c_1 \,} \left(\begin{array}{cc|cc} 1 & 0 & 1 & 0 \\ 0 & -1 & -2 & 1 \end{array}\right)

The column operation only touches the left part: it removes the 2 left at the top. Result:

D=(100−1),Ct=(10−21),B′={(1,0),  (−2,1)} D = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}, \qquad C^t = \begin{pmatrix} 1 & 0 \\ -2 & 1 \end{pmatrix}, \qquad B' = \{(1, 0),\; (-2, 1)\}

Signature (1,1)(1, 1): indefinite. It looked like a bowl because every coefficient is positive, but it is a saddle. Check with the vector (−2,1)(-2, 1): w(−2,1)=4−8+3=−1<0w(-2, 1) = 4 – 8 + 3 = -1 < 0, and with (1,0)(1, 0): w=1>0w = 1 > 0. And the two vectors of B′B' are conjugate: fp((1,0),(−2,1))=(1    2)⋅(−2,1)=−2+2=0f_p((1, 0), (-2, 1)) = (1 \;\; 2)\cdot(-2, 1) = -2 + 2 = 0.

In the new basis, with coordinates (x′,y′)(x', y'), the form is simply w=x′2−y′2w = x'^2 – y'^2: the saddle from the table, seen through the right glasses.

The same calculation, slowly and with the reason for each step:

StepOperationLeft (A)RightWhy
0Write (A∣I) (A \mid I) rows (1,2) (1, 2) and (2,3) (2, 3) rows (1,0) (1, 0) and (0,1) (0, 1) The right side will keep a record of the row operations
1r2→r2−2r1 r_2 \to r_2 – 2r_1 , on the whole striprows (1,2) (1, 2) and (0,−1) (0, -1) rows (1,0) (1, 0) and (−2,1) (-2, 1) The pivot is the 1: subtracting row 1 twice makes the 0 below it (2−2⋅1=0 2 – 2 \cdot 1 = 0 , 3−2⋅2=−1 3 – 2 \cdot 2 = -1 )
2c2→c2−2c1 c_2 \to c_2 – 2c_1 , only on the leftrows (1,0) (1, 0) and (0,−1) (0, -1) unchangedThe same operation on columns removes the 2 at the top (2−2⋅1=0 2 – 2 \cdot 1 = 0 ) and the left is symmetric again
3ReadD D : diagonal 1 and −1 -1 Ct C^t : rows (1,0) (1, 0) and (−2,1) (-2, 1) The left is now diagonal; the rows on the right are the basis B′ B'

Why is the column operation not done on the right? Because the right is only the record of the row operations, and those rows end up being the basis. And the basis you get, {(1,0),(−2,1)} \{(1, 0), (-2, 1)\} , is the one from completing the square: the −2 -2 is the «+2y + 2y » in x+2y x + 2y , undone.

Doing the operation only on the rows. You are left with (120−1)\begin{pmatrix} 1 & 2 \\ 0 & -1 \end{pmatrix}, which is triangular, neither diagonal nor symmetric. In congruence, every row operation is followed by the same one on the columns.

An example in ℝ³

w=x2+2y2+3z2+2xy−2yzw = x^2 + 2y^2 + 3z^2 + 2xy – 2yz, with

A=(11012−10−13) A = \begin{pmatrix} 1 & 1 & 0 \\ 1 & 2 & -1 \\ 0 & -1 & 3 \end{pmatrix}

First step: the pivot is the 1 at the top; with r2→r2−r1r_2 \to r_2 – r_1 and c2→c2−c1c_2 \to c_2 – c_1 we get zeros in row and column 1 (row 3 already has a 0).

(11010012−10100−13001)→ c2→c2−c1  r2→r2−r1 (10010001−1−1100−13001) \left(\begin{array}{ccc|ccc} 1 & 1 & 0 & 1 & 0 & 0 \\ 1 & 2 & -1 & 0 & 1 & 0 \\ 0 & -1 & 3 & 0 & 0 & 1 \end{array}\right) \xrightarrow[\, c_2 \to c_2 – c_1 \,]{\, r_2 \to r_2 – r_1 \,} \left(\begin{array}{ccc|ccc} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & -1 & -1 & 1 & 0 \\ 0 & -1 & 3 & 0 & 0 & 1 \end{array}\right)

Second step: the pivot is the 1 in the center; with r3→r3+r2r_3 \to r_3 + r_2 and c3→c3+c2c_3 \to c_3 + c_2:

→ c3→c3+c2  r3→r3+r2 (100100010−110002−111) \xrightarrow[\, c_3 \to c_3 + c_2 \,]{\, r_3 \to r_3 + r_2 \,} \left(\begin{array}{ccc|ccc} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & -1 & 1 & 0 \\ 0 & 0 & 2 & -1 & 1 & 1 \end{array}\right)
D=(100010002),B′={(1,0,0),  (−1,1,0),  (−1,1,1)} D = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 2 \end{pmatrix}, \qquad B' = \{(1, 0, 0),\; (-1, 1, 0),\; (-1, 1, 1)\}

Signature (3,0)(3, 0): positive definite. A bowl in three dimensions (it cannot be drawn, but the numbers say the same).

Check the last row of CtC^t by computing ww of that vector: it must give the last number of DD. Here, w(−1,1,1)=1+2+3−2−2=2w(-1, 1, 1) = 1 + 2 + 3 – 2 – 2 = 2. And any two rows must be conjugate.

The other method: finding the conjugates by hand

Exam solutions also use a second method, which gives the same: choose a first vector v⃗1\vec v_1 with w(v⃗1)≠0w(\vec v_1) \neq 0 (for instance (1,0,0)(1, 0, 0)), compute the subspace of its conjugates and pick a v⃗2\vec v_2 there with w(v⃗2)≠0w(\vec v_2) \neq 0; then a v⃗3\vec v_3 conjugate to both, and so on. The matrix in the basis {v⃗1,v⃗2,v⃗3}\{\vec v_1, \vec v_2, \vec v_3\} is diagonal with w(v⃗i)w(\vec v_i) on the diagonal. In the example, the conjugates of (1,0,0)(1, 0, 0) satisfy x+y=0x + y = 0, hence (−1,1,0)(-1, 1, 0); the conjugates of both satisfy x+y=0x + y = 0 and y−z=0y – z = 0, hence (−1,1,1)(-1, 1, 1). The same basis.

And by similarity, with eigenvalues

Since AA is symmetric, it can also be diagonalised as in topic 5, with D=P−1APD = P^{-1}AP. Then the diagonal holds the eigenvalues, and the signature is read from their signs: pp = positive eigenvalues and qq = negative ones. The drawback is practical: the eigenvalues are almost never integers. Those of (1223)\begin{pmatrix} 1 & 2 \\ 2 & 3 \end{pmatrix} are 2±52 \pm \sqrt 5, that is, about 4.244.24 and −0.24-0.24: one positive and one negative, signature (1,1)(1, 1), as by congruence, but with much more work.

There is one case where the eigenvalue method is lovely: when they do come out nicely. The form w=2x2+2xy+2y2w = 2x^2 + 2xy + 2y^2 has the matrix of the diagonal filter from topic 5, (2112)\begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}, with eigenvalues 1 and 3 and eigenvectors (1,−1)(1, -1) and (1,1)(1, 1). It is an elongated bowl, and its axes are the eigenvectors: it rises slowly (λ=1\lambda = 1) in the direction (1,−1)(1, -1) and quickly (λ=3\lambda = 3) in the direction (1,1)(1, 1).

The elongated bowl and its axesHeight map of 2x² + 2xy + 2y²: ellipses tilted 45 degrees. An orange arrow in direction (1, 1), the short axis, where it rises fastest; a violet one in direction (1, −1), the long axis, where it rises slowest.w = 2x² + 2xy + 2y²matrix (2 1; 1 2) from topic 5Eigenvector (1, 1), λ = 3:the bowl rises fastEigenvector (1, −1), λ = 1:the bowl rises slowlyThe axes of the ellipsesare the eigenvectors.
Large eigenvalue, short axis: the ramp rises sooner in that direction.

In the Plane transformations simulator, if you type a symmetric matrix you can see the curve XtAX=1X^tAX = 1 (an ellipse if it is positive definite, a hyperbola if it is indefinite) with its axes, which are the eigenvectors.

Sylvester’s criterion: classifying without diagonalising

Before the criterion, an observation. In the R3 \mathbb{R}^3 example, the diagonal came out 1, 1 and 2. Multiply them from left to right, accumulating: 1, then 1⋅1=1 1 \cdot 1 = 1 , then 1⋅1⋅2=2 1 \cdot 1 \cdot 2 = 2 . Now work out the determinants of the top-left corners of its matrix A A : the 1×1 1 \times 1 one is 1, the 2×2 2 \times 2 one is 2−1=1 2 – 1 = 1 and the 3×3 3 \times 3 one is 2. The same numbers come out. With the hidden saddle, the same: diagonal 1 and −1 -1 , products 1 and −1 -1 , and the corners give 1 and 3−4=−1 3 – 4 = -1 .

It is not a coincidence. If you diagonalise only with «to a lower row, add or subtract a multiple of a row above» (and the same on columns), the determinants of the corners do not change. And at the end, with the matrix diagonal, each corner equals the product of the diagonal numbers that fall inside it. The other way round: each diagonal number is a corner divided by the previous one.

With that, the criterion follows on its own: if all the diagonal numbers are positive, so are the accumulated products; if they are all negative, the products alternate (one negative, two give positive, three give negative…). Those corner determinants have an official name, leading principal minors, and the shortcut that comes out of this is called Sylvester’s criterion.

Check you’ve got it: classify w = -x² + 2xy – 2y² with Sylvester.

Negative definite. Step by step: the matrix is (−111−2) \begin{pmatrix} -1 & 1 \\ 1 & -2 \end{pmatrix} (the 2xy 2xy is split into 1 and 1). The first corner is −1<0 -1 < 0 and the second, (−1)(−2)−1⋅1=2−1=1>0 (-1)(-2) – 1 \cdot 1 = 2 – 1 = 1 > 0 : they alternate starting with negative. The diagonal numbers would be −1 -1 and 1/(−1)=−1 1 / (-1) = -1 , both negative. Completing the square: w=−(x−y)2−y2 w = -(x – y)^2 – y^2 , a mound.

To find out whether a form is definite (positive or negative) there is a shortcut with determinants. The leading principal minors of AA are the determinants of the top-left corners:

Δ1=a11,Δ2=∣a11a12a21a22∣,Δ3=∣a11a12a13a21a22a23a31a32a33∣,… \Delta_1 = a_{11}, \qquad \Delta_2 = \begin{vmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{vmatrix}, \qquad \Delta_3 = \begin{vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{vmatrix}, \quad \dots

Sylvester’s criterion:

  • ww is positive definite   ⟺  \iff Δi>0\Delta_i > 0 for all ii.
  • ww is negative definite   ⟺  \iff the signs alternate starting with negative: Δ1<0\Delta_1 < 0, Δ2>0\Delta_2 > 0, Δ3<0\Delta_3 < 0, … (odd orders negative, even orders positive).
The leading principal minorsThe matrix (1 1 0; 1 2 −1; 0 −1 3) with three nested boxes from the top-left corner: of order 1, 2 and 3. Their determinants are 1, 1 and 2, all positive, so the form is positive definite.11012-10-13Δ₁ = 1Δ₂ = 2 − 1 = 1Δ₃ = 2all > 0 → positive definitenegative definite would be −, +, −
Always from the top-left corner, growing one step at a time.

With the R3\mathbb{R}^3 example: Δ1=1\Delta_1 = 1, Δ2=2−1=1\Delta_2 = 2 – 1 = 1 and Δ3=1⋅(6−1)−1⋅(3−0)+0=2\Delta_3 = 1 \cdot (6 – 1) – 1 \cdot (3 – 0) + 0 = 2. All three positive: positive definite, the same as by congruence (and notice that Δ1\Delta_1, Δ2/Δ1\Delta_2/\Delta_1 and Δ3/Δ2\Delta_3/\Delta_2 are 1, 1 and 2: the diagonal we got).

Why do they alternate for negative definite? Because if ww is negative definite, −w-w is positive definite, and changing the sign of a matrix of order kk multiplies its determinant by (−1)k(-1)^k: the odd-order ones change sign.

Thinking negative definite means «all minors negative». With −x2−y2-x^2 – y^2, Δ1=−1<0\Delta_1 = -1 < 0 but Δ2=∣−100−1∣=1>0\Delta_2 = \begin{vmatrix} -1 & 0 \\ 0 & -1 \end{vmatrix} = 1 > 0. The even ones are positive.

Sylvester only decides whether it is definite. If some minor is 0, or the signs follow neither pattern, the form is semidefinite or indefinite, and to know which you have to diagonalise. The half-pipe x2x^2 has Δ1=1\Delta_1 = 1 and Δ2=0\Delta_2 = 0: Sylvester says nothing, and it is positive semidefinite.

A dot product with another rule: the cosine «according to f»

This closes the circle with topic 4. A dot product (inner product) is precisely a symmetric bilinear form whose quadratic form is positive definite. So every positive definite form gives you a new way of measuring lengths and angles:

∥u⃗∥f=w(u⃗),cos⁡θ=f(u⃗,v⃗)w(u⃗) w(v⃗) \|\vec u\|_f = \sqrt{w(\vec u)}, \qquad \cos\theta = \frac{f(\vec u, \vec v)}{\sqrt{w(\vec u)}\,\sqrt{w(\vec v)}}

With the positive definite form of the R3\mathbb{R}^3 example (matrix (11012−10−13)\begin{pmatrix} 1 & 1 & 0 \\ 1 & 2 & -1 \\ 0 & -1 & 3 \end{pmatrix}), the angle between e⃗1=(1,0,0)\vec e_1 = (1, 0, 0) and e⃗2=(0,1,0)\vec e_2 = (0, 1, 0) is:

cos⁡θ=f(e⃗1,e⃗2)w(e⃗1)w(e⃗2)=a12a11a22=11 2=22  ⇒  θ=45∘ \cos\theta = \frac{f(\vec e_1, \vec e_2)}{\sqrt{w(\vec e_1)}\sqrt{w(\vec e_2)}} = \frac{a_{12}}{\sqrt{a_{11}}\sqrt{a_{22}}} = \frac{1}{\sqrt{1}\,\sqrt{2}} = \frac{\sqrt 2}{2} \;\Rightarrow\; \theta = 45^\circ

With the usual dot product, those two vectors form 90°; with this rule, 45°. It is a classic exam question: «study whether ww defines a dot product and, if so, compute the cosine of the angle between…». If the form is not positive definite, the answer is that it is not a dot product and there is no cosine to compute.

Computing the cosine without first checking that ww is positive definite. If it is not, w(u⃗)w(\vec u) can be negative or zero and the square root in the denominator makes no sense. Classify first; cosine after.

The same in MATLAB

MATLAB has no command to diagonalise by congruence, but it checks everything else. This script goes over the R3\mathbb{R}^3 example: the expression of ww from the matrix, the diagonal with CtACC^tAC, Sylvester’s minors and the cosine.

format rat
A = [1 1 0; 1 2 -1; 0 -1 3];       % symmetric matrix of w
syms x y z
w = expand([x y z]*A*[x; y; z])    % the expression of w
Ct = [1 0 0; -1 1 0; -1 1 1];      % rows = basis B' (congruence)
D = Ct*A*Ct'                       % C^t A C, with C = Ct'
det(A(1,1)), det(A(1:2,1:2)), det(A)   % leading principal minors
e1 = [1;0;0];  e2 = [0;1;0];
c = (e1'*A*e2) / sqrt((e1'*A*e1)*(e2'*A*e2))   % cosine according to f

Output:

 
w =
 
x^2 + 2*x*y + 2*y^2 - 2*y*z + 3*z^2
 

D =

       1              0              0       
       0              1              0       
       0              0              2       

ans =

       1       

ans =

       1       

ans =

       2       

c =

     985/1393  

What to look at:

  • [x y z]*A*[x; y; z] is literally XtAXX^tAX with letters; expand multiplies it out and the cross terms come out with their whole coefficient (2xy2xy), even though in the matrix they are shared (1 and 1).
  • Ct*A*Ct' is CtACC^tAC with C=(Ct)tC = (C^t)^t: it gives the paper DD. If you get a row of Ct wrong, it stops coming out diagonal.
  • A(1:2,1:2) is the top-left 2×22 \times 2 corner: its determinants are Sylvester’s minors.
  • The cosine comes out as 985/1393985/1393, the fraction format rat uses for 2/2≈0.7071\sqrt 2/2 \approx 0.7071. Type format short to see it as a decimal.

And the hidden saddle, by eigenvalues:

format short
A2 = [1 2; 2 3];        % w = x^2 + 4xy + 3y^2
eig(A2)                 % one negative and one positive eigenvalue
det(A2)                 % Delta_2 < 0: not definite

Output:

ans =

   -0.2361
    4.2361

ans =

    -1

The eigenvalues, about −0.24-0.24 and 4.244.24 (the 2∓52 \mp \sqrt 5), have different signs: indefinite, as by congruence.

Try it in the MATLAB playground

In the website’s MATLAB playground you can run this script without installing anything. It computes the height of three skatepark ramps at a few points and classifies them by their eigenvalues.

P = [1 0; 0 1; 1 1; 1 -1]';     % four points in columns
A = [1 0; 0 1];                 % bowl: x^2 + y^2
heights = diag(P'*A*P)'         % w at each point
eig(A)'                         % signs of the eigenvalues
A = [1 0; 0 0];                 % half-pipe: x^2
heights = diag(P'*A*P)'
eig(A)'
A = [1 0; 0 -1];                % saddle: x^2 - y^2
heights = diag(P'*A*P)'
eig(A)'

Things to look at:

  1. In the half-pipe, the point (0,1)(0, 1) has height 0 even though it is not the origin: that is what tells a semidefinite form from a definite one.
  2. In the saddle, (1,0)(1, 0) gives +1+1 and (0,1)(0, 1) gives −1-1: values of both signs, indefinite.
  3. Change the last A to [1 2; 2 3] (the hidden saddle) and look for a point with negative height.
  4. Try [2 1; 1 2] (the elongated bowl) and check that at (1,1)(1, 1) it rises faster than at (1,−1)(1, -1).

Summary

ConceptWhat it isHow to do it by handIn MATLAB
Bilinear formTwo vectors → a number, linear in eachf=XtAYf = X^tAY, aij=f(e⃗i,e⃗j)a_{ij} = f(\vec e_i, \vec e_j)x'*A*y
Change of basisCongruent matricesA′=CtACA' = C^tACC'*A*C
Quadratic formw(u⃗)=f(u⃗,u⃗)w(\vec u) = f(\vec u, \vec u)XtAXX^tAX; cross terms divided by 2expand([x y]*A*[x; y])
Polar formThe symmetric bilinear form of wwXtAYX^tAY with AA symmetricx'*A*y
Conjugatesfp(u⃗,v⃗)=0f_p(\vec u, \vec v) = 0Known vector as a row: implicit equationsu'*A (coefficients)
DiagonalisingD=CtACD = C^tAC with B′B' conjugate(A∣I)(A \mid I): same ERO on rows and columnsCt*A*Ct' (check)
Signature(p,q)(p, q): positives and negatives of DDSigns of the diagonal or of the eigenvalueseig(A)
SylvesterPositive or negative definiteSigns of Δ1,Δ2,…\Delta_1, \Delta_2, \dotsdet(A(1:k,1:k))
Dot productSymmetric and positive definitecos⁡θ=f(u⃗,v⃗)/w(u⃗)w(v⃗)\cos\theta = f(\vec u, \vec v)/\sqrt{w(\vec u)w(\vec v)}(u'*A*v)/sqrt(...)

Three ideas to take away:

  1. A quadratic form is the height of a ramp: its matrix is symmetric and the cross terms are split in half between the two entries.
  2. Classifying means getting rid of the cross terms. Diagonalising by congruence (the same operation on rows and columns), the signs of the diagonal give the signature, and that signature does not depend on how you diagonalise.
  3. Sylvester is a shortcut only for «definite»: all positive, or alternating starting with negative. If you get anything else, diagonalise. And only a positive definite form is a dot product you can measure angles with.

Now it is your turn: in the guided practice on bilinear and quadratic forms we solve five problems step by step, each one checked in MATLAB. And to check you have got it, the bilinear and quadratic forms exercises go from easy to hard, come with commented solutions and include a quiz like the Campus ones. After that, topic 7: complex numbers, where the roots of λ2+1=0\lambda^2 + 1 = 0 that the 90° rotation was missing finally appear. You will find them in complex numbers.

Next step: practiceBilinear and quadratic forms — guided practice with ramps that look like bowls, conjugates that are not perpendicular and a dot product with its cosine (and the diagonal that came out with fractions)

Did this article help you? Here is how you can support SergioLearns →