Identify the set of all complex $n$ by $n$ matrices with $\mathbb{C}^{n^2}$. We say a subset $S \subset \mathbb{C}^{n^2}$ is an affine algebraic variety if $S$ is the common zero set of a collection (possibly infinite or uncountable) of polynomials in $n^2$ complex variables. Some examples that satisfy this definition are "matrices with determinant 1" and "matrices with rank at most $k$".
A non-example is "matrices with rank $n$", because it is the complement of the affine algebraic variety "matrices with rank at most $n - 1$"; any affine algebraic variety is necessarily closed in the Euclidean topology, so its complement (which is open in the Euclidean topology) cannot be an affine algebraic variety.
However, I'm having trouble formulating a statement about "matrices with rank $k$" for $1 < k < n$.
Is the set of complex $n$ by $n$ matrices of rank $k$, where $1 < k < n$, an affine algebraic variety?