# Link between the projection onto a subspace and projection onto hyperplane

The projection onto a hyperplane $H=\{x\in \mathbb{R}^n|\langle a,x\rangle=b\}$ is defined to be $P_{H}(x)=x-\frac{\langle a,x\rangle-b}{||a||^2}a,$ and characterized by $\langle c-p,x-p\rangle\leq0.$ Also the projection onto a subspace $S\subset\mathbb{R}^n$ is defined by $P_{S}(x)=x-\frac{\langle a,x\rangle}{||a||^2}a$ and it is characterized by $\langle x-p,c\rangle=0$ for all $c\in S$ and $p$ is the projection of $x$ onto $S.$ I have also read that $P_{S+y}(x)=P_{S}(x-y)+y$ (the hyperplane H is the translation of the subspace S by the vector y. My question is, can any one show me how can the formula of projection onto a hyperplane be derived from the one of subspace or vice versa. I am trying to understand the link between the projection onto a hyperplane and the projection onto a subspace so any help will be really appreciated. Thanks to everyone who contributes making answer.

• What is a "subspace", in your understanding (I'm trying to figure out how much linear algebra notation to use)? Nov 26 '14 at 0:25
• A subspace is defined to be $S=\{x\in \mathbb{R}^n|\langle a,x\rangle=0\}$ Nov 26 '14 at 6:30

Pick any point $x_{0}$ on the hyperplane $H=\{ x : \langle x, a \rangle = b \}$. Then $$H-x_{0} = \{ x-x_{0} : x \in H \}$$ is a subspace because $\langle (x-x_{0}),a \rangle = 0$. So your hyperplane is a translation of a subspace in a particular vector direction. If you want to project $y$ onto $H$, that's the same as projecting $y-x_{0}$ onto the subspace $H-x_{0}$, and then adding $x_{0}$ back because the final answer to this modified projection problem is on $H-x_{0}$. Translation by a fixed vector is an isometric operation (i.e., it keeps relative distances the same.) That guarantees that the one projection problem is equivalent to the other. In other words $\|x-y\|=\|(x-x_{0})-(y-x_{0})\|$.

So, suppose you have found such an $x_{0}$ for which $\langle x_{0}, a\rangle = b$, and you now want to project $y$ onto $H$. Projecting $y-x_{0}$ onto $H-x_{0}$ gives $$(y-x_{0}) - \frac{\langle y-x_{0},a\rangle}{\|a\|^{2}}a =y-x_{0}+\frac{\langle y,a\rangle - b}{\|a\|^{2}}a$$ The $b$ appeared because $x_{0}$ was chosen so that $\langle x_{0},a\rangle =b$. Then to put everything back into the original coordinates, you add $x_{0}$ back to your final answer because the above is a point on $H-x_{0}$. So the original projection, in the original coordinates, is found to be $$y - \frac{\langle y,a\rangle-b}{\|a\|^{2}}a.$$

[A note on notation: I added vector symbols, since I was nonplussed that you used $a$ for a vector and the adjacent letters $b, c$ for scalars. I trust it will be clear.]

[An introductory note: is it clear to you that $\vec{a}$ is the normal vector to the plane, and what normal vectors mean? If not, you should brush up on that, and then come back to this.]

First, take a hyperplane passing through the origin. Then $b = 0$, since applying the "hyperplane rule" to the origin vector $\vec{0}$ gives $\langle \vec{a}, \vec{0} \rangle = b$, or $0 = b$. [I trust this is clear.] In this case, your hyperplane and [codimension-1] subspace formulas coincide.

For a concrete example, take the $xy$-plane in $\mathbb{R}^3$; the usual formula, $z= 0$, is really $\langle ( 0, 0, 1 ) , (x, y, z) \rangle = 0$ (since I use the angle notation for the inner product, I use parentheses for the vectors, despite the potential confusion. I welcome any better suggestions).

I trust it is clear that the (orthogonal) projection onto the $xy$-plane sends $(x, y, z)$ to $(x, y, 0)$: we're trying to remove any part of the normal vector to the plane [here, $\mathbf{k} = (0, 0, 1)$] in the vector, and that is what we will get.

The adjustment to hyperplanes both through the origin is "just the same", save that we have to offset the result to get it onto the offset plane. For example, taking the plane $z = 10$, clearly parallel to $z = 0$, I trust it is clear that $(x, y, z)$ should be sent to $(x, y, 10)$ -- at a minimum, the projection should send all vectors to the hyperplane, so the $\mathbf{k}$-coefficient, namely $z$, must be 10, and if the projection is otherwise "the same as" the projection onto the $xy$-plane, the other parts.

This is the rough idea. An attempt at the details follows.

Take the hyperplane $\left\lbrace \langle \vec{a}, \vec{x} \rangle = b \right\rbrace$ and adjust the coordinate system by translation: set $\vec{x^{\prime}} =\vec{x} - \frac{b}{\Vert \vec{a} \Vert^2}\vec{a}$, or $\vec{x} = \vec{x^{\prime}} + \frac{b}{\Vert \vec{a} \Vert^2}a$. Then we see that (assuming real coefficients): \begin{align} \langle \vec{a}, \vec{x} \rangle & = b\\ \left\langle \vec{a}, \vec{x^{\prime}} + \frac{b}{\Vert \vec{a} \Vert^2}\vec{a} \right\rangle & = b\\ \langle \vec{a}, \vec{x^{\prime}} \rangle + \frac{b \langle \vec{a}, \vec{a} \rangle}{\Vert \vec{a} \Vert^2} & = b\\ \langle \vec{a}, \vec{x^{\prime}} \rangle + \frac{b \Vert \vec{a} \Vert^2}{\Vert \vec{a} \Vert^2} & = b\\ \langle \vec{a}, \vec{x^{\prime}} \rangle + b & = b\\ \langle \vec{a}, \vec{x^{\prime}} \rangle & = 0 \end{align} Thus, in the revised coordinate system, we have a plane passing through the origin, a.k.a. a [codimension-1] subspace. So to project onto the subspace in revised coordinates, we have $P_H^{\prime}(\vec{u}) = \vec{u} - \frac{\langle \vec{a}, \vec{u} \rangle}{\Vert \vec{a} \Vert^2} \vec{a}$ by either formula.

The only thing left to do is to unshift the coordinates, since our "answer" is in the shifted coordinate system. Thus, we get

\begin{align} P_H(\vec{x}) &= P_H^{\prime}(\vec{x^{\prime}}) + \frac{b}{\Vert \vec{a} \Vert^2}\vec{a} \\ & = \vec{x^{\prime}} - \frac{\langle \vec{a}, \vec{x^{\prime}} \rangle}{\Vert \vec{a} \Vert^2} \vec{a} + \frac{b}{\Vert \vec{a} \Vert^2}\vec{a} \end{align} and now switching these $\vec{x^{\prime}}$'s back to $\vec{x}$'s, we get \begin{align} P_H(\vec{x}) & = \left( \vec{x} - \frac{b}{\Vert \vec{a} \Vert^2}\vec{a} \right) - \frac{\displaystyle \left\langle \vec{a}, \vec{x} - \frac{b}{\Vert \vec{a} \Vert^2}\vec{a}\right\rangle}{\Vert \vec{a} \Vert^2} \vec{a} + \frac{b}{\Vert \vec{a} \Vert^2}\vec{a} \\ & = \vec{x} - \left( \frac{\langle \vec{a}, \vec{x} \rangle - \displaystyle \frac{b \langle \vec{a}, \vec{a} \rangle}{\Vert \vec{a} \Vert^2} }{\Vert \vec{a} \Vert^2} \vec{a} \right)\\ & = \vec{x} - \left( \frac{\langle \vec{a}, \vec{x} \rangle - b }{\Vert \vec{a} \Vert^2} \vec{a} \right)\\ \end{align}