%
% Example 3 from Sec 5.3
%
A = [1 3 3; -3 -5 -3; 3 3 1]
eig(A)
rref([(A - eye(3)) zeros(3,1)])
rref([(A + 2 * eye(3)) zeros(3,1)])
P = [1 -1 -1; -1 1 0; 1 0 1]
D = diag([1 -2 -2])
inv(P)
P * D * inv(P)
[P,D] = eig(A)
det(P)
P * D * inv(P)

%
% Example 4 from Sec 5.3
%
A = [2 4 3; -4 -6 -3; 3 3 1]
eig(A)
rref([(A - eye(3)) zeros(3,1)])
rref([(A + 2 * eye(3)) zeros(3,1)])
[P,D] = eig(A)
rank(P)
det(P)

%
% Example 6 from Sec 5.3
%
A = [5 0 0 0; 0 5 0 0; 1 4 -3 0; -1 -2 0 -3]
eig(A)
rref([(A + 3 * eye(4)) zeros(4,1)])
rref([(A - 5 * eye(4)) zeros(4,1)])
[P,D] = eig(A)
det(P)
P * D * inv(P)
