TITLE: If a matrix is triangular, is there a quicker way to tell if it is can be diagonalized?
QUESTION [10 upvotes]: I hope it is alright to ask something like this here, I am having trouble keeping up with all the special cases and my book is being kind of vague.
I know how to do the standard method of finding diagonal matrices, but I know that triangular matrices are special and my book makes a connection, but it is hard to tell what it is.
Thanks.

REPLY [3 votes]: There is an easy necessary and sufficient condition. Let $c_1,\ldots,c_k$ be the distinct diagonal entries of the triangular matrix $A$ (so if there are repeated values, list each one just once). Then $A$ is diagonalisable if and only if $(X-c_1)\ldots(X-c_k)$ is an annihilating polynomial for$~A$ (in which case it will in fact be the minimal polynomial), in other words if the matrix product $(A-c_1I)\ldots(A-c_kI)$ is the zero matrix.
Proof. If $A$ is diagonalisable, then its minimal polynomial is $(X-\lambda_1)\ldots(X-\lambda_k)$ where $\lambda_i$ runs through the distinct eigenvalues of $A$, and for a triangular matrix the set of eigenvalues equals the set of diagonal entries (by an easy calculation of the characteristic polynomial). Conversely, since $(X-c_1)\ldots(X-c_k)$ has simple roots by construction, if it is an annihilating polynomial for$~A$, then $A$ is diagonalisable.
For instance, for the matrix
$$ A = \pmatrix {1 & a & b \\ 0 & 2 & c \\ 0 & 0 & 1 } $$
mentioned in other answers, compute
$$
  (A-I)(A-2I) =
  \pmatrix {0 & a & b \\ 0 & 1 & c \\ 0 & 0 & 0 }
  \pmatrix {-1 & a & b \\ 0 & 0 & c \\ 0 & 0 & -1 }
= \pmatrix {0 & 0 & ac-b \\ 0 & 0 & 0 \\ 0 & 0 & 0 },
$$
and conclude that $A$ is diagonalisable iff $ac-b=0$.

In the special case that equal entries are always consecutive on the diagonal, then the given condition easily reduces to the condition that for each such sequence of equal diagonal entries, they form the diagonal of a scalar (i.e., multiple of the identity) diagonal submatrix, in other words that the above-diagonal entries in the block "spanned" by those equal diagonal entries are all zero. This is necessary because if the diagonal entry in question is $c_i$, then the corresponding diagonal submatrix of the product $(A-c_1I)\ldots(A-c_kI)$ will only be zero if the submatrix from the factor $A-c_iI$ is already zero: the other factors have an invertible (triangular) submatrix at that location. It is sufficient by a computation of the product $(A-c_1I)\ldots(A-c_kI)$, where the $c_i$ are ordered by their occurrenc on the diagonal of $A$, as block matrices (subdivided in the obvious way according to groups of equal diagonal entries): by induction on$~i$, the product of the first $i$ factors has its first $i$ "block columns" entirely zero, so ($i=k$) the whole product is zero.
The case where all diagonal entries are distinct is a special case of this special case, and since the diagonal blocks now are $1\times1$ in size (without above-diagonal entries), the matrix will always be diagonalisable.