This visual transforms a box (1 by 1 by 1) into a parallelogram whose edges are the columns of the matrix $A$. This is a way of visualizing how a matrix $A$ transforms space. The visual also shows how an object inside the box transforms to fit inside the parallelogram. One of the key uses of this visual is to look at what happens when the kernel of the matrix is nontrivial.

<sagecell> A=matrix(QQ, [[-1,0,0], [0,2,1], [0,1,2]])

EV=A.eigenvectors_right()

e1=vector([1,0,0]) e2=vector([0,1,0]) e3=vector([0,0,1]) c1,c2,c3=A.columns() z=vector([0,0,0]) boxplot=arrow3d(z,e1,color='red',aspect_ratio=1) boxplot+=arrow3d(z,e2,color='blue') boxplot+=arrow3d(z,e3,color='green') boxplot+=arrow3d(e2,e2+e1,color='red',linestyle='dashed') boxplot+=arrow3d(e3,e3+e1,color='red',linestyle='dashed') boxplot+=arrow3d(e1,e1+e2,color='blue',linestyle='dashed') boxplot+=arrow3d(e3,e3+e2,color='blue',linestyle='dashed') boxplot+=arrow3d(e1,e1+e3,color='green',linestyle='dashed') boxplot+=arrow3d(e2,e2+e3,color='green',linestyle='dashed')

boxplot+=arrow3d(z,c1,color='red',aspect_ratio=1) boxplot+=arrow3d(z,c2,color='blue') boxplot+=arrow3d(z,c3,color='green') boxplot+=arrow3d(c2,c2+c1,color='red',linestyle='dashed') boxplot+=arrow3d(c3,c3+c1,color='red',linestyle='dashed') boxplot+=arrow3d(c1,c1+c2,color='blue',linestyle='dashed') boxplot+=arrow3d(c3,c3+c2,color='blue',linestyle='dashed') boxplot+=arrow3d(c1,c1+c3,color='green',linestyle='dashed') boxplot+=arrow3d(c2,c2+c3,color='green',linestyle='dashed')

evplot=arrow3d(z,z)

for i in range(len(EV)):

    for j in range( len( EV[i][1] ) ):
        if EV[i][0]==EV[i][0].conjugate():
            evplot+=arrow3d(z,EV[i][0]*(EV[i][1][j])/EV[i][1][j].norm(),color='black')
            evplot+=arrow3d(z,(EV[i][1][j])/EV[i][1][j].norm(),color='purple')
            evplot+=arrow3d(z,-EV[i][0]*(EV[i][1][j])/EV[i][1][j].norm(),color='black')
            evplot+=arrow3d(z,-(EV[i][1][j])/EV[i][1][j].norm(),color='purple')

var('s,t') r=vector([sin(s)*cos(t),sin(s)*sin(t),cos(s)]) sphereplot=parametric_plot3d(r,(t,0,2*pi),(s,0,pi),opacity=.1) sphereplot+=parametric_plot3d(A*r,(t,0,2*pi),(s,0,pi),opacity=.1)

r=1/2 * vector([cos(t)*cos(s)*sin(3*s),sin(t)*cos(s)*sin(3*s), sin(s)*sin(3*s)]) + vector([1/2, 1/2, 1/2]) flower=parametric_plot3d( r, (t, 0,2 *pi), (s,0,2*pi),color='red',opacity=.2) flower+=parametric_plot3d( A*r, (t, 0,2 *pi),(s,0,2*pi),color='red',opacity=.2)

  1. p=boxplot+evplot+sphereplot+flower

p=boxplot+flower p.show()

table([["Matrix",A],["Determinant",A.det()],["Eigenvalues and Eigenvectors","Under the table" ]]) EV </sagecell>