Linear mappings: Linear mappings in MATLAB
Similarity
Two matrices are similar if and only if they have the same reduced row echelon form
This means that you can verify in MATLAB similarity of matrices by checking with the command rref
that they have the same reduced row echelon form.
>> A = [4 -2; 2 1]
A =
4 -2
2 1
>> B = [3 -2; 1 2]
B =
3 -2
1 2
>> rref(A) == rref(B)
ans =
2×2 logical array
1 1
1 1
>> isequal(rref(A), rref(B))
ans =
logical
1
>> T = [1 -1; 1 0] % appropriate transformation matrix
T =
1 -1
1 0
>> T^(-1) * A * T $ equal to matrix B
ans =
3 -2
1 2
>> B - T^(-1) * A * T
ans =
0 0
0 0
>> S = [1 1; 0 2] % transformation matrices are not unique
S =
1 1
0 2
>> B - S^(-1) * A * S
ans =
0 0
0 0
>> P = S * T^(-1) % non-trivial transformation matrix that leaves A intact
P =
-1 2
-2 2
>> A - P^(-1) * A * P
ans =
0 0
0 0
Unlock full access