# If $A=A^2$ is then $A^T A = A$?

I know that for a matrix $$A$$:

If $$A^TA = A$$ then $$A=A^2$$

but is it if and only if? I mean:

is this true that "If $$A=A^2$$ then $$A^TA = A$$"?

Consider $$A = \begin{bmatrix} 1 & -1 \\ 0 & 0 \end{bmatrix}$$. We have
$$A^2 = \begin{bmatrix} 1 & -1 \\ 0 & 0 \end{bmatrix}\begin{bmatrix} 1 & -1 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & -1 \\ 0 & 0 \end{bmatrix} = A$$ but $$A^TA = \begin{bmatrix} 1 & 0 \\ -1 & 0 \end{bmatrix}\begin{bmatrix} 1 & -1 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix} \ne A$$
What about of $$A=\begin{bmatrix} 1&1\\0&0\end{bmatrix}\large{?}$$
Since $$\det (A)^2 = \det (A)\det (A) = \det (A^2)= \det (A) \implies \det (A)\in\{0,1\}$$
So if $$\det (A)= 1$$ then exsist $$A^{-1}$$ so $$A = I$$ and the answer is yes.
If $$\det(A)=0$$ then examples show that answer is negative.