A $3\times3$ triangular matrix has a repeated eigenvalue if it is the square of a non-triangular matrix After pondering for an interesting answer to a recently asked question, I discovered the following phenomenon. Suppose $A$ is a $3\times3$ matrix whose elements are taken from some field. If $A$ is not upper triangular but $B:=A^2$ is upper triangular, then $B$ has a repeated eigenvalue.
Here is a proof outline. Let $A=\pmatrix{a&b&c\\ p&q&r\\ x&y&z}$. Since $A$ is not upper triangular, $(p,x,y)\ne(0,0,0)$. The condition that $A^2$ is upper triangular is equivalent to the set of conditions
\begin{align}
ap+pq+rx&=0,\tag{1}\\
ax+py+xz&=0,\tag{2}\\
bx+qy+yz&=0.\tag{3}
\end{align}
Suppose both $p$ and $x$ are nonzero. Then $(1)$ and $(3)$ give
\begin{equation}
\frac{(ap+pq+rx)(a+z)}{p} + \frac{(bx+qy+yz)p}{x} = 0.\tag{4}
\end{equation}
Substitute $(2)$ into $(4)$, we obtain $a^2+bp=yr+z^2$. Hence $B_{11}=B_{33}$ in this case. The other cases where $(p,x,y)$ is $(=0,=0,\ne0),(=0,\ne0,\ne0),\ldots$ etc. can be handled by similar or simpler algebraic manipulations of $(1)-(3)$, and other equalities between the diagonal elements of $B$ (i.e. $B_{11}=B_{22}$ or $B_{22}=B_{33}$) may occur in these cases.
However, this proof feels ugly because it uses coordinates too heavily and it has to consider different corner cases separately. Admittedly, proofs of the statement in question probably cannot be entirely coordinate-free, because the assumption that "$A$ is not triangular" is already basis dependent, but I still want to see a more conceptual proof that isn't just a series of algebraic manipulations. Any idea?
P.S. Since the analogous statement also holds when $A$ is $2\times2$, I also wonder if it is true for all sizes of $A$.
 A: Abstractly, if $A$ is upper triangular, there is a nested sequence of subspaces of $\mathbb R^n$
$$
   0 = V_0 \subset V_1 \subset V_2 \subset \dots \subset V_{n-1} \subset V_n = \mathbb R^n
$$
where $\dim V_k = k$, such that $A^2$ maps each subspace into itself: $\mathbf x \in V_k \implies A^2 \mathbf x \in V_k$. Specifically, that sequence of subspaces is $V_k = \operatorname{span}\{\mathbf e^{(1)}, \dots, \mathbf e^{(k)}\}$.
If $A$ is not upper triangular, then $A$ does not have that property. However, $A$ has no choice but to map $V_n$ into itself. So we can choose some $k$ such that $A$ does not map $V_{k-1}$ into itself, but does map $V_k$ into itself. When we're looking at vectors in $V_{k}$, only the action of $A$ and $A^2$ on $V_{k}$ matters, so we might as well think of $V_{k}$ as $\mathbb R^k$. (Coordinate-wise, this means we look at the $k \times k$ corner of the matrix.)
Since $V_{k-1}$ has codimension $1$ in $V_k$, let $\mathbf a$ be a vector such that $V_{k-1} = \{\mathbf x \in \mathbb R^k : \mathbf a^{\mathsf T}\mathbf x = 0\}$. Then because $A^2$ maps $V_{k-1}$ into itself, $$\mathbf a^{\mathsf T}\mathbf x = 0 \implies \mathbf a^{\mathsf T}A^2\mathbf x = 0$$ which means that $\mathbf a^{\mathsf T}A^2$ is a multiple of $\mathbf a^{\mathsf T}$. (If both of these are codimension one subspaces, they must be the same subspace; if not, then $\mathbf a^{\mathsf T}A^2 = \mathbf 0^{\mathsf T}$, which is a multiple of everything.) By the same token, $\mathbf a^{\mathsf T}A$ cannot be a multiple of $\mathbf a^{\mathsf T}$, or else $A$ would map $V_{k-1}$ into itself.
This tells us that $\mathbf a^{\mathsf T}$ is a left eigenvector of $A^2$. As a result, $\mathbf a^{\mathsf T}A$ is also a left eigenvector of $A^2$ with the same eigenvalue, because if $\mathbf a^{\mathsf T}A^2 = \lambda \mathbf a^{\mathsf T}$, then $(\mathbf a^{\mathsf T}A)A^2 = (\mathbf a^{\mathsf T}A^2)A = \lambda \mathbf a^{\mathsf T}A$. Moreover, we assumed that $\mathbf a^{\mathsf T}$ and $\mathbf a^{\mathsf T}A$ are linearly independent.
So $A^2$ has two linearly independent left eigenvectors with the same eigenvalue, therefore in particular it has a repeated eigenvalue.
