I'd like to know how many non-diagonalizable size 2 matrices there are with integer coefficient between 1 and 9.
I built a python program which counts the non-diagonalizable matrices with such coefficients:
from sympy import *
count = 0
for a in range(1,10):
for b in range(1,10):
for c in range(1,10):
for d in range(1,10):
M = Matrix([[a,b],[c,d]])
if not M.is_diagonalizable():
pprint(M)
count+=1
print("Number of non-diagonalizable matrices :", count)
The output was :
Number of non-diagonalizable matrices : 0
I wonder if there is a problem with my program or if it's true, that all the size 2 matrices with integer coefficient between 1 and 9 are diagonalizable.
Please help me.