I have a $2\times 2$ matrix over a finite field. I am wondering when the matrix is similar to an upper triangular matrix.
My thoughts so far: If the matrix does not have any eigenvalues, then it can't be similar with an upper triangular matrix. If it has two distinct eigenvalues, then it must be diagonalizable because it has two linearly independent eigenvectors. I can't figure out what happens when it has a repeated eigenvalue.
If the matrix $A$ has a single (repeated) eigenvalue $\lambda$, then $$ B = A - \lambda I $$ is nilpotent. If $B$ is not the zero matrix (i.e. if $A$ is not diagonal and already upper triangular), then I claim it is similar to $\left[\begin{smallmatrix}0&1\\0&0\end{smallmatrix}\right]$. Indeed, B has non-trivial kernel, so we let the first column of $P$ be a non-zero vector $v$ in that kernel. We let the second column of $P$ be a vector $w$ such that $Bw = v$. Such a $w$ exists because the kernel of $B$ is equal to the image of $B$ (as $B$ is nilpotent but not $0$).
Then we have $P^{-1}BP = \left[\begin{smallmatrix}0&1\\0&0\end{smallmatrix}\right]$, so $P^{-1}AP= \left[\begin{smallmatrix}\lambda&1\\ 0&\lambda\end{smallmatrix}\right]$ and we are done.