MATLAB question please help For each matrix find the number
MATLAB question please help!
For each matrix, find the number of pivots and the matrix inverse (if possible). You may use any method to determine the inverse and the number of pivots. Be sure to explain the reasoning behind your answers.
Solution
The rank of a matrix is the number of pivots in its reduced row-echelon form.
p1 is number of pivots of A and p2 is number of pivots of B.
>> A=[1 2; 4 5];
>> inv(A)
ans =
-1.6667 0.6667
1.3333 -0.3333
>> p1=rank(A)
p1 =
2
>> B=[-1 1 1; 1 2 2; 1 2 3];
>> inv(B)
ans =
-0.6667 0.3333 0
0.3333 1.3333 -1.0000
0 -1.0000 1.0000
>> p2=rank(B)
p2 =
3
