I was hoping for some confirmation of a proof to the following preliminary exam question:
Fix an $n \times n$ matrix $A$ with entries in an algebraically closed field $k$. Let $C$ be the space of $n \times n$ matrices over $k$ that commute with $A$. Observe that $C$ is a vector space over $k$. Show that $\dim C \ge n$ and the equality holds if and only if the characteristic polynomial of $A$ equals the minimal polynomial of $A$.
Now there are a lot of questions and answers related to this on MSE but my approach is fairly different from anything I saw, hence the request for verification.
Observe that $n \times n$ matrices have a natural action on $V=k^n$, and we obtain a $k[x]$-module structure on $V$ by letting $x$ act by $A$.
Note that any matrix $B$ commuting with $A$ defines a linear transformation of $V$ which commutes with the action of $x$. In other words, $B \in \text{End}_{k[x]} V$.
Suppose momentarily that $V = k[x]/(a(x))$, where $a$ has degree $n$. Then $V$ is cyclic as a $k[x]$-module, so as a $k[x]$-homomorphism, $B$ can be described by where it maps the generator $1 \in k[x]/(a(x))$. Moreover this is described by the image of a polynomial in the quotient:
$$ B \cdot 1 = b_0 + b_1x + b_2 x^2 + \dots + b_{n-1} x^{n-1} \in k[x]/(a(x)).$$
For the sake of clarity, when we describe $B$ as a linear transformation (that is, to give it as a map of vector spaces, rather than as a map of $k[x]$-modules), we define it on the basis elements $1,x,x^2,\dots,x^{n-1}$ by
$$ B \cdot x^i = (B \cdot 1) x^i \mod a(x) ,$$
so if
$$ a(x) = a_0+a_1x+\dots +a_{n-1}x^{n-1}+x^n $$
then for example
$$ B \cdot x = b_0x+b_1x^2+ \dots + b_{n-1}x^n = -a_0b_{n-1}+(b_0-a_1b_{n-1})x+(b_1-a_2b_{n-1})x^2+\dots + (b_{n-2}-a_{n-1}b_{n-1})x^{n-1} .$$
Now, referring to the description of $B$ above, we observe that any choice of $(b_0,b_1,b_2,\dots,b_{n-1}) \in k^n$ yields a well-defined $k[x]$-module homomorphism; in other words, we see that in this special case, $\dim C = \dim \text{End}_{k[x]}=n$.
In general, because $k[x]$ is a PID, we obtain an isomorphism
$$ V \cong k[x]/(a_1(x)) \oplus \cdots \oplus k[x]/(a_m(x)) $$
by the structure theorem (with no free part because $V$ is finite dimensional), such that each $a_i$ is monic with degree at least $1$, and $a_1 | a_2 | \dots |a_m$.
Now on each summand, define $B_i$ by any choice of $\deg a_i(x)$ elements of $k^n$, as described in the special case above. Then $B=B_1\oplus B_2 \oplus \dots \oplus B_m$ commutes with $A$ (after conjugating back to the original basis), and because the product of invariant factors is the characteristic polynomial, the sum of these degrees is $n$, so we have produced an $n$-dimensional subspace $C'$ of $C$, proving the first part.
On the other hand, if the minimal polynomial is equal to the characteristic polynomial, the only invariant factor is the minimal polynomial, so $V$ is cyclic and we are in the special case above, where we proved $\dim C = n$.
Finally, suppose the minimal factor is not equal to the characteristic polynomial. Then there are at least two invariant factors $a_1|a_2$. But then there is a well-defined $k[x]$-module homomorphism
$$ B: k[x]/(a_2(x)) \to k[x]/(a_1(x)) $$
defined by extending $1 \mapsto 1$. Then extending $B$ by zero on the other summands of $V$, we obtain a $k[x]$-module homomorphism which cannot be decomposed into a direct sum of homomorphisms on the summands. Thus $B$ is not contained in the subspace $C'$ defined above, so $\dim C > \dim C'=n$.
This completes the proof.
Edit: Note, alarmingly, that I didn't use the fact that $k$ is algebraically closed! This in particular has me worried.