# Is this matrix diagonalizable? Wolfram Alpha seems to contradict itself…

I have the matrix $\begin{bmatrix}0.45 & 0.40 \\ 0.55 & 0.60 \end{bmatrix}$.

I believe $\begin{bmatrix}\frac{10}{17} \\ \frac{55}{68}\end{bmatrix}$ is an eigenvector for this matrix corresponding to the eigenvalue $1$, and that $\begin{bmatrix}-\sqrt{2} \\ \sqrt{2}\end{bmatrix}$ is an eigenvector for this matrix corresponding to the eigenvalue $0.05$.

However, Wolfram Alpha tells me this matrix is, in fact, not diagonalizable (a.k.a. "defective"): I'm really confused... which one is in fact defective -- Wolfram Alpha, or the matrix?
Or is it my understanding of diagonalizability that's, uh, defective?

• I think you are correct. – Daryl Oct 30 '12 at 2:53
• Yes. I get the characteristic polynomial as $\lambda^2-1.05\lambda+0.05$, which has two distinct roots. Thus, for a $2\times2$ matrix, it is diagonalisable. – Daryl Oct 30 '12 at 2:56
• @wj32: I'm curious what the bug is... I can't imagine what kind of an AI bug can cause something like this haha. – Mehrdad Oct 30 '12 at 3:51
• @Mehrdad: Numerical linear algebra can always be a bit weird compared to exact algebra. Whenever you use decimal points, Wolfram|Alpha/Mathematica automatically goes into "approximate" mode. – wj32 Oct 30 '12 at 3:56
• They have decided to simply remove the part that says it's not diagonalizable, which fixes the problem for that input, but still leaves it contradictory when you ask it if the matrix is diagonalizable. I'll report this separately. – Mark S. Jul 22 '17 at 12:45

I agree with all the comments. Namely,

1. The matrix is clearly diagonalizable,
2. The rationalized version works correctly, and
3. Numerical linear algebra can be tricky and surprising.

In spite of points 2 and 3, I'd still call this a bug. Alpha is intended to guess the users intent. While clearly very hard, I don't think that interpreting numbers like $0.55$ as $55/100$ is too far out there. Even failing that, a small perturbation of the elements of the matrix don't change the fact that the matrix is diagonalizable.

Fortunately, there is an easy work around. Just enter:

diagonalize rationalize {{0.45,0.4},{0.55,0.6}} • Cool trick with rationalize, thanks! – Mehrdad Oct 30 '12 at 6:53

This is a combination of numerical linear algebra being hard, bad error handling, and confusing output

1: Numerical linear algebra is hard

This problem is ill-conditioned as far as Mathematica is concerned. As has been mentioned in the comments, Mathematica (and it's wolfram-alpha cousin) automatically enters numerical approximation mode when you give it decimals. It assumes you have provided it with the data to the highest precision you can assert, and cannot tolerate imprecisions that exceed this implicitly provided precision threshold.

In your case, one of the entries has only a single digit of precision. Since the condition number is 23, you are expecting to lose $\log_{10}(23)>1$ decimal digits in precision, which exceeds the available precision.

This is hardly unique to your data. Trying to have Wolfram-Alpha diagonalize $$\begin{pmatrix}1.0&0.0\\0.0&1.0\end{pmatrix},$$ using the decimal points in particular, results in the same issue.

The algorithm therefore detects the system is ill-conditioned, and starts having problems.

• Not the most elegant solution but one could possibly enter $0.4$ as 2^^0.011001100110011001101. Apparently diagonalize {{ 45/100,2^^0.011001100110011001101 },{55/100,6/10}} does not complain about the non-diagonalizability of the input. – Luca Citi May 17 '17 at 16:12