(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "X Window System Mathematica Notebook Front End Version 2.2"; X11StandardFontEncoding; fontset = title, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, fontName, "times"; fontset = subtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, fontName, "times"; fontset = subsubtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, fontName, "times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 20, fontName, "times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 18, fontName, "times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, fontName, "Courier"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 18, fontName, "times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, fontName, "times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, 18, fontName, "courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 14, fontName, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, fontName, "courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 18, fontName, "courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, fontName, "courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, fontName, "courier"; fontset = name, inactive, noPageBreakInGroup, nohscroll, preserveAspect, M7, italic, B65535, 10, fontName, "times"; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 12, fontName, "times"; fontset = leftheader, 12, fontName, "times"; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, italic, 12, fontName, "times"; fontset = leftfooter, 12, fontName, "times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "courier"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, fontName, "times";paletteColors = 128; showRuler; automaticGrouping; currentKernel; ] :[font = section; inactive; preserveAspect; startGroup] Using Mathematica to solve systems of linear equations. :[font = subsection; inactive; preserveAspect; startGroup] Example 1. :[font = input; preserveAspect; fontSize = 14] Let us consider the following system of linear equations: 5 x_1 + 5 x_2 + 2 x_3 + 3 x_4 + 7 x_5 = 1 6 x_1 + 2 x_2 + 7 x_3 + 7 x_4 + 3 x_5 = 17 9 x_ 1 + 8 x_2 + 10 x_3 + 6 x_4 + 4 x_5 = 2 8 x_1 + 4 x_2 + 2 x_3 + 5 x_ 4 + x_ 5 = 4 3 x_ 1 + 10 x_2 + 2 x_3 + 7 x_4 + x_5 = 10 ;[s] 1:0,0;439,-1; 1:1,0,0 ,times,0,14,0,0,0; :[font = text; inactive; preserveAspect] The matrix of coefficients is as follows ;[s] 3:0,0;4,1;27,2;40,-1; 3:1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0; :[font = input; preserveAspect] MatrixForm[M = {{5, 5, 2, 3, 7}, {6,2,7,7,3}, {9, 8, 10, 6, 4}, {8, 4, 2, 5, 1}, {3, 10, 2, 7, 1}} ] ;[s] 3:0,0;15,1;144,2;147,-1; 3:1,0,0 ,courier,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0;1,0,0 ,courier,1,18,0,0,0; :[font = text; inactive; preserveAspect] Now, let us define the column vectors b and x. ;[s] 5:0,0;38,1;39,2;44,3;45,4;46,-1; 5:1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0; :[font = input; preserveAspect] b = {1,17,2,4,10}; x = {x1, x2, x3, x4, x5}; :[font = text; inactive; preserveAspect] So, we can describe the system of equations above using the matrix equation Mx = b. The following  command shows the matrices Mx and b: Notice that matrix multiplication is denoted by the period '.' :[font = input; preserveAspect] Print[MatrixForm[M.x]," ", MatrixForm[b]] :[font = input; preserveAspect] :[font = text; inactive; preserveAspect] In order to get the full augmented matrix of the system, we need to add the column b to M. ;[s] 6:0,0;25,1;41,2;84,3;85,4;89,5;91,-1; 6:1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0; :[font = text; inactive; preserveAspect] Here is the command that adds the last column to M. The new matrix AugM is the augmented matrix of the system of linear equations above. ;[s] 3:0,0;49,1;52,2;136,-1; 3:1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0; :[font = input; preserveAspect] MatrixForm[ AugM = Transpose[ Join[Transpose[M],{b}] ] ] :[font = text; inactive; preserveAspect] We can row reduce this matrix with the following mathematica command: ;[s] 3:0,0;7,1;18,2;69,-1; 3:1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0; :[font = input; preserveAspect] MatrixForm[ RowReduce[ AugM ]] :[font = text; inactive; preserveAspect] Alternatively, we could ask Mathematica to solve the system of linear equations given by M and b as follows: ;[s] 5:0,0;89,1;90,2;95,3;97,4;109,-1; 5:1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0;1,0,0 ,times,1,18,0,0,0;1,0,0 ,times,0,18,0,0,0; :[font = input; preserveAspect; endGroup] LinearSolve[M,b] :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Example 2. :[font = text; inactive; preserveAspect] Notice that the system of equations Mx = b involves the same number of equations as unknowns. Let us examine a system where the number of unknowns exceeds the number of equations. :[font = input; preserveAspect] MatrixForm[ A = {{2, 3, 1},{10,-7,2}} ] :[font = input; preserveAspect] MatrixForm[y = {y1,y2,y3}] :[font = input; preserveAspect] Print[MatrixForm[A.y]," ",MatrixForm[c={0,0}]] :[font = text; inactive; preserveAspect] In this case, the LinearSolve command is inadequate. It only gives one solution. :[font = input; preserveAspect] LinearSolve[A,c] :[font = text; inactive; preserveAspect] If we once again form the augmented matrix, we can obtain the complete solution. :[font = input; preserveAspect] MatrixForm[ AugA = Transpose[ Join[ Transpose[A], {c}] ] ] :[font = input; preserveAspect] MatrixForm[RowReduce[AugA]] :[font = text; inactive; preserveAspect; endGroup; endGroup] So the general solution is: y2 = - (3/22) y3 y1 = - (13/44) y3 ^*)