How to show a $3\times3$ matrix has three distinct eigenvalues? Here is a question I heared from others:
Given four distinct positive real numbers $a_1,a_2,a_3,a_4$ and set $$a:=\sqrt{\sum_{1\leq i\leq 4}a_i^2}$$
$A=(x_{i,j})_{1\leq i\leq3,1\leq j\leq4}$ is a $3\times4$-matrix specified by $$ x_{i,j}=a_i\delta_{i,j}+a_j\delta_{4,j}-\frac{1}{a^2}(a_i^2+a_4^2)a_j $$
where $\delta_{i,j}$ is the Kronecker symbol or visually
$$ A=\begin{pmatrix}a_1 &0&0&a_4\\ 0&a_2&0&a_4\\0&0&a_3&a_4\end{pmatrix}-\frac{1}{a^2}
\begin{pmatrix} 
a_1(a_1^2+a_4^2) & a_2(a_1^2+a_4^2) & a_3(a_1^2+a_4^2) & a_4(a_1^2+a_4^2)\\
a_1(a_2^2+a_4^2) & a_2(a_2^2+a_4^2) & a_3(a_2^2+a_4^2) & a_4(a_2^2+a_4^2)\\
a_1(a_3^2+a_4^2) & a_2(a_3^2+a_4^2) & a_3(a_3^2+a_4^2) & a_4(a_3^2+a_4^2)\\
\end{pmatrix} $$
The question is to show that the $3\times3$-matrix $B=AA^T$ admits three distinct eigenvalues.($A^T$ is the transpose of $A$)
What I am curious about is how many methods can be utilized to show a matrix has different eigenvalues?
As for this question my idea is to calculate the characteristic polynomial $f$ of $B$ along with $f'$ which is a quadratic polynomial via Sagemath and show that neither of roots of $f'$ belongs to $f$. Or equivalently to calculate the resultant $R(f,f')$ of $f$ and $f'$ and show that $R(f,f')$ doesn't vanish for any distinct positive $a_i$'s.
But the difficulties are both ways involve hideous calculation which I don't think I can write down by hand. So I'm wondering if there is a tricky way to get to that point? (e.g. an algebraic-geometry method?)

This question is from this year's Alibaba mathematics competition (qualifying round, which is finished 2 days ago), and here's my solution that could be wrong (I also participated in the competition and this is the solution I submitted). I tried to solve the problem geometrically to avoid tons of computations.

First, we can deal with $A^{T}A$ instead of $AA^{T}$ since the first matrix's eigenvalues is same as the second eigenvalue's matrix with zero (consider SVD of $A$). The key point is that $A$ can be written as $A = BP$ where
$$
B = \begin{pmatrix} a_1 & 0 & 0 & a_4 \\ 0 & a_2 & 0 & a_4 \\ 0 & 0 & a_3 & a_4 \end{pmatrix}
$$
and
$$
P = I_3 - \mathbf{v}\mathbf{v}^{T}, \mathbf{v} = \frac{1}{a}(a_1, a_2, a_3, a_4)^{T}. 
$$
Especially, the matrix $P$ is an orthogonal projection matrix that project a vector in $\mathbb{R}^{4}$ to the subspace of vectors that are perpendicular to $\mathbf{v}$. It satisfies $P^{T} = P^{2} = P$.
To show that the eigenvalues are distinct, we will show that each eigenspace (for nonzero eigenvalues) has dimension 1. In other words, for a given eigenvalue, there exists a unique eigenvector (up to constant factor) corresponding to the eigenvalue.
First, the above $\mathbf{v}$ is an eigenvector of $A^{T}A$ correspond to the eigenvalue 0 since $A\mathbf{v} = BP\mathbf{v} = \mathbf{0}$. Since the eigenvectors are orthogonal to each other, the other three eigenvectors are in the image of $P$ (the hyperplane perpendicular to $\mathbf{v}$). If we fix an (nonzero) eigenvalue $\lambda$ and a corresponding eigenvector $\mathbf{w}$, we have $P\mathbf{w} = \mathbf{w}$ and so
$$
A^{T}A\mathbf{w} = PB^{T}BP\mathbf{w} = PB^{T}B\mathbf{w} = \lambda \mathbf{w}.
$$
From this, the vector $B^{T}B\mathbf{w}$ should be written as
$$
B^{T}B\mathbf{w} = \lambda \mathbf{w} + \beta \mathbf{v}
$$
for some $\beta$. If we set $\mathbf{w} = (x_1, x_2, x_3, x_4)^{T}$, then expanding the above equation gives
$$
\begin{pmatrix}a_1^2 & 0 & 0 & a_{1}a_{4} \\ 0 & a_{2}^{2} &  0 & a_{2}a_{4} \\ 0 & 0& a_{3}^{2} & a_{3}a_{4} \\ a_{1}a_{4} & a_{2}a_{4} & a_{3}a_{4} & 3a_{4}^{2} \end{pmatrix}\mathbf{w} = \begin{pmatrix} a_{1}^{2}x_{1} + a_{1}a_{4}x_{4} \\ a_{2}^{2}x_{2} + a_{2}a_{4}x_{4} \\ a_{3}^{2}x_{3} + a_{3}a_{4}x_{4} \\ a_{4}(a_{1}x_{1} + a_{2}x_{2} + a_{3}x_{3} + 3a_{4}x_{4})\end{pmatrix} = \begin{pmatrix} a_{1}^{2}x_{1} + a_{1}a_{4}x_{4} \\ a_{2}^{2}x_{2} + a_{2}a_{4}x_{4} \\ a_{3}^{2}x_{3} + a_{3}a_{4}x_{4} \\ 2a_{4}^{2}x_{4}\end{pmatrix}  = \begin{pmatrix} \lambda x_1 + \beta' a_1 \\ \lambda x_2 + \beta' a_2 \\ \lambda x_3 + \beta' a_3 \\ \lambda x_4 + \beta' a_4\end{pmatrix}, \quad \beta' = \frac{\beta}{a}
$$
Here we used $\langle \mathbf{v}, \mathbf{w} \rangle = a_{1}x_{1} + \cdots + a_{4}x_{4} = 0$ for the second equality. From this, we can show that $x_{4}$ should be nonzero (here's the point that distinctiveness of $a_i$'s are used), so we can assume that $x_4 = 1$ and the other components $x_1, x_2, x_3$ are uniquely determined. This proves our claim that each eigenspace has dimension 1, i.e. the eigenvalues are distinct.
