You are on page 1of 1

Mathematica Tips

Here are some guidelines to using Mathematica to solve systems of linear equations. (1) Given a system Ax = b, enter the matrix A. One way to do this is to go under the Insert menu and click on Table/Matrix, and then click on New ... Fill in the appropriate numbers of rows and columns for A. A blank template will appear; use the Tab key to move from entry to entry. When youve lled in all the entries, go to the outside of the matrix and hit Shift+Enter. Then do the same thing to enter the column vector b. (2) To create the augmented matrix B = [A|b], enter the command Join[A,B,2]//MatrixForm Shift+Enter. (3) The rst way to solve Ax = b is to row reduce the augmented matrix B you just created. The command for this is RowReduce[B]//MatrixForm Shift+Enter. Then you can backsolve manually to nd x. (4) The second way to solve the system is the following. First enter NullSpace[A] Shift+Enter. This gives you a basis for the solutions of Ax = 0. Then enter LinearSolve[A,b] Shift+Enter. This will give you a particular solution of Ax = b. The general solution of the system is then the particular solution + the solutions you get from NullSpace. (5) The third way to solve the system is to use the Solve command. This works as follows. Enter the following Solve[A.{x1 , x2 , ..., xn } == {b1 , b2 , . . . , bn }, {x1 , x2 , ..., xn }] Shift+Enter (here, you must list all the xs; that is, if there are 4 variables, you would enter x1 , x2 , x3 , x4 ). What you will get is the general solution of the system. Note that xi is entered in Mathematica as Subscript[x,i]

You might also like