A problem about $\text r(A^TA)=\text r(A)$ Recently, I  have a problem about $ \text r(A^TA)=\text r(A)$
I can show it correct:

Only show equation $A^TAx=0 $ and $Ax=0$ has same solutions
On the one hand,$Ax=0 $'s solution Obviously is $A^TAx=0$'s solution
On the other hand, $A^TAx=0 \implies $ $x^TA^TAx=0  \implies $ $(Ax)^TAx=0$
Assuming $Ax=(a_1,a_2,...a_n)^T  \implies  (Ax)^TAx=a_1^2+a_2^2+\ldots +a_n^2=0$ $ \implies $ $a_i=0 \implies Ax=0$
So equation $A^TAx=0 $ and $Ax=0$ has same solutions. $ \implies r(A^TA)=r(A)$

However,I know $\text r(AB) \leq \min(\text r(A),\text r(B))$, so  $\text r(A^TA) \leq r(A)$,I cannot know why.Can someone help me? Are them controdictory?
 A: Let $m,n\in \mathbb N$ and $A\in \mathcal M_{m\times n}(\mathbb R)$.
Note that $\text{rank}(A)=\text{rank}(A^TA)\iff \text{nullity}(A)=\text{nullity}(A^TA)$.
To prove the LHS of the equivalence it is sufficient to prove that $$\{X\in \mathbb R^{n\times 1}\colon A^TAX=0_{\mathbb R^{n\times 1}}\}=\{X\in \mathbb R^{n\times 1}\colon AX=0_{\mathbb R^{n\times 1}}\}.$$
The inclusion $\supseteq$ is trivial. For $\subseteq$ take $X\in \mathbb R^{n\times 1}$ and note that 
$$\begin{align} A^TAX=0_{\mathbb R^{n\times 1}}&\implies X^TA^TAX=0_{\mathbb R^{n\times 1}}\\
&\implies (AX)^T(AX)=0_{\mathbb R^{n\times 1}}\\
&\implies \left\Vert AX\right \Vert_2=0_{\mathbb R^{n\times 1}}\\
&\implies AX=0_{\mathbb R^{n\times 1}}\\
&\implies X\in \{X\in \mathbb R^{n\times 1}\colon AX=0_{\mathbb R^{n\times 1}}\}.\end{align}$$
Edit: I realise now the OP already knew this and that his question is why this doesn't contradict the fact that $\text{rank}(A^TA)\leq\text{rank}(A)$. The reasons for this are purely logical, it was established that $\text{rank}(A^TA)=\text{rank}(A)$, therefore $\text{rank}(A^TA)=\text{rank}(A)\lor \text{rank}(A^TA)<\text{rank}(A)$, that is, $\text{rank}(A^TA)\leq\text{rank}.(A)$
