Application Center - Maplesoft

# Classroom Tips and Techniques: Stepwise Solutions in Maple - Part 2 - Linear Algebra

You can switch back to the summary page by clicking here.

Classroom Tips and Techniques: Stepwise Solutions in Maple - Part 2 - Linear Algebra
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft

Introduction

In the preceding article Stepwise Solutions in Maple - Part 1, we detailed the Maple tools for obtaining stepwise solutions of problems in algebra, and calculus of one and several variables.  In this sequel, we detail the stepwise tools available in linear algebra.  Stepwise solutions in vector calculus will be discussed in our next article.

These tools include tutors that implement Gaussian arithmetic for solving linear systems and inverting a square matrix, calculation of eigenvalues and eigenvectors, and task templates that provide simplified interfaces to some of the visualizations tools in the Student LinearAlgebra package. There is also a task template for visualizing the transforming action of a matrix in the plane.

But again, we point out that Maple "does" symbolic math, and can therefore be directed to implement the steps of nearly any algorithmic computation.

Gaussian Elimination

Gaussian elimination combines elementary row operations to transform a matrix into a row-equivalent upper triangular matrix. Table 1 illustrates the stepwise tool for this, the Gaussian Elimination tutor.

 Table 1   Gaussian Elimination tutor applied to an augmented matrix

If row-reduction were being implemented by hand, the first step would most likely be the addition of row 3 to row 1, thereby creating a 1 in the -position.  This was done to start the reduction, and the remaining steps shown in Table 1 are the result of the "All Steps" button.  If the "Next Step" button were used to step through the reduction, annotation for each step would appear in the upper right-hand window of the tutor.

Since the matrix in Table 1 is augmented, it arose from a linear system . To continue with the solution process, press the "Solve System" button, to obtain the contents of Table 2 where back-substitution is then applied stepwise.

 Table 2   Back-substitution completes the calculation started in Table 1

Pressing the "Equations" button writes the equations corresponding to the upper triangular matrix in Table 1. In succession, pressing the "Solve" buttons implements back-substitution.

Gauss-Jordan Elimination

Using the same elementary row operations as the Gaussian Elimination tutor, the Gauss-Jordan Elimination tutor illustrated in Table 3 row-reduces the augmented matrix in Table 1 to reduced row-echelon form.

 Table 3   Reduced row-echelon form by elementary row operations

Linear-System Solving

The Linear System Solving tutor is simply a portal to either the Gaussian Elimination tutor or the Gauss-Jordan Elimination tutor. The doorway is shown in Table 4.

 Table 4   The Linear System Solving tutor

Matrix Inversion

The inverse of the square matrix can be found by solving for its columns via the equations , where the are the columns of the identity matrix . Writing all these systems at once, and solving by transforming to reduced row-echelon form is a standard textbook method for finding the inverse. This calculation is implemented by the Matrix Inverse tutor, as shown in Table 5. Just the matrix is entered - the tutor augments with the identity.

 Table 5   Matrix inversion by elementary row operations leading to reduced row-echelon form.

Eigenvalues

The Eigenvalues tutor steps through the calculation of the eigenvalues of a square matrix. The four steps implemented are shown on the left in Table 6, with bold font used to indicate the present step.

 Table 6   First panel of the Eigenvalues tutor

The remaining calculations are summarized in Table 7.

 Calculate Find Solve for roots so the eigenvalues are Table 7   The final three steps in the Eigenvalues tutor

Eigenvectors

The Eigenvectors tutor steps through the calculation of the eigenvectors of a square matrix. Table 8 shows the initial panel for this tutor.

 Table 8   Initial panel for the Eigenvectors tutor

If the "Yes" button is selected, the Eigenvalues tutor (see Tables 6 and 7) is launched. If the "No" button is selected, then the panel shown in Table 9 is launched.  Note that the default matrix for both the Eigenvalues and Eigenvectors tutors is

with eigenvalues

 Table 9   Computing eigenvectors in the Eigenvectors tutor

Selecting a "Find Eigenvector" button leads to the three panels summarized in Table 10.

 Table 10   Stepwise calculation of the eigenvector corresponding to the eigenvalue

Visualizations

Nine of the ten visualization task templates for linear algebra are based on visualization commands in the Student Linear Algebra package. The PlanePlot, ProjectionPlot, and VectorSum commands, implemented in four of these visualization task templates, provide a measure of stepwise calculations. The Matrix Action task template is independent of the Student package, but also provides a significant stepwise presence in the subject.

Matrix Action 2-D

Table 11 shows the functioning of the Matrix Action 2-D task template.

 Matrix Action: 2-D Matrix:            Eigenpairs =

Table 11   Matrix Action 2-D task template

After entering the matrix , press the Start button, which then populates all the other fields. The slider at the bottom controls the unit vector x that appears in black in the lower graph. As the slider is moved, the varying components of x and are displayed. The length of is also computed and displayed just above the 2-norm of . The vector is plotted in the upper graph where the dotted curve traces the trajectory that the vector would make as the unit vector x traversed the unit circle.  The eigenvalues and eigenvectors (normalized) of are displayed, and in the lower graph, these unit eigenvectors are graphed, one in red and one in green.  Since an eigenvector is actually an invariant direction, the negative of each eigenvector is also plotted.

If the slider is adjusted so that the length of matches the 2-norm of , the vector in the upper graph should be at its maximum length.

Plane Plot

The PlanePlot command will draw a plane that is specified by an equation, by a normal vector and a point, and by a pair of (basis) vectors and a point. In addition, there are a number of parameters that control what is added to the plot, such things as the point on the plane nearest to the origin, etc. The Plane Plot task template provides a syntax-free interface for this command, but a number of the parameter settings have necessarily been hard-coded for simplicity.

Table 12 shows the task template used to draw the plane determined by the basis vectors

and the point

Graph of a Plane

Specify a plane in one of the following ways:

• Equation
• Normal vector and a point
• Two vectors in the plane (basis) and a point

Obtain plot of plane and

• Normal vector
• Equation of the plane
• Two vectors in the plane
• The point on the plane closest to the origin

The number of digits in the returned data is controlled by the slider.

Click the icon below to execute the PlanePlot command.

Variables:

Digits = =

normal vector: <.53452, -1.8708, 1.0690>
equation of plane: <.53452*x-1.8708*y+1.0690*z = 7.21605353130000005>
point on plane nearest origin: <.78261, -2.7391, 1.5652>
basis vectors: <1., 2., 3.>, <-2., 0., 1.>

Table 12   Plane Plot visualization task template

The slider at the bottom of the template controls the number of digits used in reporting most of the data at the bottom of the table. The graph itself (shown below) shows the plane, the normal vector (in orange) drawn at the point , a vector (in black) from the origin to the point on the plane nearest the origin, a vector (in red) from the origin to the point , and the basis vectors (in blue).

Projection onto a 1-D Subspace

The ProjectionPlot command in the Student Linear Algebra package will project a vector onto a one- or two-dimensional subspace. This dual functionality has been distributed across two different task templates. The task template "Projection Plot onto 1-D" projects a vector onto a one-dimensional subspace.  A vector in the plane can be projected onto another vector, or onto a line through the origin. The projection and the orthogonal component are computed; a graph is drawn for vectors that are completely numeric.  Table 13 contains an example of the projection of one planar vector onto another.

Tools?Tasks?Browse: Linear Algebra?Visualizations?Projection Plot onto 1-D

Projection onto 1-D Subspace

Vector to be projected

Project onto

Table 13   Projection of one planar vector onto another

Projection onto a 2-D Subspace

The ProjectionPlot command in the Student Linear Algebra package will project a vector onto a one- or two-dimensional subspace. This dual functionality has been distributed across two different task templates. The task template "Projection Plot onto 2-D" projects a vector onto a two-dimensional subspace, defined either by its basis, or by the equation of a plane through the origin. The projection and the orthogonal component are computed; a graph is drawn for vectors that are completely numeric.  Table 14 contains an example of the projection of a vector onto the plane spanned by a given basis of two other vectors.

Tools?Tasks?Browse: Linear Algebra?Visualizations?Projection Plot onto 2-D

Project Vector onto Plane in

Vector to be projected:

Project onto plane:

Table 14   Projection of a vector onto the plane spanned by a given basis

The vector being projected is drawn in black; its component in the plane, in green; and its component orthogonal to the plane, in red. The basis vectors spanning the plane of projection are drawn in blue.

Vector Sum

The VectorSumPlot command in the Student LinearAlgebra package will graph vectors and their sum, or show the parallelogram(s) of addition. The resultant vector is always drawn in black. The Vector Sum Plot task template provides a simplified interface to this command. After a list of either 2- or 3-dimensional vectors are entered, moving the slider that selects the number of vectors to add will cause both the resultant and the graph of the vectors to appear.

Table 15 shows the task template applied to three vectors in . The vector sum is given analytically as the resultant; and graphically (in black), as the sum of the cyan, purple, and red vectors. We elected not to display the overlapping parallelograms of addition.