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
+ 6xy = 1
A is the matrix of the quadratic form
> A:= matrix(2,2,[[-1,3],[3,-1]]);
Find the eigenvalues and eigenvectors of A:
> evA := [eigenvectors(A)];
Normalize the eigenvectors:
>
v1 := normalize(evA[1][3][1]);
v2 := normalize(evA[2][3][1]);
Construct a matrix P which orthogonally diagonalizes A
> PA := augment(v1,v2);
Compute the diagonal matrix (since A = PD
, we have D =
AP)
> DA := evalm(transpose(PA) &* A &* PA);
Make Maple compute the equation of the rotated conic:
> LHSA := evalm(transpose([X,Y]) &* DA &* [X,Y]);
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);
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);
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
+72xz + 150 = 0
B is the matrix of the quadratic form
>
B := matrix(3,3,[[2,0,36],[0,3,0],[36,0,23]]);
Find the eigenvalues and eigenvectors of B
> evB := [eigenvectors(B)];
Normalize the eigenvectors:
>
w1 := normalize(evB[1][3][1]);
w2 := normalize(evB[2][3][1]);
w3 := normalize(evB[3][3][1]);
Construct a matrix P which orthogonally diagonalizes A
> PB := augment(w1,w2,w3);
Compute the diagonal matrix (since A = PD
, we have D =
AP)
> DB := evalm(transpose(PB) &* B &* PB);
Make Maple compute the equation of the rotated conic:
> LHSB := evalm(transpose([X,Y,Z]) &* DB &* [X,Y,Z]);
>
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]);
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);
>
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);
>
>