Introduction Gaussian Elimination
Total Page:16
File Type:pdf, Size:1020Kb
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ظVisualizationظBrowse: Linear AlgebraظTasksظTools Matrix Action: 2-D K 43 Matrix: K 65 K 0.8387 0.5446 4.989 7.755 9.221 9.271 Start Eigenpairs 2. -1. Clear .4472 .7071 , .8944 .7071 = 147 0 60120 180 240 300 360 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 Plane PlotظVisualizationsظBrowse: Linear AlgebraظTasksظTools Graph of a Plane Specify a plane in one of the , y, z following ways: Variables: Equation Normal vector and a Equation point Two vectors in the plane (basis) and a point Normal & Point Obtain plot of plane and Normal vector Equation of the plane Basis & Point , P 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 Digits = = 5 Clear and Reset the slider. 4146168 10 12 Click the icon below to execute the PlanePlot command. 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. Projection Plot onto 1-DظVisualizationsظBrowse: Linear AlgebraظTasksظTools Projection onto 1-D Subspace Vector to be projected Graph Clear All 2, 3 Project onto Vector Line thru origin 1,K 1 Coordinates = [x,y] Coordinates = Other = Projection Float Orthogonal Component Float 1 5 K 2 2 1 5 2 2 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. Projection Plot onto 2-DظVisualizationsظBrowse: Linear AlgebraظTasksظTools Project Vector onto Plane in Vector to be projected: Graph Clear All 1, 2, 3 Project onto plane: Basis for plane Plane thru origin 1,K 2, 3 , K 1, 1, 0 Coordinates = [x,y,z] Other = Projection Float Orthogonal Component Float K 17/19 36/19 2/19 36/19 45/19 12/19 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.