Diagonalizable Matrix

Author

Eric W. Weisstein
January 16, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/LinearAlgebra/DiagonalizableMatrix.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/DiagonalizableMatrix.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Timings

m=Matrices[3];

Complex S

Eigensystem[s[[1]]]

Length[s=Select[m,#===0&/@Or@@Eigenvalues[#]&]]//Timing

Length[s=Select[m,Det[Eigenvectors[#]]=!=0&]]//Timing

Length[Select[m,MatrixRank[Eigenvectors[#]]==Length[#]&]]//Timing

Length[Select[m,FreeQ[Eigenvectors[#],Table[0,{Length[#]}]]&]]//Timing

Length[Select[m,Map[#===0&,Nor@@And@@@Eigenvectors[#],{2}]&]]//Timing

Length[Select[m,Map[#===0&,Nor@@And@@@Eigenvectors[#],{2}]&]]//Timing

Real S

RealDiagonalizableQ[m_List?MatrixQ]:=Module[{e=Eigenvectors[m]},
(FreeQ[e,Table[0,{Length[m]}]]&&Im[#]==0&/@And@@Flatten[e])||Dimensions[m]=={1,1}
]
RealDiagonalizableQ2[m_List?MatrixQ]:=Module[{e=Eigenvectors[m]},
(FreeQ[e,Table[0,{Length[m]}]]&&Im[#]==0&/@And@@Flatten[e])||Dimensions[m]=={1,1}
]
RealDiagonalizableQ3[m_List?MatrixQ]:=Module[{e=Eigenvectors[m]},
((Im[#]===0&/@And@@Flatten[e])&&FreeQ[e,Table[0,{Length[m]}]])||Dimensions[m]=={1,1}
]
RealDiagonalizableQ4[m_List?MatrixQ]:=Module[{e=Eigenvectors[m]},
((Im[#]===0&/@And@@Flatten[e])&&Det[e]=!=0)||Dimensions[m]=={1,1}
]

Count[m,_?RealDiagonalizableQ]//Timing

Count[m,_?RealDiagonalizableQ2]//Timing

Count[m,_?RealDiagonalizableQ3]//Timing

Count[m,_?RealDiagonalizableQ4]//Timing

Digonalization over Real S

(-1,0,1)-Matrices

Table[Count[Matrices[n,{-1,0,1}],_?(DiagonalizableQ[#,Field->Reals]&)],{n,3}]//Timing

(-1,1)-Matrices

Table[Count[Matrices[n,{-1,1}],_?(DiagonalizableQ[#,Field->Reals]&)],{n,3}]//Timing

Table[Count[Matrices[n,{-1,1}],_?(DiagonalizableQ[#,Field->Reals]&)],{n,4}]//Timing

(0,1)-Matrices

Table[Count[Matrices[n],_?(DiagonalizableQ[#,Field->Reals]&)],{n,3}]//Timing

Table[Count[Matrices[n],_?(DiagonalizableQ[#,Field->Reals]&)],{n,4}]//Timing

Digonalization over Complex S

(-1,0,1)-Matrices

Table[Count[Matrices[n,{-1,0,1}],_?DiagonalizableQ],{n,3}]//Timing

(-1,1)-Matrices

Table[Count[Matrices[n,{-1,1}],_?DiagonalizableQ],{n,4}]//Timing

(0,1)-Matrices

Table[Count[Matrices[n],_?DiagonalizableQ],{n,4}]//Timing

Diagonalizable but not normal

{d,p}=Eigensystem[a={{0,0},{1,1}}]

Transpose[p].DiagonalMatrix[d].Inverse[Transpose[p]]

a.Transpose[a]-Transpose[a].a

Eigensystem[{{0, 0, 0}, {0, 1, 0}, {1, 1, 1}}]