Let $K$ be a finite field with $q \ge 3$ elements. Denote by $M$ the set of all polynomials of degree $q-2$ in $K[X]$ with all coefficients distinct and nonzero. Find the number of polynomials in $M$ with $q-2$ distinct roots. The proof I have seen goes like this:
We obviously only need to calculate the polynomials that satisfy the property with $f(0)=1$ and then multiply the number at the end with $q-1$. For polynomials of the form $f(X)=a_{q-2}X^{q-2}+a_{q-1}X^{q-1}+...+a_1X+1$ consider the matrices:
$A=$ $\begin{pmatrix} 1 & a_1 & a_2 & \dots & a_{q-3} & a_{q-2}\\ a_{q-2} & 1 & a_1 & \dots & a_{q-4} & a_{q-3}\\ a_{q-3} & a_{q-2}& 1 & \dots & a_{q-5} & a_{q-4}\\ \vdots & \vdots & \vdots & & \vdots & \vdots\\ a_2 & a_3 & a_4 & \dots & 1 & a_1\\ a_1 & a_2 & a_3 & \dots & a_{q-2} & 1 \end{pmatrix}$
and
$B=$ $\begin{pmatrix} 1 & 1 & 1 & \dots & 1 & 1\\ y & x_1 & x_2 & \dots & x_{q-3} & x_{q-2}\\ y^2 & {x_1}^2 & {x_2}^2 & \dots & {x_{q-3}}^2 & {x_{q-2}}^2\\ \vdots & \vdots & \vdots & & \vdots & \vdots\\ y^{q-3} & {x_1}^{q-3} & {x_2}^{q-3} & \dots & {x_{q-3}}^{q-3} & {x_{q-2}}^{q-3}\\ y^{q-2} & {x_1}^{q-2} & {x_2}^{q-2} & \dots & {x_{q-3}}^{q-2} & {x_{q-2}}^{q-2} \end{pmatrix}$
where $x_i$ are the distinct nonzero roots of $f$ and $y$ is the other element of $K^*$
We find out that
$AB= \begin{pmatrix} f(y) & 0 & 0 & \dots & 0 & 0\\ yf(y) & 0 & 0 & \dots & 0 & 0\\ {y}^{2}f(y) & 0 & 0 & \dots & 0 & 0\\ \vdots & \vdots & \vdots& & \vdots & \vdots\\ {y}^{q-3}f(y) & 0 & 0 & \dots & 0 & 0\\ {y}^{q-2}f(y) & 0 & 0 & \dots & 0 & 0 \end{pmatrix}$. This matrix has rank $1$ and $B$ is invertible as its determinant is a Vandermonde determinant, so nonzero. This implies that $rank(A)=1$. So all minors of order $2$ are zero.
So $\begin{vmatrix} a_1 & a_2\\ 1 & a_1 \end{vmatrix}$ $=$ $\begin{vmatrix} a_1 & a_3\\ 1 & a_2 \end{vmatrix}$ $=$ $\dots$ $=$ $\begin{vmatrix} a_1 & a_{q-2}\\ 1 & a_{q-3} \end{vmatrix}$ $=0$ and thus we find out that $a_i={a_1}^i$ for all
$i \in$ {$2, 3, \dots, q-2$}. Therefore $a_1$ is a generator of $K^*$ and it follows that all polynomials are of the form $f(X)=1+aX+a^2X^2+ \dots + a^{q-2}X^{q-2}$ where $a$ is a generator of $K^*$. Conversely, we find out that all polynomials of this form satisfy the condition. So these are the only ones. Since $K^*$ has $\phi(q-1)$ generators, the number of polynomials that satisfy the condition is $(q-1) \phi(q-1)$.
I understand the solution, but I want to know where the idea to consider the matrices $A$ and $B$ comes from. Is it a method commonly used? Are there other instances where linear algebra is used in abstract algebra (especially in polynomial problems)?