# Solve the linear system:

Solving AX = b:

If A is a rectangular matrix and you want to find the general solution of AX=B, first enter the augmented matrix of the system by typing C=[A b], then type rref(C). (Shortcut: rref ([A b]) )

Example :

Solve the linear system:

Enter the augmented matrix

then type rref(M).

You will see

The corresponding system of equations is:

Now, using the parameter to represent the variable , we have the general solution:

,

Now you can use MATLAB's command X=A b to solve this system:

type

X = [ 2 4 -2; 3 5 0 ] [0; 1]

Try to solve the following inconsistent system of equations:

You can enter the augmented matrix of this linear system as

AG= [ 2 4 -2 0; 3 5 0 1; 4 8 -4 3]

The RREF of the augmented matrix should come out ( using rref(AG) )to be

with the corresponding system of equations,

which is inconsistent( Explain Why, by typing % and then your comment.)

Special Case:

Now type the coefficient matrix:

and the constant matrix as

or as

then use MATLAB's command

X= AC b

Example: Enter

and

B=[3 6 7 ]'.

Type X = A B

What do you see? Check the answer.

Replace with a non-invertible 3 by 3 matrix and try to solve by using . Explain the warning.