(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 14567, 430]*) (*NotebookOutlinePosition[ 15421, 460]*) (* CellTagsIndexPosition[ 15377, 456]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Row Operations and Elementary Matrices", "Title", ImageRegion->{{-0, 1}, {0, 1}}], Cell[BoxData[{ \(Author : \ Thomas\ Shores\), "\[IndentingNewLine]", \(University\ of\ Nebraska\), "\[IndentingNewLine]", \(Send\ comments\ \(to : \ tshores@math . unl . edu\)\)}], "Input", FontFamily->"Helvetica", FontWeight->"Plain", FontVariations->{"CompatibilityType"->0}], Cell[CellGroupData[{ Cell["Row Operations and Elementary Matrices", "Subsection", ImageRegion->{{-0, 1}, {0, 1}}], Cell["Suppose we are given a matrix A, such as:", "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["a = {{1,2,7},{-1,0,3},{2,1,1}}", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell[TextData[{ " We would like to know if A possesses certain properties, one \ immediate example being whether we can solve A . x = b for any vector b. If \ we let the vector b = (1,0,0), then\nthe requirement A . x = b breaks down \ into three (linear) equations:\n \n x", StyleBox["1", FontVariations->{"CompatibilityType"->"Subscript"}], " + 2 x", StyleBox["2", FontVariations->{"CompatibilityType"->"Subscript"}], " + 7 x", StyleBox["3", FontVariations->{"CompatibilityType"->"Subscript"}], " = 1\n - x", StyleBox["1", FontVariations->{"CompatibilityType"->"Subscript"}], " + 3 x", StyleBox["3", FontVariations->{"CompatibilityType"->"Subscript"}], " = 0\n 2 x", StyleBox["1", FontVariations->{"CompatibilityType"->"Subscript"}], " + x", StyleBox["2", FontVariations->{"CompatibilityType"->"Subscript"}], " + x", StyleBox["3", FontVariations->{"CompatibilityType"->"Subscript"}], " = 0\n From algebra class we know we can manipulate these equations \ in certain ways and still\n keep the same set of solutions. For example, we \ can add the first equation to the second and subtract twice the first \ equation from the third. Then we get :\n x", StyleBox["1", FontVariations->{"CompatibilityType"->"Subscript"}], " + 2 x", StyleBox["2 ", FontVariations->{"CompatibilityType"->"Subscript"}], " + 7 x", StyleBox["3", FontVariations->{"CompatibilityType"->"Subscript"}], " = 1\n 2 x", StyleBox["2", FontVariations->{"CompatibilityType"->"Subscript"}], " + 10 x", StyleBox["3", FontVariations->{"CompatibilityType"->"Subscript"}], " = 1\n -3 x", StyleBox["2", FontVariations->{"CompatibilityType"->"Subscript"}], " - 13 x", StyleBox["3", FontVariations->{"CompatibilityType"->"Subscript"}], " = -2\n And now we could convert this system back into matrix form. \ But dealing with variables and equations seems unnecessarily messy. What we \ need are methods of manipulating the matrix itself while keeping its \ properties intact. To do this, we need to think of the rows of the matrix as \ individual entities, which we can add (component by component), for example. \ Now, in the case of linear systems, the following \ \[OpenCurlyDoubleQuote]equation operations\[CloseCurlyDoubleQuote] do not \ affect the solution set :\n (1) Adding a multiple of one equation to \ another\n (2) Exchanging two equations\n (3) Multiplying an \ equation on both sides by a nonzero constant\n\n We can certainly do more, \ but it turns out that this set of operations is quite useful and sufficient \ for our purposes. To show how these operations apply to matrices, it turns \ out that the following is true:\n \nFACT: (1) Let E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], " (", "\[Alpha]", ") (with i ", "\[NotEqual]", " j) be the matrix defined by \n ", "\:f2ec", " 1, if k = l\n (E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], "(", "\[Alpha]", ")) ", StyleBox["k,l", FontVariations->{"CompatibilityType"->"Subscript"}], " = ", "\:f2ed", " ", "\[Alpha]", ", if k = i and l = j\n ", "\:f2ee", " 0, otherwise.\n Then for any compatible matrix A, B = \ E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], "(", "\[Alpha]", ") . A is a matrix the same as A\n except the \ ", StyleBox["i", FontSlant->"Italic"], "th row of B is the ", StyleBox["i", FontSlant->"Italic"], "th row of A plus ", "\[Alpha]", " times the ", StyleBox["j", FontSlant->"Italic"], "th row of A.\n(2) Let E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], " (i ", "\[NotEqual]", " j) be the matrix defined by \n ", "\:f2ec", " 1, if k = l and k ", "\[NotElement]", " {i,j}\n (E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], ")", StyleBox["k,l", FontVariations->{"CompatibilityType"->"Subscript"}], " = ", "\:f2ed ", "1, if {k,l} = {i,j} (set-wise equality)", " ", "\n ", "\:f2ee", " 0, otherwise.\n Then the matrix E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], " . A is equal to A, except the ", StyleBox["i", FontSlant->"Italic"], "th and ", StyleBox["j", FontSlant->"Italic"], "th rows of A have been\n exchanged. \n(3) Let \ E", StyleBox["i", FontVariations->{"CompatibilityType"->"Subscript"}], "(", "\[Alpha]", ") (", "\[Alpha]", " ", "\[NotEqual]", " 0) be defined by\n ", "\:f2ec", " 1, if k = l and k ", "\[NotEqual]", " i\n (E", StyleBox["i", FontVariations->{"CompatibilityType"->"Subscript"}], "(", "\[Alpha]", "))", StyleBox["k,l", FontVariations->{"CompatibilityType"->"Subscript"}], " = ", "\:f2ed", " ", "\[Alpha]", ", if k = l = i\n ", "\:f2ee", " 0, if k ", "\[NotEqual]", " l. \n Then the matrix E", StyleBox["i", FontVariations->{"CompatibilityType"->"Subscript"}], "(", "\[Alpha]", ") . A is the same as A, except the ", StyleBox["i", FontSlant->"Italic"], "th row has been\n multiplied by ", "\[Alpha]", ". \n The matrices ", StyleBox[" ", FontFamily->"Courier", FontWeight->"Bold"], "E", StyleBox["*", FontVariations->{"CompatibilityType"->"Subscript"}], " defined in the above fact are called ", StyleBox["elementary matrices", FontSlant->"Italic"], " and their role in Matrix Theory is important. If the matrix A", StyleBox["aug", FontVariations->{"CompatibilityType"->"Subscript"}], " = [A ", "\:f2bd", " b] represents the equation A . x = b,\nthen multiplying A", StyleBox["aug", FontVariations->{"CompatibilityType"->"Subscript"}], " on the left by elementary matrices does not affect the solution of this \ system, but at the same time it can make the form of A", StyleBox["aug", FontVariations->{"CompatibilityType"->"Subscript"}], " simpler. " }], "Text", ImageRegion->{{-0, 1}, {0, 1}}] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ "Elementary Matrices in ", StyleBox["Mathematica", FontSlant->"Italic"] }], "Subsection", ImageRegion->{{-0, 1}, {0, 1}}], Cell[TextData[{ "When performing row operations, often the matrices involved can be \ complicated and computational error unavoidable. To this end, a program has \ been written in ", StyleBox["Mathematica", FontSlant->"Italic"], " to simulate these matrices. Click in the next cell and press the key \ marked Enter to load in this program. " }], "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["<< ElementaryMatrices.ma", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell[TextData[{ "Because ", StyleBox["Mathematica", FontSlant->"Italic"], " does not have subscripts, certain notational liberties have been made:\n \ E", StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], "(", "\[Alpha]", ") . A ", "\[Congruent]", " EM [i,j,", "\[Alpha]", ", A]\n E", StyleBox["i,j . A ", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["\[Congruent]", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox[" EM [{i,j},A]\n E", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["i", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["(", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["\[Alpha]", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox[") . A ", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["\[Congruent]", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox[" EM [i,", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["\[Alpha]", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox[",A]\nNote particularly the braces ({}) in E", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["i,j", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox[" to distinguish it from E", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["i", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["(", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["\[Alpha]", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["), purely for the machine's sake. Now let's do some row \ operations on the following matrix. ( Click in the cells and press enter to \ activate them.) ", FontVariations->{"CompatibilityType"->"Subscript"}] }], "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["a = {{1,1,1},{1,0,1},{1,0,0}}", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell["MatrixForm[a]", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell["EM [1,3,5,a];", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell[TextData[{ " Note two things at this point : first, the semicolon at the end of \ the command, which keeps the result from being printed in \ \[OpenCurlyDoubleQuote]machine form\[CloseCurlyDoubleQuote] -- the program \ prints the result of the operation if it is legal -- and second, that EM \ [1,3,5,A] really means E", StyleBox["1,3", FontVariations->{"CompatibilityType"->"Subscript"}], "(5) . A. A simple computation shows this is what was expected. Now let's \ do some more row operations from this matrix; the symbol % means to use the \ last output as input, even though we could have saved the previous result as \ another matrixwith a command like ", StyleBox["b = EM [1,3,5,a]", FontWeight->"Bold"], "." }], "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["EM [{1,3},%];", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell["\<\ We see we have swapped the first and third rows of our new \ matrix. What happens if we try to swap a row, such as the fifth, which isn't \ there? Let's try it ...\ \>", "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["EM [{1,5},%];", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell[TextData[{ " Aha! The programmer saw ahead to people possibly mis-using this \ routine (this phenomenon is called -- perhaps inappropriately -- the \ \[OpenCurlyDoubleQuote] idiot test\[CloseCurlyDoubleQuote]) and lets us know \ that something is wrong. The routine saw that our matrix has three rows and \ so we couldn't possibly have a fifth row. So we don't need to tell how big \ our matrix is; ", StyleBox["Mathematica", FontSlant->"Italic"], " takes care of it for us. Another feature of the program is that if we do \ get a message like this, we can still use the % to mean \ \[OpenCurlyDoubleQuote] the last matrix printed\[CloseCurlyDoubleQuote], so \ that we don't have to re-work everything if we just happen to make a typo. \ Now let's multiply the first row by 5:" }], "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["EM [1,5,%];", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell["\<\ This brings up an important point : the last two commands were \ almost alike, so we must be careful at times like this. And if we try to \ multiply a row by zero, we get :\ \>", "Text", ImageRegion->{{-0, 1}, {0, 1}}], Cell["EM [2,0,%];", "Input", ImageRegion->{{-0, 1}, {0, 1}}], Cell["\<\ ... and the program tells us simply that we're trying to do \ something wrong.\ \>", "Text", ImageRegion->{{-0, 1}, {0, 1}}] }, Closed]] }, Closed]] }, FrontEndVersion->"4.0 for X", ScreenRectangle->{{0, 1152}, {0, 864}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 600}, WindowMargins->{{Automatic, 308}, {104, Automatic}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1739, 51, 89, 1, 154, "Title"], Cell[1831, 54, 297, 6, 64, "Input"], Cell[CellGroupData[{ Cell[2153, 64, 94, 1, 45, "Subsection"], Cell[2250, 67, 91, 1, 32, "Text"], Cell[2344, 70, 81, 1, 27, "Input"], Cell[2428, 73, 6669, 199, 1120, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[9134, 277, 147, 5, 29, "Subsection"], Cell[9284, 284, 399, 9, 70, "Text"], Cell[9686, 295, 75, 1, 70, "Input"], Cell[9764, 298, 2042, 52, 70, "Text"], Cell[11809, 352, 80, 1, 70, "Input"], Cell[11892, 355, 64, 1, 70, "Input"], Cell[11959, 358, 64, 1, 70, "Input"], Cell[12026, 361, 789, 16, 70, "Text"], Cell[12818, 379, 64, 1, 70, "Input"], Cell[12885, 382, 228, 5, 70, "Text"], Cell[13116, 389, 64, 1, 70, "Input"], Cell[13183, 392, 848, 15, 70, "Text"], Cell[14034, 409, 62, 1, 70, "Input"], Cell[14099, 412, 231, 5, 70, "Text"], Cell[14333, 419, 62, 1, 70, "Input"], Cell[14398, 422, 141, 4, 70, "Text"] }, Closed]] }, Closed]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)