Linear Algebra and the C Language/a0oe


The matrix A and the inverse matrix of A have the same eigenvectors but arranged in reverse order

Copy/Paste into the octave window
% Properties of spectral decomposition:
%
% To calculate the spectral decomposition of a symetric matrix A, we  need:
%
% b: The columns of the eigenvectors of A
% r: The rows of eigenvectors of the inverse of A
%
% The eigenvectors of the inverse of A are identical to
% the eigenvectors of A but not in the correct order. (Try the example)
%
% To obtain the eigenvector rows of the inverse of A,
% I will take the transpose of the eigenvectors of A,
% since A and the inverse of A have the same eigenvectors,
% only when A is  symetric.


clear, clc

A = round(10*randn(3));    %% A matrix 3x3
A = A'*A;                  %% A symetric matrix

invA = inv(A);

% Eigenvectors, Eigenvalues of A
[AEvectors,AEvalues] = eigs(A);

% Eigenvectors, Eigenvalues of inverse of A
[invAEvectors,invAEvalues] = eigs(invA);

   AEvectors
invAEvectors

%%