Projection of a point on a plane I have a homework problem which I cannot solve. 
Equation of a hyperplane is given as 
$$f(x) = w^tx + b $$
Given $f(x) = 0$
show that the projection of a point xa on the plane is : 
$$x_p = x_a - \frac{|f(x_a)|w}{\| w\|^2}$$
I was thinking of taking a unit vector lying on the plane and taking the dot product. But I am not getting the result I am looking for
Could anyone point me into the right direction ?
Thanks.
 A: For any two points $x$, $y$ on the hyperplane $\pi:\> f(x)=0$ one has $w\cdot(x-y)=f(x)-f(y)=0$. It follows that the vector $w$ (assumed $\ne0$) is orthogonal to $\pi$ and in fact defines the unique direction orthogonal to $\pi$. Therefore the line
$$g:\quad t\mapsto x_a+ t\>w\qquad(-\infty<t<\infty)$$
is the projection ray we are interested in, and it only remains to intersect $g$ with $\pi$.
A: Fix $x_0\in f^{-1}(0)$. The projection of the vector $x_a-x_0$ onto $\text{span}\{w\}$ is the vector $\vec{n}=\frac{w^t(x_a-x_0)w}{\|w\|^2}$. If $x_p-x_0$ is the projection of the displacement vector $x_a-x_0$ onto $f^{-1}(0)$ then we have $$\begin{eqnarray*}(x_p-x_0)+\vec{n} & = & x_a-x_0\end{eqnarray*}$$ which means $$\begin{eqnarray*}x_p&=&x_a-\frac{w^t(x_a-x_0)w}{\|w\|^2} \\ &=& x_a -\Big(\frac{w^tx_a-w^tx_0}{\|w\|^2}\Big)w\end{eqnarray*}$$ Since $x_0\in f^{-1}(0)$ we have $w^tx_0+b=0$ so we can write this expression for $x_p$ as $$\begin{eqnarray*} x_p&=&x_a -\Big(\frac{w^tx_a+b}{\|w\|^2}\Big)w \\ &=& x_a -\frac{f(x_a)w}{\|w\|^2}\end{eqnarray*}$$
