Your expected result doesn't look right. For both row-echelon and reduced row-echelon form, the result must be triangular. If you just want (non-reduced) row-echelon form, you could use LU, e.g.,
i have been trying to figure out why it gives me a eye(4) but cant figure it out,
When all leading coefficients are non-zero, there is nothing else it can be. One of the rules of the reduced row-echelon form is that all other elements in a column with a non-zero diagonal coefficient must be zero. See also,
I'm going to guess that rref does not (and possibly cannot) account for all possible values of the symbolic variables. Somewhere along the way it's generating an expression that cancels out the c, even though such cancellation isn't correct for all possible values of c. For example
syms a b c
M = [a b;0 b]
M =
If I was doing this problem by hand, I might proceed as follows with row operations
R = M;
R(2,:) = R(2,:)/b % 1
R =
R(1,:) = R(1,:)/a % 2
R =
R(1,:) = R(1,:) - R(2,:)*b/a % 3
R =
That happens to be the same result as returned from rref, though I suspect rref got there a different way
rref(M)
ans =
Of course step 1 is invalid if b = 0, but the SMT is happy to do it. We see the same effect with the example from the rref
A = [a b c; b c a; a + b, b + c, c + a]
A =
rref(A)
ans =
That result can't be correct for any combination of (a,b,c) s.t. a*c - b^2 = 0
rref(subs(A,[a,b,c],[1,1,1])) % Case A
ans =
rref(subs(A,[a,b,c],[2,4,8])) % Case B
ans =
Interestingly, assumptions do influence rref
assume(a*c == b^2)
rref(A)
ans =
simplify(ans)
ans =
But I don't see how that result can recover Case A