Making a matrix diagonal with its eigenvectors

164 Views Asked by At

I'm trying to make my matrix diagonal. this is my matrix (for matlab and octave)

ab = [2305.90543896547,-1.84172677109018E-11,0,7.27595761418343E-12,-3458.85815844816,1503.85397120216;-3.2287061912939E-11,2305.90543896546,0,3458.85815844817,-3.18323145620525E-12,-1503.85397120214;-1152.8022645461,-1152.8022645461,1189103.95844129,-1845.58277496696,1845.58277496509,4.54747350886464E-13;1.57556722431824E-13,384.267421515366,-7.03336746482597E-11,1189719.15269961,-2.76805747637657E-10,1152.8022645461;-384.267421515366,5.25189074772746E-14,2.3283064365387E-10,6.98491930961609E-10,1189719.15269961,1152.8022645461;1.13118403533008E-11,-7.61701812734827E-12,0,2.27373675443232E-13,3.41060513164848E-13,2807.19009603281;]

but the problem is when i pre multiply it by transpose of eigenvectors and postmultyply it by its eigenvectors, result is not a diagonal matrix! this is the whole code you can put in matlab or octave online

ab=[2305.90543896547,-1.84172677109018E-11,0,7.27595761418343E-12,-3458.85815844816,1503.85397120216;-3.2287061912939E-11,2305.90543896546,0,3458.85815844817,-3.18323145620525E-12,-1503.85397120214;-1152.8022645461,-1152.8022645461,1189103.95844129,-1845.58277496696,1845.58277496509,4.54747350886464E-13;1.57556722431824E-13,384.267421515366,-7.03336746482597E-11,1189719.15269961,-2.76805747637657E-10,1152.8022645461;-384.267421515366,5.25189074772746E-14,2.3283064365387E-10,6.98491930961609E-10,1189719.15269961,1152.8022645461;1.13118403533008E-11,-7.61701812734827E-12,0,2.27373675443232E-13,3.41060513164848E-13,2807.19009603281;];
[eigvector,eigvalues]=eig(ab);
dab = transpose(eigvector)*ab*eigvector;

in above code the dab matrix should be diagonal, but it is not!

enter image description here

and these are eigenvalues: 1.1897e+06, 2.8072e+03, 2.3048e+03, 2.3048e+03, 1.1897e+06, 1.1891e+06

I'm thinking problem is with digital calculations in computer, because some eigenvalues are close or equal to each other and others are far more or less...

1

There are 1 best solutions below

3
On BEST ANSWER

The matrix $ab$ you are carrying out an eigendecomposition on is not symmetric, so the only way you will recover the diagonal matrix is if you did the following

  dab = inv(eigvector)*ab*eigvector; 

so long as the matrix is diagonalisable, provided all its eigenvalues are distinct.

For the matrix ($ab$) in question, the number of distinct eigenvalues is $5$, with there being two repeated eigenvalues (highlighted in red below):- $$ 1189720.27,2807.19,\color{red}{2304.79,2304.79},1189720.27,1189103.96$$ so it may or may not be possible to diagonalise $ab$ - this is quite an involved process, and looking here could help.

Note: If $ab$ was symmetric, then its eigenvectors would be orthogonal so your original operation would have resulted in a diagonal matrix (the off-diagonal terms would be non-zero, but orders of magnitude smaller than the diagonal elements)