Why does $\operatorname{rank}(\mathbf{X})$ equal $\operatorname{rank}(\mathbf{X^TX})$? Is this true in general, please? And what is $\dim(\mathbf{X^TX})$, please? Does it equal to $\dim(\mathbf{X})$ in general, please? Thank you!
Imagine I prove the first claim by assuming that $\mathbf{X}$ is an $n\times k$ matrix with $n>k$ and $\mathbf{X}$ has rank $l<k$. Then, we know $\operatorname{nullity}(\mathbf{X})+\operatorname{rank}(\mathbf{X})=\dim (\mathbf{X})=l<k.$
To this end, I need to show first that $\dim(\mathbf{X})=\dim (\mathbf{X^TX})=l$. And then show $\operatorname{nullity}(\mathbf{X})=\operatorname{nullity}(\mathbf{X^TX})$.
I do not know how to show the first claim. Any hint, please? Thank you!
Provided the first claim is true, it is easy to see the following. If $\mathbf{X}v=\bf{0}$, then $\mathbf{X^TX}v=\bf{0}$. If $\mathbf{X^TX}v=\bf{0}$, then $v^T\mathbf{X^TX}v=\bf{0}$, which implies that $\mathbf{X}v=\bf{0}$. Hence, the second claim is proved.
Look at the null space - if: $$X^T X v=0$$ Then also: $$v^T X^T X v = |Xv|^2 =0$$ So that the null space of $X^TX$ is the same as that of $X$. The rank is therefore the same as well.