LinearAlgebra Visualization  1
The visualization component of the Student[LinearAlgebra] subpackage contains routines that can be used to work with and visualize various concepts in an introductory linear algebra course. This worksheet demonstrates the basics of this functionality for problems involving vectors, planes, and linear systems. The companion worksheet, LinearAlgebra Visualization  2, demonstrates the similar functionality for problems relating to least squares approximation and eigenvectors.
For further information about the commands in the LinearAlgebra package, see the help page for that command. For a general overview, see LinearAlgebra.
Getting Started
Commands in the package can be referred to using the long form, that is, Student[LinearAlgebra][EigenPlot].
It is recommended to load the package first and then use the shorter command names.
>

$\mathrm{with}\left(\mathrm{Student}\left[\mathrm{LinearAlgebra}\right]\right)\:$

The following examples show how the various routines work.
Note: If you set infolevel[Student] := 1 or infolevel[Student[LinearAlgebra]] := 1, many of the routines in this package provide additional information about the objects they are passed in the form of userinfo messages. This setting is recommended.
>

$\mathrm{infolevel}\left[\mathrm{Student}\left[\mathrm{LinearAlgebra}\right]\right]\u22541\:$


Vectors and Planes



Vector Sum


The VectorSumPlot command displays the sum of a collection of vectors. The sum is displayed graphically by connecting the head of each vector in the collection to the tail of another vector in the collection. As there are many ways to form these connections, the routine by default displays all connections, effectively producing a lattice whose edges can be followed from the origin to the point that corresponds to the sum. By default, the sum vector is drawn in black.
>

$\mathrm{VectorSumPlot}\left(\u27e81\,\frac{1}{2}\u27e9\,\u27e8\frac{1}{3}\,1\u27e9\right)$

>

$\mathrm{VectorSumPlot}\left(\u27e81\,0\,0\u27e9\,\u27e80\,1\,0\u27e9\,\u27e80\,0\,1\u27e9\right)$

Alternatively, an animation showing the possible paths one at a time can be requested.
To run the animation sequence:
Click the plot produced by the following command.
>

$\mathrm{VectorSumPlot}\left(\u27e81\,0\,0\u27e9\,\u27e80\,1\,0\u27e9\,\u27e80\,0\,1\u27e9\,\mathrm{output}\=\mathrm{animation}\right)$

Click the animation controls in the Maple worksheet Context bar.


Cross Product


The cross product of 2 vectors can be displayed using the CrossProductPlot command. By default, the result is colored magenta.
>

$\mathrm{CrossProductPlot}\left(\u27e81\,1\,\frac{1}{2}\u27e9\,\u27e80\,2\,1\u27e9\right)$

<1, 1, 1/2> &x <0, 2, 1> =
<0, 1, 2>
 
The visualization commands in the Student[LinearAlgebra] subpackage allow you considerable control over the appearance of the resulting plot. Some controls are associated with particular components of the plot. For example, the colors of the vectors in a CrossProductPlot can be adjusted.
>

$\mathrm{CrossProductPlot}\left(\u27e81\,1\,\frac{1}{2}\u27e9\,\u27e80\,2\,1\u27e9\,\mathrm{vectorcolors}\=\left[\mathrm{green}\,\mathrm{cyan}\,\mathrm{yellow}\right]\right)$

<1, 1, 1/2> &x <0, 2, 1> =
<0, 1, 2>
 
Other controls are global in nature.
>

$\mathrm{CrossProductPlot}\left(\u27e81\,1\,\frac{1}{2}\u27e9\,\u27e80\,2\,1\u27e9\,\mathrm{orientation}\=\left[50\,50\right]\,\mathrm{title}\=''Cross\; product\; with\; orientation\; and\; view\; specified''\,\mathrm{view}\=\left[3..3\,3..3\,3..3\right]\right)$

<1, 1, 1/2> &x <0, 2, 1> =
<0, 1, 2>
 


Planes


To visualize planes and their related vectors in three dimensions, the Student[LinearAlgebra] package provides the PlanePlot command. This command allows you to specify a plane in different ways. It also displays the plane and, optionally, a normal vector, a pair of basis vectors, a vector to a point on the plane from the origin, and the vector from the origin to the closest point on the plane to the origin.
For example, you can specify the plane by specifying its normal vector and a point on it.
>

$\mathrm{PlanePlot}\left(\u27e81\,\frac{1}{2}\,1\u27e9\,\u27e81\,1\,1\u27e9\right)$

normal vector: <1., .5000, 1.>
equation of plane: 1.*x+.5000*y+1.*z = .5000
point on plane nearest origin: <.2222, .1111, .2222>
basis vectors: <1.155, .2309, 1.270>, <.5774, 1.617, .2309>
 
To see a pair of vectors that form a basis for the plane (when added to the specified point), use the showbasis option.
>

$\mathrm{PlanePlot}\left(\u27e81\,\frac{1}{2}\,1\u27e9\,\u27e81\,1\,1\u27e9\,\mathrm{showbasis}\right)$

normal vector: <1., .5000, 1.>
equation of plane: 1.*x+.5000*y+1.*z = .5000
point on plane nearest origin: <.2222, .1111, .2222>
basis vectors: <1.155, .2309, 1.270>, <.5774, 1.617, .2309>
 
The plane can also be specified via a set or list of Vectors (the basis), a Vectorvalued function of two parameters, or as an equation or algebraic expression in 3 variables. In either the normal vector form or the basis vectors form, if a point on the plane is not specified, then the plane passes through the origin.
>

$\mathrm{PlanePlot}\left(\left\{\u27e81\,1\,1\u27e9\,\u27e81\,0\,2\u27e9\right\}\right)$

normal vector: <.8944, 1.342, .4472>
equation of plane: .8944*x+1.342*y+.4472*z = 0.
point on plane nearest origin: <0., 0., 0.>
basis vectors: <1., 1., 1.>, <1., 0., 2.>
 
>

$\mathrm{PlanePlot}\left(\left(s\,t\right)\→\u27e81\,1\,1\u27e9\+s\u27e81\,0\,2\u27e9\+t\u27e80\,1\,1\u27e9\,\mathrm{showbasis}\,\mathrm{basisoptions}\=\left[\mathrm{color}\=\mathrm{black}\right]\,\mathrm{orientation}\=\left[100\,125\right]\right)$

normal vector: <1.095, .5477, .5477>
equation of plane: 1.095*x.5477*y+.5477*z = 1.095
point on plane nearest origin: <.6667, .3333, .3333>
basis vectors: <0., 1.225, 1.225>, <.7746, 0., 1.549>
 
In the equation or algebraic form, the variable names must be specified unless there are exactly 3 such names in the first argument.
>

$\mathrm{PlanePlot}\left(2y\+3z\=2\,\left[x\,y\,z\right]\,\mathrm{showpoint}\=\mathrm{false}\right)$

normal vector: <0., 2., 3.>
equation of plane: 2.*y+3.*z = 2.
point on plane nearest origin: <0., .3077, .4615>
basis vectors: <.5547, .6923, .4615>, <.8321, .4615, .3077>
 


Projections


Projecting vectors onto lines and planes is a common and important operation. To visualize this operation, use the ProjectionPlot command.
>

$\mathrm{ProjectionPlot}\left(\u27e81\,\frac{1}{2}\u27e9\,\u27e8\frac{1}{2}\,\frac{1}{3}\u27e9\right)$

Vector: <1, 1/2>
Projection: <.4615, .3077>
Orthogonal complement: <.5385, .8077>
Norm of orthogonal complement: .9707
 
By default, the plot displays the vector being projected, the line or plane onto which it is being projected, the projected vector, and the projection onto the orthogonal complement of the projection line or plane. Furthermore, dashed lines from the head of the input vector to the heads of its projections onto the line or plane and its projection onto the corresponding orthogonal complement are drawn. Using various show... options you can suppress these components and optionally request that the vector or vectors used to define the projection line or plane be shown.
>

$\mathrm{ProjectionPlot}\left(\u27e81\,\frac{1}{2}\u27e9\,\u27e8\frac{1}{2}\,\frac{1}{3}\u27e9\,\mathrm{showbasis}\=\mathrm{true}\,\mathrm{showlines}\=\mathrm{false}\right)$

Vector: <1, 1/2>
Projection: <.4615, .3077>
Orthogonal complement: <.5385, .8077>
Norm of orthogonal complement: .9707
 
A plane to be projected on is specified as a set or list of vectors. Note: An option of the form option_name = true can be abbreviated to option_name.
>

$\mathrm{ProjectionPlot}\left(\u27e82\,1\,3\u27e9\,\left\{\u27e8\frac{3}{2}\,1\,\frac{1}{2}\u27e9\,\u27e8\frac{1}{3}\,1\,\frac{1}{8}\u27e9\right\}\,\mathrm{showbasis}\right)$

Vector: <2, 1, 3>
Projection: <2.704, 1.023, .9336>
Orthogonal complement: <.7045, .2348e1, 2.066>
Norm of orthogonal complement: 2.183
 



Linear Systems



Solutions of Linear Systems


Solving a linear system involves finding the set of points that simultaneously satisfy all the equations of the system. In 2D space, this solution is one of the empty set, a point, or a line. In 3D space it can be any of those, or a plane. By displaying a plot of the input equations, which represent lines or planes, the physical interpretation of this solution becomes clearer. For a 2D plot, little more is required.
>

$\mathrm{LinearSystemPlot}\left(\left\{x\+y\=1\,2x3y\=\frac{1}{2}\right\}\right)$

The solution is the point <.7000, .3000>
 
>

$\mathrm{LinearSystemPlot}\left(\left\{xy\=1\,2x2y\=1\right\}\right)$

The solution is the point <.3000, .3000>
 
In three dimensions, the solution to the system may not be apparent from the first presentation of the plot. However, by clicking on the plot and dragging with the mouse, you can manipulate the plot to get a better view. In the default presentation of the following system, one of the planes may appear as a line. Drag the plot to see all 3 planes and their common point of intersection more clearly.
>

$\mathrm{LinearSystemPlot}\left(\left\{x\+y\+z\=1\,12y\+z\=3\,xy\=0\right\}\right)$

The solution is the point <.2500, .2500, 1.500>
 
The input linear system can also be specified as a Matrix/Vector pair, or as an augmented Matrix.
>

$\mathrm{LinearSystemPlot}\left(\u27e8\u27e81\,2\u27e9\\u27e83\,1\u27e9\\u27e80\,1\u27e9\u27e9\right)$

The solution is the point <.4286, .1429>
 
The dimensionality of the system (2x2 or 3x3) is normally determined from the system. In the case of a system specified by a set of equations, you can force the dimensionality to be higher than the apparent dimensionality by specifying the full set of variable names in a list.
>

$\mathrm{LinearSystemPlot}\left(\left\{x\+\frac{1y}{2}\=1\right\}\,\left[x\,y\,z\right]\,\mathrm{axes}\=\mathrm{normal}\right)$

The solution is the plane 1.*a.5000*b = 1.
 


Linear Transformations


The Student[LinearAlgebra] subpackage provides two commands that can be used to visualize the action of a linear transformation. The first, LinearTransformPlot, displays domain and range objects in a single plot. The domain object is a line segment, circle, or sphere, as determined by the column dimension of the matrix, while the range object is the image of the domain object under the action of that matrix.
>

$\mathrm{LinearTransformPlot}\left(\u27e8\u27e81\,2\u27e9\\u27e81\,1\u27e9\u27e9\right)$

Rank: 2
Norm: 2.303
Determinant: 3
Eigenvalue: 3^(1/2)
Multiplicity: 1
Eigenvector: < 1.366, 1. >
Eigenvalue: 3^(1/2)
Multiplicity: 1
Eigenvector: < .3660, 1. >
 
>

$\mathrm{LinearTransformPlot}\left(\u27e8\u27e81\,2\,3\u27e9\\u27e84\,5\,6\u27e9\\u27e87\,8\,9\u27e9\u27e9\,\mathrm{showeigenvectors}\=\mathrm{false}\,\mathrm{nullspaceoptions}\=\left[\mathrm{thickness}\=3\,\mathrm{color}\=\mathrm{black}\right]\,\mathrm{spheregrid}\=10\right)$

Rank: 2
Norm: 16.85
Determinant: 0
Eigenvalue: 0
Multiplicity: 1
Eigenvector: < 1, 2, 1 >
Eigenvalue: 15/2+3/2*33^(1/2)
Multiplicity: 1
Eigenvector: < .6856, .8425, 1. >
Eigenvalue: 15/23/2*33^(1/2)
Multiplicity: 1
Eigenvector: < 2.183, .5928, 1. >
 
The second command, ApplyLinearTransformPlot, can be used to show the action of a given linear transformation as applied to different domain objects. These input objects can be any of a regular set of objects (circle, square, sphere, cube, or grid) or an arbitrary plot object. The default object is a circle in the 2D case and a sphere in the 3D case. Also, by default, 4 successive applications of the transformation are applied (where the input at each step after the first is the output from the previous step).
>

$\mathrm{ApplyLinearTransformPlot}\left(\u27e8\u27e81\,2\u27e9\\u27e81\,1\u27e9\u27e9\right)$

Determinant: 3
Norm: (7/2+1/2*13^(1/2))^(1/2)
Eigenvalue: 1+I*2^(1/2)
Multiplicity: 1
Eigenvector: < .7070*I, 1. >
Eigenvalue: 1I*2^(1/2)
Multiplicity: 1
Eigenvector: < .7070*I, 1. >
 
>

$p:=\mathrm{plot}\left(\mathrm{sin}\left(x\right)\,x\=\mathrm{\π}..\mathrm{\π}\right)\;$$p$

${p}{:=}{\mathrm{PLOT}}{}\left({\mathrm{...}}\right)$
 
>

$\mathrm{ApplyLinearTransformPlot}\left(\u27e8\u27e81\,\frac{1}{2}\u27e9\\u27e8\frac{1}{3}\,\frac{1}{2}\u27e9\u27e9\,p\right)$

Determinant: 1/3
Norm: (29/36+1/36*697^(1/2))^(1/2)
Eigenvalue: 1/4+1/12*57^(1/2)
Multiplicity: 1
Eigenvector: < 2.757, 1. >
Eigenvalue: 1/41/12*57^(1/2)
Multiplicity: 1
Eigenvector: < .2417, 1. >
 
This command can also produce animations.
To run the animation:
Click the plot produced by the following command.
>

$\mathrm{ApplyLinearTransformPlot}\left(\u27e8\u27e8\frac{1}{2}\,0\,1\u27e9\\u27e80\,1\,\frac{1}{2}\u27e9\\u27e8\frac{1}{3}\,\frac{1}{2}\,0\u27e9\u27e9\,\mathrm{output}\=\mathrm{animation}\right)$

Determinant: 11/24
Norm: RootOf(576*_Z^31648*_Z^2+1116*_Z121,index = 3)^(1/2)
Eigenvalue: 1/6*(58+2*787^(1/2))^(1/3)1/(58+2*787^(1/2))^(1/3)1/6
Multiplicity: 1
Eigenvector: < .1983, 2.752, 1. >
Eigenvalue: 1/12*(58+2*787^(1/2))^(1/3)+1/2/(58+2*787^(1/2))^(1/3)1/6+1/4*I*3^(1/2)*(1/3*(58+2*787^(1/2))^(1/3)+2/(58+2*787^(1/2))^(1/3))
Multiplicity: 1
Eigenvector: < .1780.5844*I, .3238+.1260*I, 1. >
Eigenvalue: 1/12*(58+2*787^(1/2))^(1/3)+1/2/(58+2*787^(1/2))^(1/3)1/61/4*I*3^(1/2)*(1/3*(58+2*787^(1/2))^(1/3)+2/(58+2*787^(1/2))^(1/3))
Multiplicity: 1
Eigenvector: < .1780+.5844*I, .3238.1260*I, 1. >
 
Click the animation controls in the Maple worksheet Context bar.
To see the action of the transformation more clearly, use the iterations and trace options. If the norm of the matrix is large, use the logscale option.
>

$\mathrm{ApplyLinearTransformPlot}\left(\u27e8\u27e81\,\frac{1}{2}\u27e9\\u27e8\frac{1}{3}\,\frac{3}{5}\u27e9\u27e9\,\mathrm{output}\=\mathrm{animation}\,\mathrm{iterations}\=20\,\mathrm{trace}\=4\right)$

Determinant: 23/30
Norm: (1549/1800+13/1800*2929^(1/2))^(1/2)
Eigenvalue: 4/5+1/30*I*114^(1/2)
Multiplicity: 1
Eigenvector: < .4000+.7116*I, 1. >
Eigenvalue: 4/51/30*I*114^(1/2)
Multiplicity: 1
Eigenvector: < .4000.7116*I, 1. >
 


Return to Index of Example Worksheets
