Testing the diagonalizability of matrix $B=\left(\begin{smallmatrix}\lambda_1 &a&b\\0&\lambda_1 & c\\0&0& \lambda_2\end{smallmatrix}\right)$ How to show that the matrix
$$B= \left(\begin{array}(\lambda_1 & a & b \\ 0 & \lambda_1 & c\\ 0 & 0 & \lambda_2\end{array}\right)$$
is diagonalizable when $a\neq0$, when $\lambda_1\neq \lambda_2$. How should I work this out? I tried comparing the algebraic and geometric multiplicities of the eigenvalues of $B$ but I didn't succeed in this approach yet. 
 A: It suffices to note that $B - \lambda_1 I$ has nullity (null-space dimension) $1$ when $a \neq 0$ and $2$ when $a = 0$.  So, the geometric multiplicity of $\lambda_1$ is $1$ when $a \neq 0$ and $2$ when $a = 0$.
A: Clearly, when the dimension is $3$ and the repeated diagonal entries appear only in contiguous blocks, the problem is not really destabilizing. 
The case when the dimension is $n$ is studied in If a matrix is triangular, is there a quicker way to tell if it is can be diagonalized?
When the repeated diagonal entries appear only in contiguous blocks, the matrix $B$ is similar to the matrix of diagonal blocks; here $B$ is similar to $diag(\begin{pmatrix}\lambda_1&a\\0&\lambda_1\end{pmatrix},\lambda_2)$. Thus $B$ is diagonalizable iff each block is diagonal; consequently, the complexity of this algorithm is $0$ algebraic operation.
The case when the equal eigenvalues are not grouped is much more difficult. We have not been able to find an algorithm that does the job in $O(n^2)$ and even in $o(n^3)$. 
Who can do better?
