# Prove $\operatorname{rank}A^TA=\operatorname{rank}A$ for any $A\in M_{m \times n}$

How can I prove $$\operatorname{rank}A^TA=\operatorname{rank}A$$ for any $$A\in M_{m \times n}$$?

This is an exercise in my textbook associated with orthogonal projections and Gram-Schmidt process, but I am unsure how they are relevant.

Let $\mathbf{x} \in N(A)$ where $N(A)$ is the null space of $A$.
So, \begin{align} A\mathbf{x} &=\mathbf{0} \\\implies A^TA\mathbf{x} &=\mathbf{0} \\\implies \mathbf{x} &\in N(A^TA) \end{align} Hence $N(A) \subseteq N(A^TA)$.
Again let $\mathbf{x} \in N(A^TA)$
So, \begin{align} A^TA\mathbf{x} &=\mathbf{0} \\\implies \mathbf{x}^TA^TA\mathbf{x} &=\mathbf{0} \\\implies (A\mathbf{x})^T(A\mathbf{x})&=\mathbf{0} \\\implies A\mathbf{x}&=\mathbf{0}\\\implies \mathbf{x} &\in N(A) \end{align} Hence $N(A^TA) \subseteq N(A)$.
Therefore \begin{align} N(A^TA) &= N(A)\\ \implies \dim(N(A^TA)) &= \dim(N(A))\\ \implies \text{rank}(A^TA) &= \text{rank}(A)\end{align}