TITLE: Matrices with rank exactly r as variety
QUESTION [9 upvotes]: Assume $M(n,m)$ denote the vector space of $n\times m$ matrices. Consider this as an affine space. Now consider the subset of matrices with rank exactly $r$. Is this subset an irreducible subvariety? If it is, can we find its dimension?

The only thing I can recall about rank is that we can use minors of a matrix to determine the rank. In this way I guess I can prove the set is locally closed (in the Zarisky topology). So this should be a subvariety. About irreducibility, I guess I should express this subset as the image of some map, but I am not sure. Can I decompose a matrix with rank r by two other matrices?
Of course, the hardest part is the dimension. Totally no idea.

REPLY [7 votes]: Here is a proof of the irreducibility of the variety $V_r$ of matrices of rank $r$.
Consider the action of $GL(n)\times GL(m)$ on $M(n,m)$ given by $$(G,H)\bullet A=GAH^{-1}$$ Two matrices  matrices $A,B\in M(n,m)$ have the same rank if and only if they are in the same orbit.
Hence if one fixes a matrix $A_r$ of rank $r$ , the variety $V_r$  of matrices of rank $r$ is the orbit  of $A_r$ under this action , which means that we have a regular surjective morphism $$GL(n)\times GL(m)\twoheadrightarrow V_r:(G,H)\mapsto GA_rH^{-1} $$ Since  $GL(n)\times GL(m)$ is irreducible, so is $V_r$.