In-class Demonstration: Quadratic Forms; Orthogonal DiagonalizationBy Russell Blyth, modified by Mike May, S.J.restart: with(LinearAlgebra): with(plots): with(plottools):Example 1: The conic NiMsJiokJSJ4RyIiIyEiIiokJSJ5R0YmRic=+ 6xy = 1A is the matrix of the quadratic formA:= Matrix(2,2,[[-1,3],[3,-1]]);Find the eigenvalues and eigenvectors of A:evA := [Eigenvectors(A)];Normalize the eigenvectors:v1 := Normalize(Column(evA[2],1),Euclidean); v2 := Normalize(Column(evA[2],2),Euclidean);Construct a matrix P which orthogonally diagonalizes APA := <v1|v2>;Compute the diagonal matrix (since A = PDNiMpJSJQRyUidEc=, we have D = NiMpJSJQRyUidEc=AP)DA := Transpose(PA) . A . PA;Make Maple compute the equation of the rotated conic:LHSA := 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 NiMsKComIiIjIiIiKiQlInhHRiVGJkYmKiYiIiRGJiokJSJ5R0YlRiZGJiomIiNCRiYqJCUiekdGJUYmRiY= +72xz + 150 = 0B is the matrix of the quadratic formB := Matrix(3,3,[[2,0,36],[0,3,0],[36,0,23]]); Find the eigenvalues and eigenvectors of BevB := [Eigenvectors(B)];Normalize the eigenvectors:w1 := Normalize(Column(evB[2],1),Euclidean); w2 := Normalize(Column(evB[2],2),Euclidean); w3 := Normalize(Column(evB[2],3),Euclidean);Construct a matrix P which orthogonally diagonalizes A:PB := <w1|w2|w3>;Compute the diagonal matrix (since A = PDNiMpJSJQRyUidEc=, we have D = NiMpJSJQRyUidEc=AP)DB := Transpose(PB) . B . PB;Make Maple compute the equation of the rotated conic:LHSB := 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);