Bilinear 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)

In the classroom worksheet on quadratic forms I diagonalised a 3 × 3 matrix by congruence and got a −52-\tfrac52 on the diagonal. I rubbed it out three times thinking I had made a mistake, because I was expecting whole numbers, as in the class examples. There was no mistake: the diagonal of a congruence depends on the operations you choose and, if a pivot is 2, dividing gives halves. What does not change is the sign of each number, and for classifying that is all that matters.

This practice is about doing by hand, carefully, what you saw in the theory of bilinear and quadratic forms, and checking every result in MATLAB. There are five problems with the skatepark example: the matrix of a bilinear form that is not symmetric and its change of basis, the polar form and the conjugate vectors of a ramp in R3\mathbb{R}^3, a diagonalisation by congruence with fractions, a form with a parameter that is classified with Sylvester and used as a dot product and, at the end, a problem in the format of an exam exercise. They are all medium level, with numbers chosen so that fractions appear at some step, because they do in the exam too.

Before you start

Make sure you are clear on:

  • The rule for the matrix of a bilinear form: the coefficient of xiyjx_iy_j in row ii, column jj, and f=XtAYf = X^tAY.
  • That the matrix of a quadratic form is symmetric and that the cross terms are divided by 2.
  • The congruence algorithm: the same elementary operation on rows and columns, with the identity on the right following only the rows.
  • Sylvester’s criterion and what it is for.

If any of these feels shaky, go back over the theory before carrying on.

To check in MATLAB, syms x y z and expand([x y z]*A*[x; y; z]) give you back the expression of ww from the matrix: if it does not match the statement, the matrix is wrong. And Ct*A*Ct' checks a congruence without doing anything by hand.

How to solve a forms problem on paper

The method is always the same, in four steps:

  1. Data: write the matrix and check it with one term (the coefficient of x1y2x_1y_2, or the cross term of ww split by 2). If it is a quadratic form, check that it is symmetric.
  2. Method: decide what you are asked. Just whether it is definite? Sylvester. Classify fully, or a basis? Congruence. A cosine? First, check it is positive definite.
  3. Solve showing every step: in the congruence, each row operation with its column operation written next to it. If the marker cannot see both, they will think you only did the row one.
  4. Check: ww of each basis vector must give its number in DD, and two vectors of the basis must be conjugate.

Problem 1: a bilinear form that is not symmetric

Statement. The program that designs the ramps uses the bilinear form f(u⃗,v⃗)=3x1y1+x1y2−x2y1+2x2y2f(\vec u, \vec v) = 3x_1y_1 + x_1y_2 – x_2y_1 + 2x_2y_2 on R2\mathbb{R}^2.

a) Write its associated matrix in the standard basis and say whether ff is symmetric. b) Compute f((1,2),(3,−1))f((1, 2), (3, -1)) and f((3,−1),(1,2))f((3, -1), (1, 2)). c) Compute the quadratic form ww that ff defines and its polar form. d) Compute the matrix of ff in the basis B′={(1,1),  (0,1)}B' = \{(1, 1),\; (0, 1)\} both ways.

The idea

The matrix comes from the index rule. Since it will not be symmetric, the order of the vectors will matter in b). In c) something curious happens to the cross term, and in d) we use CtACC^tAC and check it with the definition aij′=f(e⃗i′,e⃗j′)a'_{ij} = f(\vec e'_i, \vec e'_j).

Before computing ww, think about what happens to x1y2−x2y1x_1y_2 – x_2y_1 when both vectors are the same.

Step by step

a) Coefficient of xiyjx_iy_j in entry (i,j)(i, j):

A=(31−12) A = \begin{pmatrix} 3 & 1 \\ -1 & 2 \end{pmatrix}

a12=1≠a21=−1a_{12} = 1 \neq a_{21} = -1: it is not symmetric.

b) With the row · matrix · column product:

f((1,2),(3,−1))=(1    2)(31−12)(3−1)=(1    2)(8−5)=8−10=−2 f((1, 2), (3, -1)) = (1 \;\; 2)\begin{pmatrix} 3 & 1 \\ -1 & 2 \end{pmatrix}\begin{pmatrix} 3 \\ -1 \end{pmatrix} = (1 \;\; 2)\begin{pmatrix} 8 \\ -5 \end{pmatrix} = 8 – 10 = -2
f((3,−1),(1,2))=(3    −1)(31−12)(12)=(3    −1)(53)=15−3=12 f((3, -1), (1, 2)) = (3 \;\; -1)\begin{pmatrix} 3 & 1 \\ -1 & 2 \end{pmatrix}\begin{pmatrix} 1 \\ 2 \end{pmatrix} = (3 \;\; -1)\begin{pmatrix} 5 \\ 3 \end{pmatrix} = 15 – 3 = 12

Different: with a non-symmetric form, order matters.

c) With u⃗=v⃗=(x,y)\vec u = \vec v = (x, y):

w(x,y)=f((x,y),(x,y))=3x2+xy−yx+2y2=3x2+2y2 w(x, y) = f((x, y), (x, y)) = 3x^2 + xy – yx + 2y^2 = 3x^2 + 2y^2

The cross term disappears! The antisymmetric part, x1y2−x2y1x_1y_2 – x_2y_1, always gives 0 when both vectors are equal. The polar form is the symmetric one whose matrix is read off ww: (3002)\begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix}, that is,

fp(u⃗,v⃗)=3x1y1+2x2y2 f_p(\vec u, \vec v) = 3x_1y_1 + 2x_2y_2

It is the «average» of AA and AtA^t: 12(A+At)=12(6004)\tfrac12(A + A^t) = \tfrac12\begin{pmatrix} 6 & 0 \\ 0 & 4 \end{pmatrix}. That is why a quadratic form has infinitely many «associated» bilinear forms (here, ff and fpf_p give the same ww) but a single polar one.

d) Method 1, with CC (the vectors of B′B' in columns):

C=(1011),AC=(31−12)(1011)=(4112),A′=CtAC=(1101)(4112)=(5312) C = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}, \quad AC = \begin{pmatrix} 3 & 1 \\ -1 & 2 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix} = \begin{pmatrix} 4 & 1 \\ 1 & 2 \end{pmatrix}, \quad A' = C^tAC = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}\begin{pmatrix} 4 & 1 \\ 1 & 2 \end{pmatrix} = \begin{pmatrix} 5 & 3 \\ 1 & 2 \end{pmatrix}

Method 2, entry by entry with e⃗1′=(1,1)\vec e'_1 = (1, 1) and e⃗2′=(0,1)\vec e'_2 = (0, 1):

EntrySumValue
a11′=f(e⃗1′,e⃗1′)a'_{11} = f(\vec e'_1, \vec e'_1)3+1−1+23 + 1 – 1 + 25
a12′=f(e⃗1′,e⃗2′)a'_{12} = f(\vec e'_1, \vec e'_2)3⋅0+1⋅1−1⋅0+2⋅13 \cdot 0 + 1 \cdot 1 – 1 \cdot 0 + 2 \cdot 13
a21′=f(e⃗2′,e⃗1′)a'_{21} = f(\vec e'_2, \vec e'_1)0+0−1⋅1+2⋅10 + 0 – 1 \cdot 1 + 2 \cdot 11
a22′=f(e⃗2′,e⃗2′)a'_{22} = f(\vec e'_2, \vec e'_2)2⋅1⋅12 \cdot 1 \cdot 12

They match. And A′A' is still not symmetric, like AA: congruence preserves whether a form is symmetric or not.

If the product CtAC C^tAC in method 1 went too fast, here it is entry by entry. The idea in words: first AC AC joins the rule f f with the new vectors (each column of AC AC is A A times a vector of B′ B' ); then Ct C^t puts the other new vector in front, as a row. Each entry of A′ A' is a row of Ct C^t times a column of AC AC :

EntryRow of Ct C^t Column of AC AC SumWhy
a11′ a'_{11} (1,1) (1, 1) (4,1) (4, 1) 4+1=5 4 + 1 = 5 Row 1 of Ct C^t is e⃗1′ \vec e'_1 and column 1 of AC AC is Ae⃗1′ A\vec e'_1 : it is f(e⃗1′,e⃗1′) f(\vec e'_1, \vec e'_1)
a12′ a'_{12} (1,1) (1, 1) (1,2) (1, 2) 1+2=3 1 + 2 = 3 e⃗1′ \vec e'_1 in front, e⃗2′ \vec e'_2 behind: f(e⃗1′,e⃗2′) f(\vec e'_1, \vec e'_2)
a21′ a'_{21} (0,1) (0, 1) (4,1) (4, 1) 0+1=1 0 + 1 = 1 Now e⃗2′ \vec e'_2 goes in front: since f f is not symmetric, it need not give 3
a22′ a'_{22} (0,1) (0, 1) (1,2) (1, 2) 0+2=2 0 + 2 = 2 f(e⃗2′,e⃗2′) f(\vec e'_2, \vec e'_2)

It is the method 2 table counted another way: that is why the two methods always match.

Check you’ve got it: what would happen if you used C⁻¹AC, as with transformations?

You would get a different matrix, and it would be wrong. Step by step: C−1=(10−11) C^{-1} = \begin{pmatrix} 1 & 0 \\ -1 & 1 \end{pmatrix} and C−1(AC)=(10−11)(4112)=(41−31) C^{-1}(AC) = \begin{pmatrix} 1 & 0 \\ -1 & 1 \end{pmatrix}\begin{pmatrix} 4 & 1 \\ 1 & 2 \end{pmatrix} = \begin{pmatrix} 4 & 1 \\ -3 & 1 \end{pmatrix} . One entry is enough to see it fails: entry (1,1) (1, 1) should be f(e⃗1′,e⃗1′)=5 f(\vec e'_1, \vec e'_1) = 5 , and here it comes out as 4. In a transformation the input and the output are vectors and one is undone with C−1 C^{-1} ; in a bilinear form both vectors go in, and both are changed with C C .

What the quadratic form seesThe matrix (3 1; −1 2) written as the sum of a symmetric one, (3 0; 0 2), and an antisymmetric one, (0 1; −1 0). The symmetric part gives w = 3x² + 2y²; the antisymmetric part gives xy − yx = 0 and adds nothing to w.31-12A=3002symmetric+01-10antisymmetricw = 3x² + 2y²xy − yx = 0The antisymmetricpart isinvisible in w
The polar form is the symmetric part: (A + Aᵗ) / 2.

Check it in MATLAB

A = [3 1; -1 2];
u = [1; 2];  v = [3; -1];
u'*A*v, v'*A*u              % b) order matters
syms x y
w = expand([x y]*A*[x; y])  % c) the cross term disappears
(A + A')/2                  % matrix of the polar form
C = [1 0; 1 1];             % B' in columns
C'*A*C                      % d)

Output:

ans =

    -2

ans =

    12

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

ans =

     3     0
     0     2

ans =

     5     3
     1     2

u'*A*v is XtAYX^tAY exactly: the apostrophe transposes the first vector into a row. And (A + A')/2 is the symmetric part of AA, the matrix of the polar form.

Questions you might ask

Why does the cross term disappear in ww? Because x1y2x_1y_2 and −x2y1-x_2y_1 with u⃗=v⃗\vec u = \vec v are xyxy and −yx-yx: they cancel. The whole antisymmetric part of a bilinear form is invisible to its quadratic form.

So is the matrix of ww equal to AA? No: the matrix of ww is always symmetric, that of fpf_p. Here, diag⁡(3,2)\operatorname{diag}(3, 2). AA is the matrix of ff, which is not the polar form.

Why is C−1C^{-1} not needed in d)? Because in a bilinear form both coordinates change with CC and one of them comes out transposed. C−1C^{-1} belongs to transformations.

What kind of ramp is w=3x2+2y2w = 3x^2 + 2y^2? A bowl: only squares with positive coefficients, positive definite. Steeper in the xx direction (coefficient 3).

Computing f((3,−1),(1,2))f((3, -1), (1, 2)) by moving only one vector across and getting −2-2 again. If the matrix is not symmetric, the result changes; if you get the same, check that the first vector is in the row.

Try it yourself

  1. Write the matrix of g(u⃗,v⃗)=x1y2−x2y1g(\vec u, \vec v) = x_1y_2 – x_2y_1, check that it is antisymmetric and that its quadratic form is zero.
  2. Compute the matrix of ff in the basis {(1,0),  (1,−1)}\{(1, 0),\; (1, -1)\} both ways.

Problem 2: the polar form and the conjugates of a ramp in ℝ³

Statement. The height of a new ramp is w(x,y,z)=x2+3y2−z2+4xy−2xz+6yzw(x, y, z) = x^2 + 3y^2 – z^2 + 4xy – 2xz + 6yz.

a) Write the matrix AA of ww and the expression of its polar form fpf_p. b) Check the value of fp((1,0,0),(0,1,0))f_p((1, 0, 0), (0, 1, 0)) with the formula 12[w(u⃗+v⃗)−w(u⃗)−w(v⃗)]\tfrac12[w(\vec u + \vec v) – w(\vec u) – w(\vec v)]. c) Compute a basis of the subspace of vectors conjugate to (1,0,0)(1, 0, 0). d) Compute a non-zero vector conjugate to both (1,0,0)(1, 0, 0) and (0,0,1)(0, 0, 1).

The idea

Squares on the diagonal and each cross term, split by 2, in its two entries. The conjugates are implicit equations: the given vector as a row, the unknown as a column. With two given vectors, two equations.

(1,0,0) A(1, 0, 0)\,A is simply the first row of AA. For the vectors conjugate to e⃗i\vec e_i, the equation is read straight off row ii.

Step by step

a) Diagonal: 1, 3 and −1-1. Cross terms: 4xy→24xy \to 2 in (1,2)(1, 2) and (2,1)(2, 1); −2xz→−1-2xz \to -1 in (1,3)(1, 3) and (3,1)(3, 1); 6yz→36yz \to 3 in (2,3)(2, 3) and (3,2)(3, 2):

A=(12−1233−13−1) A = \begin{pmatrix} 1 & 2 & -1 \\ 2 & 3 & 3 \\ -1 & 3 & -1 \end{pmatrix}
fp(u⃗,v⃗)=XtAY=x1y1+2x1y2−x1y3+2x2y1+3x2y2+3x2y3−x3y1+3x3y2−x3y3 f_p(\vec u, \vec v) = X^tAY = x_1y_1 + 2x_1y_2 – x_1y_3 + 2x_2y_1 + 3x_2y_2 + 3x_2y_3 – x_3y_1 + 3x_3y_2 – x_3y_3

Each cross term of ww appears twice in fpf_p with half the coefficient: 2x1y2+2x2y12x_1y_2 + 2x_2y_1 gives 4xy4xy back when u⃗=v⃗\vec u = \vec v.

b) With u⃗=(1,0,0)\vec u = (1, 0, 0) and v⃗=(0,1,0)\vec v = (0, 1, 0), from the matrix: fp=a12=2f_p = a_{12} = 2. From the formula: w(1,1,0)=1+3+4=8w(1, 1, 0) = 1 + 3 + 4 = 8, w(1,0,0)=1w(1, 0, 0) = 1, w(0,1,0)=3w(0, 1, 0) = 3, and

12(8−1−3)=12⋅4=2 \tfrac12(8 – 1 – 3) = \tfrac12 \cdot 4 = 2

The same. The formula is what tells you where the polar form comes from; the matrix is the quick way to use it.

c) Conjugates of (1,0,0)(1, 0, 0): the first row of AA times (x,y,z)(x, y, z):

(1    0    0) A(xyz)=(1    2    −1)(xyz)=x+2y−z=0 (1 \;\; 0 \;\; 0)\,A\begin{pmatrix} x \\ y \\ z \end{pmatrix} = (1 \;\; 2 \;\; -1)\begin{pmatrix} x \\ y \\ z \end{pmatrix} = x + 2y – z = 0

A plane. With y,zy, z as parameters, x=−2y+zx = -2y + z:

U={(−2y+z,  y,  z)},BU={(−2,1,0),  (1,0,1)} U = \{(-2y + z,\; y,\; z)\}, \qquad B_U = \{(-2, 1, 0),\; (1, 0, 1)\}

d) Being conjugate to (0,0,1)(0, 0, 1) adds the equation from the third row, −x+3y−z=0-x + 3y – z = 0. Both together:

x+2y−z=0−x+3y−z=0  → r2→r2+r1   x+2y−z=05y−2z=0 \begin{aligned} x + 2y – z &= 0 \\ -x + 3y – z &= 0 \end{aligned} \;\xrightarrow{\, r_2 \to r_2 + r_1 \,}\; \begin{aligned} x + 2y – z &= 0 \\ 5y – 2z &= 0 \end{aligned}

With y=2y = 2: z=5z = 5, x=−4+5=1x = -4 + 5 = 1. Vector: (1,2,5)(1, 2, 5). Check with row 3: −1+6−5=0-1 + 6 – 5 = 0.

Each given vector brings one equationThe matrix of w with rows 1 and 3 highlighted. Row 1 gives the equation x + 2y − z = 0 of the vectors conjugate to (1, 0, 0), a plane. Row 3 adds −x + 3y − z = 0 and leaves the line of the vector (1, 2, 5).12-1233-13-1row 1: x + 2y − z = 0row 3: −x + 3y − z = 0conjugate to (1, 0, 0)a plane: (−2,1,0), (1,0,1)to (1,0,0) and (0,0,1)a line: (1, 2, 5)
For the vectors conjugate to eᵢ, the equation is row i of A.

Check it in MATLAB

format rat
A = [1 2 -1; 2 3 3; -1 3 -1];
syms x y z
expand([x y z]*A*[x; y; z])     % gives back the w in the statement
null([1 0 0]*A, 'r')            % c) conjugates of (1,0,0)
null([1 0 0; 0 0 1]*A, 'r')     % d) conjugates of both

Output:

 
ans =
 
x^2 + 4*x*y - 2*x*z + 3*y^2 + 6*y*z - z^2
 

ans =

      -2              1       
       1              0       
       0              1       

ans =

       1/5     
       2/5     
       1       

null(u'*A, 'r') solves u⃗ tAv⃗=0\vec u^{\,t}A\vec v = 0: the basis of the conjugate subspace comes out in paper format. With two vectors, you put them in rows and both equations come out at once. The (1,2,5)(1, 2, 5) appears scaled to (1/5,2/5,1)(1/5, 2/5, 1) because null sets the last free variable to 1.

Questions you might ask

Why is the subspace in c) a plane and the one in d) a line? Each given vector adds an equation (if it is not redundant). In R3\mathbb{R}^3, one equation leaves a plane and two leave a line.

Is (1,0,0)(1, 0, 0) conjugate to itself? Only if w(1,0,0)=0w(1, 0, 0) = 0. Here it is 1, so no. Vectors conjugate to themselves (w=0w = 0) are called isotropic, and they only exist if the form is not definite.

What kind of ramp is this? Look at the diagonal: there is a −1-1 in the corner. That alone tells you it is not positive definite (w(0,0,1)=−1<0w(0, 0, 1) = -1 < 0). To know whether it is indefinite or semidefinite, you would have to diagonalise; try it in «Try it yourself».

Is the polar form unique? Yes: it is the only symmetric bilinear form that gives ww. That is why the matrix of ww is unique too.

Looking for the conjugates with the usual dot product, (1,0,0)⋅(x,y,z)=x=0(1, 0, 0) \cdot (x, y, z) = x = 0. Those are the ordinary perpendicular vectors. With the form, the equation is the row of AA: x+2y−z=0x + 2y – z = 0.

Try it yourself

  1. Diagonalise AA by congruence and check that its signature is (2,1)(2, 1): indefinite.
  2. Compute the vectors conjugate to (1,1,0)(1, 1, 0) and say whether (1,2,5)(1, 2, 5) is among them.

Problem 3: diagonalising by congruence with fractions

Statement. Let w(x,y,z)=x2+3y2+2z2−2xy+4xz−2yzw(x, y, z) = x^2 + 3y^2 + 2z^2 – 2xy + 4xz – 2yz.

a) Diagonalise ww by congruence and give a basis B′B' in which its matrix is diagonal. b) Compute its signature and its rank, and classify it. c) Check the classification with the leading principal minors.

The idea

The (A∣I)(A \mid I) algorithm, pivot by pivot. First zeros in row and column 1 using a11=1a_{11} = 1; then in row and column 2 with the new pivot, which will be a 2. That is where halves appear.

At each step, first the row operation across the whole strip and then the column operation only on the AA part. If it helps, write both on the same arrow, one above the other.

Step by step

a) The matrix, splitting the cross terms (−2xy→−1-2xy \to -1, 4xz→24xz \to 2, −2yz→−1-2yz \to -1):

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

First pivot, the 1: r2→r2+r1r_2 \to r_2 + r_1 and r3→r3−2r1r_3 \to r_3 – 2r_1, with the same on columns:

(1−12100−13−10102−12001)→ c2→c2+c1,  c3→c3−2c1  r2→r2+r1,  r3→r3−2r1 (10010002111001−2−201) \left(\begin{array}{ccc|ccc} 1 & -1 & 2 & 1 & 0 & 0 \\ -1 & 3 & -1 & 0 & 1 & 0 \\ 2 & -1 & 2 & 0 & 0 & 1 \end{array}\right) \xrightarrow[\, c_2 \to c_2 + c_1,\; c_3 \to c_3 – 2c_1 \,]{\, r_2 \to r_2 + r_1,\; r_3 \to r_3 – 2r_1 \,} \left(\begin{array}{ccc|ccc} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 2 & 1 & 1 & 1 & 0 \\ 0 & 1 & -2 & -2 & 0 & 1 \end{array}\right)

Check one entry: (3,3)(3, 3) was 2; with the row, 2−2⋅2=−22 – 2 \cdot 2 = -2, and with the column, (3,1)(3, 1) was already 0, so it stays −2-2. Entry (2,2)(2, 2): 3+(−1)=23 + (-1) = 2 and then 2+0=22 + 0 = 2.

The whole first step, without skipping anything. Notice the order: first the two row operations on the whole strip, and then the two column operations, only on the A A part.

StepOperationResultWhy
1r2→r2+r1 r_2 \to r_2 + r_1 (−1,3,−1∣0,1,0)+(1,−1,2∣1,0,0)=(0,2,1∣1,1,0) (-1, 3, -1 \mid 0, 1, 0) + (1, -1, 2 \mid 1, 0, 0) = (0, 2, 1 \mid 1, 1, 0) The pivot is 1 and below it there is a −1 -1 : adding row 1 once cancels it
2r3→r3−2r1 r_3 \to r_3 – 2r_1 (2,−1,2∣0,0,1)−(2,−2,4∣2,0,0)=(0,1,−2∣−2,0,1) (2, -1, 2 \mid 0, 0, 1) – (2, -2, 4 \mid 2, 0, 0) = (0, 1, -2 \mid -2, 0, 1) Below there is a 2: you have to subtract row 1 twice
3c2→c2+c1 c_2 \to c_2 + c_1 (on A A )Column 2 goes from (−1,2,1) (-1, 2, 1) to (−1+1,2+0,1+0)=(0,2,1) (-1 + 1, 2 + 0, 1 + 0) = (0, 2, 1) The row left zeros below the pivot, but the −1 -1 is still in row 1: the column removes it and the matrix is symmetric again
4c3→c3−2c1 c_3 \to c_3 – 2c_1 (on A A )Column 3 goes from (2,1,−2) (2, 1, -2) to (2−2,1−0,−2−0)=(0,1,−2) (2 – 2, 1 – 0, -2 – 0) = (0, 1, -2) The same with the 2 in entry (1,3) (1, 3)
5Nothing on the right(1,0,0) (1, 0, 0) , (1,1,0) (1, 1, 0) , (−2,0,1) (-2, 0, 1) Columns do not touch the identity: that is where Ct C^t is built

After the rows, column 1 of A A is already (1,0,0) (1, 0, 0) : that is why the columns only change the first row.

Second pivot, the 2 in the center: to remove the 1 in (3,2)(3, 2), r3→r3−12r2r_3 \to r_3 – \tfrac12 r_2 and c3→c3−12c2c_3 \to c_3 – \tfrac12 c_2:

→ c3→c3−12c2  r3→r3−12r2 (10010002011000−52−52−121) \xrightarrow[\, c_3 \to c_3 – \frac12 c_2 \,]{\, r_3 \to r_3 – \frac12 r_2 \,} \left(\begin{array}{ccc|ccc} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 2 & 0 & 1 & 1 & 0 \\ 0 & 0 & -\tfrac52 & -\tfrac52 & -\tfrac12 & 1 \end{array}\right)

Entry (3,3)(3, 3): −2−12⋅1=−52-2 – \tfrac12 \cdot 1 = -\tfrac52. And on the right, row 3 is (−2,0,1)−12(1,1,0)=(−52,−12,1)(-2, 0, 1) – \tfrac12(1, 1, 0) = (-\tfrac52, -\tfrac12, 1).

D=(10002000−52),B′={(1,0,0),  (1,1,0),  (−52,−12,1)} D = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & -\tfrac52 \end{pmatrix}, \qquad B' = \left\{(1, 0, 0),\; (1, 1, 0),\; \left(-\tfrac52, -\tfrac12, 1\right)\right\}

If you do not like fractions, you can use (−5,−1,2)(-5, -1, 2) (twice as much) as the third vector: it is still conjugate to the other two, and the diagonal entry would become 4⋅(−52)=−104 \cdot (-\tfrac52) = -10. The number changes, but not its sign.

b) Two positive and one negative: sig⁡(w)=(2,1)\operatorname{sig}(w) = (2, 1), rg⁡(w)=3\operatorname{rg}(w) = 3. Indefinite: a saddle in three dimensions. For instance, w(1,0,0)=1>0w(1, 0, 0) = 1 > 0 and w(−5,−1,2)=−10<0w(-5, -1, 2) = -10 < 0.

c) Δ1=1\Delta_1 = 1, Δ2=3−1=2\Delta_2 = 3 – 1 = 2, Δ3=∣A∣=−5\Delta_3 = |A| = -5. They are neither all positive nor alternating from negative: it is not definite, and Sylvester says no more. But notice: Δ1=1\Delta_1 = 1, Δ2/Δ1=2\Delta_2/\Delta_1 = 2 and Δ3/Δ2=−52\Delta_3/\Delta_2 = -\tfrac52 are exactly the diagonal we got. It always happens when the congruence is done without swapping rows, and it is a great check.

The diagonal comes from the minorsThree boxes: the order-1 minor is 1; the order-2 minor is 2 and its quotient with the previous one is 2; the order-3 minor is −5 and its quotient with the previous one is −5/2. They are the three diagonal entries of the congruence, with signature (2, 1).Δ₁ = 11entry 1 of DΔ₂ = 22 / 1 = 2entry 2 of DΔ₃ = −5−5 / 2 = −5/2entry 3 of DD = diag(1, 2, −5/2) → sig = (2, 1): indefinite
Without swapping rows, each entry of D is Δₖ / Δₖ₋₁.

Check it in MATLAB

format rat
A = [1 -1 2; -1 3 -1; 2 -1 2];
Ct = [1 0 0; 1 1 0; -5/2 -1/2 1];   % rows = B'
Ct*A*Ct'                            % paper D
det(A(1,1)), det(A(1:2,1:2)), det(A)

Output:

ans =

       1              0              0       
       0              2              0       
       0              0             -5/2     

ans =

       1       

ans =

       2       

ans =

      -5       

The first output is the paper DD, with −5/2-5/2. The three minors are 1, 2 and −5-5, and their ratios, the same diagonal.

Questions you might ask

Why did I not do r3→2r3−r2r_3 \to 2r_3 – r_2 to avoid the half? You can (multiplying a row by a non-zero number is a valid operation in congruence), but then you must multiply the column too, and the diagonal number is multiplied by 4. The signature does not change. Choose whatever gives you fewer mistakes.

What if the pivot is 0? For example, w=2xyw = 2xy, with matrix (0110)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}. Then, before anything else, r1→r1+r2r_1 \to r_1 + r_2 and c1→c1+c2c_1 \to c_1 + c_2, which puts a 2 in the corner. Swapping rows and columns at the same time also works.

Are the numbers in DD the eigenvalues? No. The eigenvalues of this AA are not integers (MATLAB gives them with decimals). What matches is how many are positive and negative: two and one.

Why is B′B' made of the rows and not the columns on the right? Because on the right you are left with CtC^t, and the basis vectors are the columns of CC, that is, the rows of CtC^t.

Applying the column operation to the identity part too. Then the right side is no longer CtC^t and the basis comes out wrong. The column operation only acts on AA: the identity follows only the rows.

Try it yourself

  1. Diagonalise the same ww starting with the bottom pivot (the 2 in (3,3)(3, 3)) and check that the signature is again (2,1)(2, 1).
  2. Diagonalise w=2xyw = 2xy with the trick from the zero-pivot question and classify it.

Problem 4: a parameter, Sylvester and a dot product

Statement. For each a∈Ra \in \mathbb{R}, let wa(x,y,z)=x2+2axy+4y2+2z2w_a(x, y, z) = x^2 + 2axy + 4y^2 + 2z^2.

a) Classify waw_a depending on the values of aa. b) For a=1a = 1, justify that w1w_1 defines a dot product and compute, with respect to it, the cosine of the angle between (1,0,0)(1, 0, 0) and (0,1,0)(0, 1, 0) and the «length» of (1,1,0)(1, 1, 0).

The idea

With a parameter, Sylvester is fastest for the «definite» part: the minors come out as expressions in aa. For the values where it fails, congruence. And in b), the cosine with the formula from the theory, f/w⋅wf/\sqrt{w \cdot w}.

zz does not mix with anything (there is no xzxz or yzyz): the matrix has a 2×22 \times 2 block and a loose 2. The loose 2 always contributes a positive sign.

Step by step

a) A=(1a0a40002)A = \begin{pmatrix} 1 & a & 0 \\ a & 4 & 0 \\ 0 & 0 & 2 \end{pmatrix}. Leading principal minors:

Δ1=1,Δ2=4−a2,Δ3=2(4−a2) \Delta_1 = 1, \qquad \Delta_2 = 4 – a^2, \qquad \Delta_3 = 2(4 – a^2)
  • If −2<a<2-2 < a < 2: 4−a2>04 – a^2 > 0 and all three are positive. Positive definite.
  • If a=±2a = \pm 2: Δ2=Δ3=0\Delta_2 = \Delta_3 = 0. Sylvester does not decide. By congruence, r2→r2−ar1r_2 \to r_2 – ar_1, c2→c2−ac1c_2 \to c_2 – ac_1 leaves d2=4−a2=0d_2 = 4 – a^2 = 0: D=diag⁡(1,0,2)D = \operatorname{diag}(1, 0, 2), signature (2,0)(2, 0), rank 2. Positive semidefinite (a half-pipe: with a=2a = 2, w(2,−1,0)=4−8+4=0w(2, -1, 0) = 4 – 8 + 4 = 0).
  • If ∣a∣>2|a| > 2: with the same congruence, d2=4−a2<0d_2 = 4 – a^2 < 0: D=diag⁡(1,4−a2,2)D = \operatorname{diag}(1, 4 – a^2, 2), signature (2,1)(2, 1). Indefinite.

It is never negative definite: Δ1=1>0\Delta_1 = 1 > 0 always.

The same classification, in a table. The idea: Δ1 \Delta_1 does not depend on a a , and Δ3 \Delta_3 is Δ2 \Delta_2 times the lone 2 of z z , so everything is decided by the sign of 4−a2 4 – a^2 .

Values of a a Δ1 \Delta_1 Δ2=4−a2 \Delta_2 = 4 – a^2 Δ3=2(4−a2) \Delta_3 = 2(4 – a^2) ClassificationWhy
−2<a<2 -2 < a < 2 + + + + + + Positive definiteAll three minors positive: Sylvester decides on its own
a=±2 a = \pm 2 + + 00Positive semidefiniteSylvester does not decide; congruence gives D=diag⁡(1,0,2) D = \operatorname{diag}(1, 0, 2) : no negatives and one 0
∣a∣>2 \lvert a \rvert > 2 + + − – − – IndefiniteD=diag⁡(1,4−a2,2) D = \operatorname{diag}(1, 4 – a^2, 2) has positives and one negative

And where does the half-pipe vector (2,−1,0) (2, -1, 0) come from? With a=2 a = 2 , w2=x2+4xy+4y2+2z2=(x+2y)2+2z2 w_2 = x^2 + 4xy + 4y^2 + 2z^2 = (x + 2y)^2 + 2z^2 . A sum of two squares is 0 only if both are: z=0 z = 0 and x=−2y x = -2y . With y=−1 y = -1 , x=2 x = 2 .

The classification of w depending on aA number line for a. Between −2 and 2, in green, w is positive definite. Outside, in red, it is indefinite. At the two points a = −2 and a = 2, in amber, it is positive semidefinite.a = -2a = 2positive definiteindefiniteindefiniteΔ₂ = 4 − a²a = ±2: positive semidefinite (Δ₂ = 0, Sylvester does not decide)
The sign of Δ₂ splits the line into three pieces and two points.

b) With a=1a = 1, −2<1<2-2 < 1 < 2: positive definite. Since it is also symmetric, its polar form is a dot product. The cosine between e⃗1\vec e_1 and e⃗2\vec e_2:

cos⁡θ=f(e⃗1,e⃗2)w(e⃗1)w(e⃗2)=a12a11a22=11⋅4=12  ⇒  θ=60∘ \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 \cdot \sqrt 4} = \frac12 \;\Rightarrow\; \theta = 60^\circ

The length of (1,1,0)(1, 1, 0): ∥(1,1,0)∥f=w1(1,1,0)=1+2+4=7\|(1, 1, 0)\|_f = \sqrt{w_1(1, 1, 0)} = \sqrt{1 + 2 + 4} = \sqrt 7. With the usual dot product it would be 2\sqrt 2.

Check it in MATLAB

format short
syms a
Aa = [1 a 0; a 4 0; 0 0 2];
det(Aa(1:2,1:2)), det(Aa)       % minors with the parameter
A1 = [1 1 0; 1 4 0; 0 0 2];     % a = 1
eig(A1)                         % all positive: positive definite
e1 = [1;0;0]; e2 = [0;1;0]; u = [1;1;0];
c = (e1'*A1*e2)/sqrt((e1'*A1*e1)*(e2'*A1*e2))
sqrt(u'*A1*u)                   % length of (1,1,0): sqrt(7)

Output:

 
ans =
 
4 - a^2
 
 
ans =
 
8 - 2*a^2
 

ans =

    0.6972
    2.0000
    4.3028

c =

    0.5000

ans =

    2.6458

The minors come out as 4−a24 – a^2 and 8−2a28 – 2a^2 (MATLAB multiplies them out). The eigenvalues of A1A_1 are not pretty, but all three are positive: the same conclusion. And the cosine, 0.5000, which is 1/21/2; the length, 2.6458, which is 7\sqrt 7.

Questions you might ask

Why is it not enough to check that the diagonal of AA is positive? Because the cross terms can win. With a=3a = 3, the diagonal is (1,4,2)(1, 4, 2), all positive, and still w(3,−1,0)=9−18+4=−5<0w(3, -1, 0) = 9 – 18 + 4 = -5 < 0.

What is the «length» with respect to a form? The square root of w(u⃗)w(\vec u), just as the usual length is the square root of u⃗⋅u⃗\vec u \cdot \vec u. It only makes sense if ww is positive definite (otherwise ww could be negative).

And if I am asked for the angle with a=3a = 3? It cannot be done: w3w_3 is not positive definite, so it is not a dot product. The right answer is to justify that and compute nothing.

Does the 60° angle depend on the basis? The angle between two given vectors does not: it is a property of the vectors and the dot product. What depends on the basis is the matrix you use to compute it.

Concluding «positive definite for every aa» because Δ1>0\Delta_1 > 0. Sylvester needs all minors positive, and Δ2\Delta_2 changes sign at a=±2a = \pm 2.

Try it yourself

  1. With a=1a = 1, find a vector (x,y,0)(x, y, 0) «perpendicular» (conjugate) to (1,0,0)(1, 0, 0) according to ff and check that the cosine comes out 0.
  2. Classify −wa-w_a depending on aa using the result of a), without doing any sums.

Problem 5: this is how the exam asks it

Exam-style exercise. [9 points] On R3\mathbb{R}^3, let the bilinear form be f(u⃗,v⃗)=2x1y1−x1y2+x1y3−x2y1+x2y2+x3y1+2x3y3f(\vec u, \vec v) = 2x_1y_1 – x_1y_2 + x_1y_3 – x_2y_1 + x_2y_2 + x_3y_1 + 2x_3y_3, with u⃗=(x1,x2,x3)\vec u = (x_1, x_2, x_3) and v⃗=(y1,y2,y3)\vec v = (y_1, y_2, y_3). a) (2 points) Find the expression of the quadratic form ww associated with ff. b) (4 points) Diagonalise and classify ww, and give a basis B′B' in which its matrix is diagonal. c) (3 points) Study whether ff is a dot product and, if so, compute the cosine of the angle between the vectors (1,0,0)(1, 0, 0) and (0,1,0)(0, 1, 0).

The idea

It is the structure of the forms exercise in recent exams: expression, diagonalisation with a basis and classification, and the dot product question with a cosine. Everything comes from the matrix, which here is symmetric, so it is both that of ff and that of ww.

In c), the classification from b) already answers half: a dot product is a symmetric bilinear form with ww positive definite. If b) comes out positive definite, only the cosine is left.

Step by step

a) The matrix, by the index rule:

A=(2−11−110102) A = \begin{pmatrix} 2 & -1 & 1 \\ -1 & 1 & 0 \\ 1 & 0 & 2 \end{pmatrix}

It is symmetric: ff is symmetric and its quadratic form has the same matrix. With u⃗=v⃗=(x,y,z)\vec u = \vec v = (x, y, z), the two terms in each cross pair add up:

w(x,y,z)=2x2+y2+2z2−2xy+2xz w(x, y, z) = 2x^2 + y^2 + 2z^2 – 2xy + 2xz

b) Congruence. First pivot, the 2: r2→r2+12r1r_2 \to r_2 + \tfrac12 r_1 and r3→r3−12r1r_3 \to r_3 – \tfrac12 r_1, and the same on columns:

(2−11100−110010102001)→ c2→c2+12c1,  c3→c3−12c1  r2→r2+12r1,  r3→r3−12r1 (20010001212121001232−1201) \left(\begin{array}{ccc|ccc} 2 & -1 & 1 & 1 & 0 & 0 \\ -1 & 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 2 & 0 & 0 & 1 \end{array}\right) \xrightarrow[\, c_2 \to c_2 + \frac12 c_1,\; c_3 \to c_3 – \frac12 c_1 \,]{\, r_2 \to r_2 + \frac12 r_1,\; r_3 \to r_3 – \frac12 r_1 \,} \left(\begin{array}{ccc|ccc} 2 & 0 & 0 & 1 & 0 & 0 \\ 0 & \tfrac12 & \tfrac12 & \tfrac12 & 1 & 0 \\ 0 & \tfrac12 & \tfrac32 & -\tfrac12 & 0 & 1 \end{array}\right)

Second pivot, the 12\tfrac12: 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 (20010001201210001−1−11) \xrightarrow[\, c_3 \to c_3 – c_2 \,]{\, r_3 \to r_3 – r_2 \,} \left(\begin{array}{ccc|ccc} 2 & 0 & 0 & 1 & 0 & 0 \\ 0 & \tfrac12 & 0 & \tfrac12 & 1 & 0 \\ 0 & 0 & 1 & -1 & -1 & 1 \end{array}\right)
D=(2000120001),B′={(1,0,0),  (12,1,0),  (−1,−1,1)} D = \begin{pmatrix} 2 & 0 & 0 \\ 0 & \tfrac12 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \qquad B' = \left\{(1, 0, 0),\; \left(\tfrac12, 1, 0\right),\; (-1, -1, 1)\right\}

sig⁡(w)=(3,0)\operatorname{sig}(w) = (3, 0), rg⁡(w)=3=dim⁡R3\operatorname{rg}(w) = 3 = \dim\mathbb{R}^3: positive definite. Check with Sylvester: Δ1=2\Delta_1 = 2, Δ2=2−1=1\Delta_2 = 2 – 1 = 1, Δ3=2⋅2−(−1)(−2−0)+1⋅(0−1)=4−2−1=1\Delta_3 = 2 \cdot 2 – (-1)(-2 – 0) + 1 \cdot (0 – 1) = 4 – 2 – 1 = 1. All positive.

The congruence in b), row by row. Here the pivot is 2, so the multipliers are halves: to cancel a number b b below the pivot p p , you subtract bp \tfrac{b}{p} times the pivot row.

StepOperationResultWhy
1r2→r2+12r1 r_2 \to r_2 + \tfrac12 r_1 (−1,1,0∣0,1,0)+(1,−12,12∣12,0,0)=(0,12,12∣12,1,0) (-1, 1, 0 \mid 0, 1, 0) + (1, -\tfrac12, \tfrac12 \mid \tfrac12, 0, 0) = (0, \tfrac12, \tfrac12 \mid \tfrac12, 1, 0) Below the 2 there is a −1 -1 : −−12=+12 -\tfrac{-1}{2} = +\tfrac12
2r3→r3−12r1 r_3 \to r_3 – \tfrac12 r_1 (1,0,2∣0,0,1)−(1,−12,12∣12,0,0)=(0,12,32∣−12,0,1) (1, 0, 2 \mid 0, 0, 1) – (1, -\tfrac12, \tfrac12 \mid \tfrac12, 0, 0) = (0, \tfrac12, \tfrac32 \mid -\tfrac12, 0, 1) Below there is a 1: you subtract 12 \tfrac12 of row 1
3c2→c2+12c1 c_2 \to c_2 + \tfrac12 c_1 , c3→c3−12c1 c_3 \to c_3 – \tfrac12 c_1 Row 1 of A A goes from (2,−1,1) (2, -1, 1) to (2,0,0) (2, 0, 0) The same multipliers on columns: −1+12⋅2=0 -1 + \tfrac12 \cdot 2 = 0 and 1−12⋅2=0 1 – \tfrac12 \cdot 2 = 0
4r3→r3−r2 r_3 \to r_3 – r_2 (0,12,32∣−12,0,1)−(0,12,12∣12,1,0)=(0,0,1∣−1,−1,1) (0, \tfrac12, \tfrac32 \mid -\tfrac12, 0, 1) – (0, \tfrac12, \tfrac12 \mid \tfrac12, 1, 0) = (0, 0, 1 \mid -1, -1, 1) New pivot 12 \tfrac12 and another 12 \tfrac12 below it: the multiplier is 1
5c3→c3−c2 c_3 \to c_3 – c_2 Entry (2,3) (2, 3) goes from 12 \tfrac12 to 0; entry (3,3) (3, 3) stays at 1The column only clears what the row left above

Check with the rule from problem 3: Δ1=2 \Delta_1 = 2 , Δ2/Δ1=12 \Delta_2 / \Delta_1 = \tfrac12 and Δ3/Δ2=1 \Delta_3 / \Delta_2 = 1 . It is the diagonal of D D , because you have not swapped rows.

c) ff is symmetric and ww is positive definite: ff is a dot product. Cosine between e⃗1\vec e_1 and e⃗2\vec e_2:

cos⁡θ=f(e⃗1,e⃗2)w(e⃗1) w(e⃗2)=−12⋅1=−22  ⇒  θ=135∘ \cos\theta = \frac{f(\vec e_1, \vec e_2)}{\sqrt{w(\vec e_1)}\,\sqrt{w(\vec e_2)}} = \frac{-1}{\sqrt 2 \cdot \sqrt 1} = -\frac{\sqrt 2}{2} \;\Rightarrow\; \theta = 135^\circ

Check it in MATLAB

format rat
A = [2 -1 1; -1 1 0; 1 0 2];
syms x y z
expand([x y z]*A*[x; y; z])          % a)
Ct = [1 0 0; 1/2 1 0; -1 -1 1];      % rows = B'
Ct*A*Ct'                             % b) D
det(A(1,1)), det(A(1:2,1:2)), det(A) % Sylvester
e1 = [1;0;0]; e2 = [0;1;0];
(e1'*A*e2)/sqrt((e1'*A*e1)*(e2'*A*e2))   % c) cosine

Output:

 
ans =
 
2*x^2 - 2*x*y + 2*x*z + y^2 + 2*z^2
 

ans =

       2              0              0       
       0              1/2            0       
       0              0              1       

ans =

       2       

ans =

       1       

ans =

       1       

ans =

    -985/1393  

The cosine comes out as −985/1393-985/1393, the fraction format rat uses to approximate −2/2≈−0.7071-\sqrt 2/2 \approx -0.7071.

Checking and how it is marked

Two ten-second checks: w(−1,−1,1)=2+1+2−2−2=1w(-1, -1, 1) = 2 + 1 + 2 – 2 – 2 = 1, the last number of DD; and (1,0,0)(1, 0, 0) and (−1,−1,1)(-1, -1, 1) are conjugate: (2    −1    1)⋅(−1,−1,1)=−2+1+1=0(2 \;\; {-1} \;\; 1)\cdot(-1, -1, 1) = -2 + 1 + 1 = 0.

A rough split of the 9 points (it is mine, not the lecturer’s official one):

PartWhat is assessedPoints
a)Matrix of ff laid out correctly1
a)Expression of ww with the cross terms added1
b)Congruence operations on rows and columns, written out2
b)DD and the basis B′B' (rows of CtC^t)1
b)Signature and justified classification1
c)Dot product: symmetric and positive definite1.5
c)Cosine and angle1.5

Questions you might ask

Can I classify with Sylvester alone in b)? For classifying, yes (it comes out positive definite). But b) also asks you to diagonalise and give the basis, and that only comes from congruence (or from eigenvalues, with ugly numbers). Doing both also gives you a free check.

Can I give B′B' with (1,2,0)(1, 2, 0) instead of (12,1,0)(\tfrac12, 1, 0)? Yes: it is twice as much, still conjugate to the other two. But then DD changes in that entry (12⋅4=2\tfrac12 \cdot 4 = 2). Give the DD that matches your basis.

Why is the angle obtuse? Because f(e⃗1,e⃗2)=−1<0f(\vec e_1, \vec e_2) = -1 < 0. With this way of measuring, e⃗1\vec e_1 and e⃗2\vec e_2 «face each other» at more than 90°.

If b) came out indefinite, what do I write in c)? That ff is not a dot product because its quadratic form is not positive definite, and so the cosine makes no sense. That earns the marks for c).

Check you’ve got it: what would happen if the terms x1y3 and x3y1 in f had a 2 instead of a 1?

f f would no longer be a dot product, and in c) there would be no cosine to compute. Step by step: the matrix would be (2−12−110202) \begin{pmatrix} 2 & -1 & 2 \\ -1 & 1 & 0 \\ 2 & 0 & 2 \end{pmatrix} , still symmetric. Its minors: Δ1=2 \Delta_1 = 2 , Δ2=1 \Delta_2 = 1 and Δ3=−2 \Delta_3 = -2 . The last one is negative and the other two positive, so it is not positive definite. Congruence confirms it: r2→r2+12r1 r_2 \to r_2 + \tfrac12 r_1 , r3→r3−r1 r_3 \to r_3 – r_1 and then r3→r3−2r2 r_3 \to r_3 – 2r_2 (with the same on columns) give D=diag⁡(2,12,−2) D = \operatorname{diag}(2, \tfrac12, -2) : signature (2,1) (2, 1) , indefinite. A vector that proves it is the last row on the right, (−2,−2,1) (-2, -2, 1) : w(−2,−2,1)=−2<0 w(-2, -2, 1) = -2 < 0 . That is why c) is always answered by looking at b).

Adding the cross terms wrongly in a): −x1y2−x2y1-x_1y_2 – x_2y_1 gives −2xy-2xy, not −xy-xy. In the matrix each entry holds half, but in ww the whole term appears.

Try it yourself

  1. Redo b) starting with the center pivot (swapping rows and columns 1 and 2 first) and check that you get another DD with all three positive.
  2. Compute the cosine of the angle between (1,0,0)(1, 0, 0) and (0,0,1)(0, 0, 1) with respect to ff.

Common mistakes in this practice

  • The whole cross term in the matrix. In the matrix of ww, the coefficient of xixjx_ix_j is split between (i,j)(i, j) and (j,i)(j, i); in the expression of ww, it appears whole.
  • Congruence on rows only. Every row operation is followed by the same one on columns, and the column one does not touch the identity.
  • The basis in the columns on the right. The right side is CtC^t: the basis is its rows.
  • Sylvester as if it classified everything. It only decides «definite». With a zero minor or signs that follow no pattern, diagonalise.
  • A cosine without checking it is a dot product. First symmetric and positive definite; then the formula.
  • C−1ACC^{-1}AC instead of CtACC^tAC. Bilinear forms change with the transpose.

Try it in the MATLAB playground

In the MATLAB playground you can run this script, which checks a congruence, classifies by eigenvalues and finds a vector with negative height on an indefinite ramp.

format rat
A = [1 -1 2; -1 3 -1; 2 -1 2];      % the ramp from problem 3
Ct = [1 0 0; 1 1 0; -5 -1 2];       % B' without fractions
D = Ct*A*Ct'                         % the diagonal changes, the signs do not
format short
eig(A)                               % eigenvalues: two positive and one negative
v = Ct(3,:)';                        % the third vector of B'
v'*A*v                               % negative height: indefinite

Things to look at:

  1. With (−5,−1,2)(-5, -1, 2) instead of (−52,−12,1)(-\tfrac52, -\tfrac12, 1), the diagonal gives −10-10 instead of −52-\tfrac52: same sign.
  2. The eigenvalues look nothing like the diagonal of DD, but they have the same signs.
  3. Change AA to the one from problem 5 and check that all the eigenvalues come out positive.
  4. Try v = [1; 0; 0] and look at the sign of v'*A*v: an indefinite ramp rises in some directions and falls in others.

Summary

  • The matrix of a bilinear form has the coefficient of xiyjx_iy_j in (i,j)(i, j); f=XtAYf = X^tAY and, if it is not symmetric, order matters.
  • The matrix of a quadratic form is symmetric: squares on the diagonal and cross terms split by 2. The antisymmetric part of a bilinear form does not show in its quadratic form.
  • The conjugates of a vector are read off its row of AA: u⃗ tAv⃗=0\vec u^{\,t}A\vec v = 0, one equation per vector.
  • In congruence, the same operation on rows and columns; DD on the left and CtC^t on the right, with the basis in its rows. The diagonal can have fractions; the signs do not change.
  • Sylvester decides «definite» with the leading principal minors; for semidefinite and indefinite, diagonalise.
  • A dot product is a symmetric bilinear form with ww positive definite, and with it cos⁡θ=f(u⃗,v⃗)/w(u⃗)w(v⃗)\cos\theta = f(\vec u, \vec v)/\sqrt{w(\vec u)w(\vec v)}.

Checklist: have you practised it?

  • Can you write the matrix of a form (bilinear or quadratic) without forgetting to split the cross terms?
  • Do you know how to compute the conjugates of one and of two vectors?
  • Have you done a full congruence with its basis and checked it with ww of each vector?
  • Do you know when Sylvester does not decide and what to do then?
  • Have you run the five MATLAB scripts and checked that the outputs match your paper?
  • Have you tried the «Try it yourself» tasks without looking at the theory?

If you answered yes to almost everything, you are ready for the bilinear and quadratic forms exercises, where I no longer give you the steps and there is a quiz like the Campus ones. See you there!

Next step: exercisesBilinear and quadratic forms — exam-style exercises with a deceptive ramp, a parameter Sylvester cannot settle and a dot product that is not one (and the basis read off the columns)

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