My row echelon form and general solution not adding up?

51 Views Asked by At

I am a bit lost here, I created this overdetermined system from a traffic flow example and I am trying to figure out if it has a solution, and if so then if it's unique or not (which it won't be since its underdetermined). Here is my setup in matlab:

%A = x1 + 200 = 200 + x2  <=>     x1 - x2 = 0
%B = x2 + x3 = x11 + 150  <=>     x2 +x3 -x11 = 150
%C = 350+ x4 = 370+ x3    <=>     -x3 + x4 = 20
%F = 410 + x12 = x4 + x5  <=>     x4 +x5 -x12 = 410
%i = x5 + 330 = 510 +x6   <=>     x5 -x6 = 180
%H = x6 + x7 = x9 + 210   <=>     x6 + x7 -x9 = 210
%g = x8+300 = x7 + 380    <=>     -x7  + x8 = 80
%d = 230+ x10 = x1+x8     <=>     x1 +x8 -x10 = 230   
%e = x9+x11 = x12+x10     <=>     x9 - x10 +x11 -x12 = 0  

%A) Below is the Matrix A and vector b for the underdetermined linear
%system above == not a unique solution to be found
A = [ 1 -1 0 0 0 0 0 0 0 0 0 0;
      0 1 1 0 0 0 0 0 0 0 -1 0;
      0 0 -1 1 0 0 0 0 0 0 0 0;
      0 0 0 1 1 0 0 0 0 0 0 -1;
      0 0 0 0 1 -1 0 0 0 0 0 0;
      0 0 0 0 0 1 1 0 -1 0 0 0;
      0 0 0 0 0 0 -1 1 0 0 0 0;
      1 0 0 0 0 0 0 1 0 -1 0 0;
      0 0 0 0 0 0 0 0 1 -1 1 -1];
 
b = [0; 150; 20; -410; 180; 210; 80; 230; 0];

The problem I am having understanding is when I use the reduced row echelon form of the augmented matrix I get:

AB = [A b]
rref(AB)

     1     0     0     0     0     0     0     1     0    -1     0     0     0
     0     1     0     0     0     0     0     1     0    -1     0     0     0
     0     0     1     0     0     0     0    -1     0     1    -1     0     0
     0     0     0     1     0     0     0    -1     0     1    -1     0     0
     0     0     0     0     1     0     0     1     0    -1     1    -1     0
     0     0     0     0     0     1     0     1     0    -1     1    -1     0
     0     0     0     0     0     0     1    -1     0     0     0     0     0
     0     0     0     0     0     0     0     0     1    -1     1    -1     0
     0     0     0     0     0     0     0     0     0     0     0     0     1

From this, I read that the last line gives me x12 * 0 = 1, but that is impossible = so no solutions to the system.

But when I use linsolve(A,b) (A the coefficent matrix and b the output vector) I get a general solution to the system:

x = linsolve(A,b)

x =

  213.3333
  304.4444
 -336.6667
 -407.7778
   88.8889
         0
  118.8889
  107.7778
         0
         0
  -91.1111
         0
```