# 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.

-
What is $A^{-1}$? –  Billy Dec 20 '12 at 5:12
Ah, of course. Thanks. –  hesson Dec 20 '12 at 5:14
If you haven't yet, check what $P^2$ is. By the way, $I$ is a projection matrix. –  Jonas Meyer Dec 20 '12 at 5:15
More specifically, $P$ is called a projection matrix if $P^2=P$. –  user1551 Dec 20 '12 at 5:33
I thought projection matrices cannot be invertible. How could $I$ be a projection matrix? –  hesson Dec 20 '12 at 5:35

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}.$$
$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}$
$P \ne A(A^{-1}{A^T}^{-1}) A^T$ because $A$ is not invertible. –  Rustyn Dec 20 '12 at 8:30
$I$ is a projection matrix because $I^{2}$ = $I$ –  Rustyn Dec 20 '12 at 8:34