How to derive one formula of projection from another The projection onto the subspace (hyperplane)
$$H:=\{x\in \mathbb{R}^n:\langle a,x\rangle=0\}$$
is given by $$P_{H}(x)=x-\frac{\langle a,x\rangle}{\|a\|^2}a. \tag 1$$ and also the projection onto any subspace $V$ (including $H$) can be defined by
$$P_V(x)=A(A^TA)^{-1}A^T(x) \tag 2$$
where $A$ is the a matrix whose columns are spanning set for the subspace $V$ who are linearly independent. My question is how can we get (1) from (2)? I appreciate any help  and if possible if some one can show me that as I am not able to make an argue about that. I know for the subspace (hyperplane) $H$ is of dimension $n-1$ and I can understand the derivation of (1). Also I can understand how (2) is been derived but I am struglling in getting from (2) to (1). Thanks to every one contribute in helping me.
 A: The orthogonal projection $P$ onto any subspace of a finite-dimensional space is $P=I-Q$, where $I$ is the identity operator and $Q$ is the orthogonal projection onto the orthogonal complement of the subspace.  Thus the projection $P$ onto an $(n-1)$-dimensional subspace of an $n$-dimensional space is $P=I-Q$, where $Q$ is the projection onto the $1$-dimensional orthogonal complement of the $(n-1)$-dimensional space.  The orthogonal complement of the space $\{x\in\mathbb R^n : \langle a,x\rangle=0\}$ is the space spanned by the vector $a$. Thus you need to apply $(2)$ in the case where the matrix $A$ has just one column, which is $a$.  In that case the matrix $A(A^T A)^{-1}A^T$ is an $n\times n$ matrix of rank $1$.  And in that case, the matrix $A^T A$ is the scalar $\|a\|^2$, so multiplying by its inverse is just dividing by that scalar.  Multiplication by a scalar commutes with matrix multiplication, so we have
$$
A(A^T A)^{-1} A^T x = \frac{AA^T x}{\|a\|^2}\quad(\text{when $A$ has just one column}).
$$
And in that case where $A$ has just one column, which is $a$, we also have $A^T x = \langle a,x\rangle$. Thus $(A^T A)^{-1} A^T x$ becomes the scalar $\dfrac{\langle a,x\rangle}{\|a\|^2}$.  And again, multiplying by a scalar commutes with multiplying matrices, so $A(A^T A)^{-1}A^T x$ is $\dfrac{\langle a,x\rangle}{\|a\|^2} A = \dfrac{\langle a,x\rangle}{\|a\|^2} a$.
