7

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.

anni
  • 947
  • Your question is ambiguous. Non-diagonalisable over what? $\mathbb Z$? $\mathbb Q$? $\overline{\mathbb Q}$? $\mathbb R$? $\mathbb C$? – user1551 Oct 27 '18 at 12:45

4 Answers4

5

No, there is no problem with your program, we can easily prove that any $2\times 2$ matrix with coefficients in $[\![ 1, 9]\!]$ is diagonalizable.

Let $\displaystyle M = \begin{bmatrix} a & b\\ c & d \end{bmatrix}$ with $(a,b,c,d) \in [\![ 1, 9]\!]^4$.

We can calculate the characteristic polynomial of $\displaystyle M.$

\begin{equation*} \begin{split} \chi_{M} & = \det(XI_{2} - M) \\ & = \begin{vmatrix} X-a & -b \\ -c & X-d \end{vmatrix} \\ & = (X-a)\cdot(X-d)-cb \\ & = X^2 + (-a-d)\cdot X + ad - cb \end{split} \end{equation*}

Let $\displaystyle x$ be a complex number, let's solve $\displaystyle \chi_{M}(x) = 0 $ for $\displaystyle x$:

$\displaystyle x^2 + (-a-d)\cdot x + ad - cb = 0 $ gives us

\begin{equation*} \begin{split} \Delta & = a^2 + 2 \cdot ad + d^2 - 4 \cdot (ad - cb) \\ & = a^2 + d^2 - 2 \cdot ad + 4\cdot cb \end{split} \end{equation*} Since $\displaystyle a^2 + d^2 - 2 \cdot ad = (a-d)^2 \ge 0$ and $\displaystyle 4\cdot cb > 0$ because $\displaystyle (c,b) \in [\![ 1, 9]\!]^2$.

We can ensure that $\displaystyle \Delta > 0$ and therefore, $\displaystyle \chi_{M}$ has two distinct real roots:

$\displaystyle x_1 = \frac{a+d - \sqrt{ \Delta }}{2} \quad$ and $\displaystyle \quad x_2 = \frac{a+d + \sqrt{ \Delta }}{2}$

Therefore, $\text{Sp} \displaystyle (M) = \{x_1, x_2\} $ with $\displaystyle x_1 \ne x_2 $, which ensures that M is diagonalizable.

So yes, every $2\times 2$ matrices with coefficient between 1 and 9 is diagonalizable.

anni
  • 947
5

In fact every $2 \times 2$ matrix with positive real entries has distinct eigenvalues and so is diagonalizable.

Hint The eigenvalues of $$A = \pmatrix{a&b\\c&d}$$ are the roots of the characteristic polynomial $p_A(t) = t^2 - (\operatorname{tr} A) t + \det A$, and these roots coincide iff the discriminant $\Delta = (-\operatorname{tr} A)^2 - 4 \det A = 0$ vanishes.

In terms of the entries of $A$, $$\Delta = [-(a + d)]^2 - 4 (a d - b c) = (a - d)^2 + 4 b c,$$ but $(a - d)^2$ is nonnegative and $4 b c > 0$.

Travis Willse
  • 108,056
1

In fact every $2 \times 2$ matrix with positive real entries has distinct eigenvalues and so is diagonalizable.

Hint If $A$ is nondiagonalizable, its eigenvalues coincide and so must be real, so $A$ is similar over $\Bbb R$ to the Jordan block $J_2(\lambda) = \pmatrix{\lambda&1\\0&\lambda}$, that is, there is a real matrix $P$ such that $$A = P J_2(\lambda) P^{-1} ,$$ and by rescaling we may as well assume $\det P = \pm 1$.

Expanding the r.h.s. we find that the $(1, 2)$ entry of $A$ is $\pm p_{11}^2$ and the $(2, 1)$ entry is $\mp p_{21}^2$, but these entries cannot be positive simultaneously.

Travis Willse
  • 108,056
0

This is an overkill: by Perron-Frobenius theorem, the spectral radius of a positive matrix is a simple eigenvalue. It follows that every $2\times2$ positive matrix $A$ has two different eigenvalues. Hence $A$ is diagonalisable.

user1551
  • 149,263