Revisit:

1. Let P be an orthogonal projection matrix, then $P^T=P$ and $P^2=P$.
2. x and y are two vectors. The projection of y onto x is $\frac{xx^T}{x^Tx}y$.

New question: Let $A=(a_1,...,a_m)\in\mathbb{R}^{n\times m}, n\ge m$. y is an vector. What is the projection of y onto the column space of A?

Answer: $A(A^TA)^{-1}A^Ty$

Proof: it is the same to find x to minimize $\|Ax-y\|^2$ which is a least squares problem. As we know, the answer is $x=(A^TA)^{-1}A^Ty$. Then the projection is $Ax= A(A^TA)^{-1}A^Ty$. Hence the projector is $A(A^TA)^{-1}A^T$.