Given the system of equations 2x1 x2 x3 4 4x1 3x2 x3 6
Solution
In MATLAB, to solve Ax=b we begin by augmenting [A b]:
>> A=[2 -1 3; 4 3 -1;3 2 2]
A =
2 -1 3
4 3 -1
3 2 2
In MATLAB, we can find the inverse of a matrix using rref and then check that using the inv function: >> rref([A eye(size(A))])
rref([A eye(size(A))])
ans =
1.0000e+000 0 0 3.3333e-001 3.3333e-001 -3.3333e-001
0 1.0000e+000 0 -4.5833e-001 -2.0833e-001 5.8333e-001
0 0 1.0000e+000 -4.1667e-002 -2.9167e-001 4.1667e-001
>> inv(A)
ans =
3.3333e-001 3.3333e-001 -3.3333e-001
-4.5833e-001 -2.0833e-001 5.8333e-001
-4.1667e-002 -2.9167e-001 4.1667e-001
>> inv(A)*b
ans =
-1.6667e+000
5.6667e+000
4.3333e+000
these valuse substute in equations
>> 2*(-1.6667e+000)-1*5.6667e+000+3*4.3333e+000
ans =
3.9998e+000
>> 4*(-1.6667e+000)+3*5.6667e+000-1*4.3333e+000
ans =
6.0000e+000
3*(-1.6667e+000)+2*5.6667e+000+2*4.3333e+000
ans =
15.000e+000
We get exact values

