You need to understand that the matrix
is singular. Therefore it has no inverse.
You may as well have said, sometimes when I compute x/x, for scalar x, I get the expected answer: 1. But every once in a while, that does not happen. Why is that?
>> x = 2;x/x
>> x = pi;x/x
>> x = 0;x/x
WAIT. What happened? Do you see that what you did was no different?
You cannot compute the value of 0/0, because 0 has no multiplicative inverse. Therefore while MATLAB does compute something, that something is an indeterminate result.
In the case of a matrix, while MATLAB computes something, the result is effectively meaningless garbage. (Garbage in, garbage out.) Did you see the warning? As your other answer says, you might want to go back and do some reading. If you will do computations but not undertand what you are doing, what do you expect? Suppose you pick up a sharp knife, without understanding what a knife is or what it does. Should we be surprised if you cut yourself? Of course not. We might post a warning: DO NOT PLAY WITH KNIVES. But then, you did get a warning!
You could have tested to see if a was singular. Thus, compute the rank, which is 2. Or the condition number, which is seriously large. In either case, they would tell you the matrix is singular. (DO NOT TEST THAT USING DET. Even if you may have learned to use a determinant in some long almost forgotten class to learn if a matrix is singular, this is the wrong thing to do.)