Projection matrix equation I am trying to solve this old exam question: Show that $P = A(A^TA)^{-1}A^T$ is a projection matrix if 
$A = \begin{bmatrix}1 \\ m\end{bmatrix}$. I don't understand what I'm doing wrong here:
$P = A(A^{-1}{A^T}^{-1}) A^T \implies P = (AA^{-1})({A^T}^{-1} A^T) \implies P = I$
However, if I actually multiply it out, I do get the projection matrix. Obviously $I$ is not a projection matrix, but I'm not sure what I'm doing wrong to get the identity though. 
 A: $A = \begin{bmatrix}1 \\ m\end{bmatrix} $ $\Rightarrow $ $A(A^TA)^{-1}A^T$  = 
$$
\frac{1}{m^2+1}\begin{bmatrix}1 & m \\ m & m^{2}\end{bmatrix}  \Rightarrow 
$$
$$
(A(A^TA)^{-1}A^T)^{2} = 
$$
$$
(\frac{1}{m^2+1})^{2}\begin{bmatrix}1 & m \\ m & m^{2}\end{bmatrix}\begin{bmatrix}1 & m \\ m & m^{2}\end{bmatrix} = 
$$
$$
(\frac{1}{m^2+1})^{2}\begin{bmatrix}1 + m^{2}& m + m^3 \\ m + m^3 & m^{2} + m^{4}\end{bmatrix} = 
$$
$$
(\frac{1}{m^2+1})\begin{bmatrix}1& m \\ m & m^2\end{bmatrix} = (A(A^TA)^{-1}A^T)
$$
Therefore $P$ is a projection matrix.
Since $P = (A(A^TA)^{-1}A^T) = (A(A^TA)^{-1}A^T)^{2} = P^{2} $
A: Billy has pointed out a problem with your approach, but here is a suggestion for one way to see why $P$ is a projection.  This does not depend on the particular form of $A$, as long as $(A^\text{T}A)^{-1}$ exists (which it does in your case).  Then you have 
$$ \left[A(A^\text{T}A)^{-1}A^\text{T}\right]\left[A(A^\text{T}A)^{-1}A^\text{T}\right]= A\left[(A^\text{T}A)^{-1}(A^\text{T}A)\right](A^\text{T}A)^{-1}A^\text{T}.$$
