Let $W$ be the vector space of all real $n\times n$ matrices $X$ such that $AX=0$ where $A$ is a real $n\times n$ matrix of rank $r$. Find the dimension of $W$.
The number of free choices for constructing such an $A$ is clearly $nr$ since $r$ rows of $A$ determine the rest of it.
But, I don't get how to classify the choice of $X$'s that are in $W$.
We have $\text{rank}(A)+ \text{nullity}(A)=n$.
Then $\text{nullity}(A)=n-r$.
Let $X\in W$ so that $AX=0$. Let $X=(C_1,C_2,...,C_n)$ where each $C_i$, $i=1,2,\dots ,n$ is a column vectors of $X$. Since $AX=0$, we have $AC_i=0$ for each $i=1,2,\dots ,n$, that is we have $n$ copies of columns lies in then $\ker(A)$ and $\dim \ker(A)=n-r$
So, $\dim W= n(n-r)$.