InClass6.5-QuadForms.mws

6.5 Quadratic Forms; Orthogonal Diagonalization

In-class demo by Russell Blyth.

> restart: with(linalg): with(plots): with(plottools):

Warning, the protected names norm and trace have been redefined and unprotected

Warning, the name changecoords has been redefined

Warning, the name arrow has been redefined

Example 1: The conic -x^2-y^2 + 6xy = 1

A is the matrix of the quadratic form

> A:= matrix(2,2,[[-1,3],[3,-1]]);

A := matrix([[-1, 3], [3, -1]])

Find the eigenvalues and eigenvectors of A:

> evA := [eigenvectors(A)];

evA := [[-4, 1, {vector([-1, 1])}], [2, 1, {vector(...

Normalize the eigenvectors:

> v1 := normalize(evA[1][3][1]);
v2 := normalize(evA[2][3][1]);

v1 := vector([-1/2*sqrt(2), 1/2*sqrt(2)])

v2 := vector([1/2*sqrt(2), 1/2*sqrt(2)])

Construct a matrix P which orthogonally diagonalizes A

> PA := augment(v1,v2);

PA := matrix([[-1/2*sqrt(2), 1/2*sqrt(2)], [1/2*sqr...

Compute the diagonal matrix (since A = PD P^t , we have D = P^t AP)

> DA := evalm(transpose(PA) &* A &* PA);

DA := matrix([[-4, 0], [0, 2]])

Make Maple compute the equation of the rotated conic:

> LHSA := evalm(transpose([X,Y]) &* DA &* [X,Y]);

LHSA := -4*X^2+2*Y^2

The equation is LHSA = 1, which is the equation of a hyperbola.

Let's graph, first the conic relative to the new axes:

> implicitplot(-4*x^2+2*y^2=1,x=-2..2,y=-2..2,scaling=constrained);

[Maple Plot]

and then the graph relative to the original axes:

> v1g := line([0,0],convert(v1,list),color=red,thickness=2):
v2g := line([0,0],convert(v2,list),color=red,thickness=2):
conic := implicitplot(-x^2-y^2+6*x*y=1,x=-2..2,y=-2..2):
display([v1g,v2g,conic],scaling=constrained);

[Maple Plot]

Subtle point: the axes have been reversed here - to prevent this we should reverse the order we choose v1 and v2 - in general, choose the order of the columns of P so that det(P) = 1.

Example 2: The quadric surface 2*x^2+3*y^2+23*z^2 +72xz + 150 = 0

B is the matrix of the quadratic form

> B := matrix(3,3,[[2,0,36],[0,3,0],[36,0,23]]);

B := matrix([[2, 0, 36], [0, 3, 0], [36, 0, 23]])

Find the eigenvalues and eigenvectors of B

> evB := [eigenvectors(B)];

evB := [[3, 1, {vector([0, 1, 0])}], [-25, 1, {vect...

Normalize the eigenvectors:

> w1 := normalize(evB[1][3][1]);
w2 := normalize(evB[2][3][1]);
w3 := normalize(evB[3][3][1]);

w1 := vector([0, 1, 0])

w2 := vector([-4/75*sqrt(25)*sqrt(9), 0, 1/25*sqrt(...

w3 := vector([1/25*sqrt(25)*sqrt(9), 0, 4/75*sqrt(2...

Construct a matrix P which orthogonally diagonalizes A

> PB := augment(w1,w2,w3);

PB := matrix([[0, -4/75*sqrt(25)*sqrt(9), 1/25*sqrt...

Compute the diagonal matrix (since A = PD P^t , we have D = P^t AP)

> DB := evalm(transpose(PB) &* B &* PB);

DB := matrix([[3, 0, 0], [0, -25, 0], [0, 0, 50]])

Make Maple compute the equation of the rotated conic:

> LHSB := evalm(transpose([X,Y,Z]) &* DB &* [X,Y,Z]);

LHSB := 3*X^2-25*Y^2+50*Z^2

>

The equation is LHSB = -150, which is the equation of a paraboloid of two sheets.

Let's graph, first the quadric surface relative to the new axes:

> implicitplot3d(3*x^2+50*y^2-25*z^2=-150,x=-10..10,y=-10..10,z=-10..10,axes=normal,scaling=constrained,grid=[20,20,20]);

[Maple Plot]

And then relative to the original axes: (the eigenspace basis vectors have been stretched to make them long enough to see clearly)

> w15 := evalm(5*w1); w25 := evalm(5*w2); w35 := evalm(5*w3);

w15 := vector([0, 5, 0])

w25 := vector([-4/15*sqrt(25)*sqrt(9), 0, 1/5*sqrt(...

w35 := vector([1/5*sqrt(25)*sqrt(9), 0, 4/15*sqrt(2...

> w1g := line([0,0,0],convert(w15,list),color=red,thickness=4):
w2g := line([0,0,0],convert(w25,list),color=red,thickness=4):
w3g := line([0,0,0],convert(w35,list),color=red,thickness=4):
conicB := implicitplot3d(2*x^2 + 3*y^2 + 23*z^2 + 72*x*z + 150 = 0, x=-10..10,y=-10..10,z=-10..10,axes=normal,grid=[20,20,20]):
display([w1g,w2g,w3g,conicB],scaling=constrained);

[Maple Plot]

>

>