MATH 122
Mathematica notebook illustrating the method of  Appendix of Project 3

(Note: This is an example only; the numbers are not related to those used in Project 3.)

Define vectors  b1 ,  b2, and Y:

b1={2,1, 0}

b2={0,1,2}

Y={y1,y2,y3}

They are row-vectors, so if we want to use them as columns, we first create a matrix with these vectors as rows and then transpose it.

Create a coefficient matrix whose columns are  b1 , b2:

B=Transpose[{b1 , b2}]

The next command allows you to verify that the matrix you have created indeed has the form you want it to have:

MatrixForm[B]

Syntax Note:   Do NOT try to combine the last two commands into one, i.e., do NOT type 
B=MatrixForm[Transpose[{b1 , b2}]]
If you do it, Mathematica will show you the same matrix as above, but will be unable to perform any operations with matrix B.

Create the augmented matrix for the linear system B*X=Y:

AugmentedB=Transpose[{b1 , b2,Y}]

MatrixForm[AugmentedB]

Now solve the linear system  B*X=Y  by putting its augmented matrix in the reduced echelon form:

RRAugmentedB=RowReduce[AugmentedB]

MatrixForm[RRAugmentedB]

Oops! The  y1, y2, y3  have disappeared! The reason for that is explained at the end of the first paragraph of the Appendix.

We now implement the workaround described in the Appendix.

Add an extra column between the coefficient matrix  B  and the right-hand-side vector  Y:

AugmentedBmod=Transpose[{b1,b2,{0,0,1}, Y}]

MatrixForm[AugmentedBmod]

RRAugmentedBmod=RowReduce[AugmentedBmod]

MatrixForm[RRAugmentedBmod]

Finally, to go back to the solution of  B*X=Y,  you ignore the 3rd column in the above matrix, since it was added artificially and had nothing to do with the problem. Then the last column tells you that the linear system in question is consistent when  y1-2y2+y3 = 0.