%Solution for exercise 8: eigenA.m
%Christoph Erath
clear all;

A = [4 3 0;
     3 6 2;
     0 2 4];
 
% eigenvalues and eigenvectors of A
[Q,D] = eig(A)

% det(A-lambda*I) for all eigenvalues lambda
for lambda=diag(D)'
    [lambda det(A-lambda*eye(size(A)))]
end

% check equality of AQ and QD
norm(A*Q-Q*D)