I have two points $\mathbf{x_1}$ and $\mathbf{x_2}$, where $\mathbf{x_i}=\{x^i_1, x^i_2, \ldots, x^i_n\}$. I need to find a normal hyperplane $P$ that goes through the midpoint of $\mathbf{x_1}$ and $\mathbf{x_2}$, and I need to do it numerically.

My take --

Find the direction vector from $\mathbf{x_1}$ to $\mathbf{x_2}$: $$\mathbf{V} = \mathbf{x_2} - \mathbf{x_1}$$

Find the unit vector: $$\vec{v} = \frac{\mathbf{V}}{||\mathbf{v}||}$$

Find the mid-point: $$\mathbf{x_{mid}} = \left[\frac{x^1_1 + x^1_2}{2},\frac{x^2_1 + x^2_2}{2}, \ldots, \frac{x^n_1 + x^n_2}{2}\right]$$

Now suppose the plane $P$ goes through some arbitrary $\mathbf x$, therefore --

$${\vec v} \cdot (\mathbf{x} - \mathbf{x_{mid}}) = 0 \quad\Rightarrow\quad \vec{v} \cdot \mathbf{x} = \vec{v} \cdot \mathbf{x_{mid}}$$

or --

\begin{align} \Rightarrow [v_1, v_2, \ldots, v_n][x_1, x_2, \ldots, x_n]^T = [v_1, v_2, \ldots, v_3]\left[\frac{x^1_1 + x^1_2}{2},\frac{x^2_1 + x^2_2}{2}, \ldots, \frac{x^n_1 + x^n_2}{2}\right]^T\\ \Rightarrow [x_1, x_2, \ldots, x_n]^T = [v_1, v_2, \ldots, v_3]\left[\frac{x^1_1 + x^1_2}{2},\frac{x^2_1 + x^2_2}{2}, \ldots, \frac{x^n_1 + x^n_2}{2}\right]^T [v_1, v_2, \ldots, v_n]^{-1}\\ \Rightarrow[x_1, x_2, \ldots, x_n]^T = \left[\frac{x^1_1 + x^1_2}{2},\frac{x^2_1 + x^2_2}{2}, \ldots, \frac{x^n_1 + x^n_2}{2}\right]^T \Leftarrow ?? \end{align}

I lost all my clues with this computation, what I am missing here?

  • $\begingroup$ One point of observation: Since you're defining your plane as $\vec{v}\cdot(\mathbf{x}-\mathbf{x}_{mid})=0$, it doesn't matter what the magnitude of $\vec{v}$ is. So you can take $\mathbf{V}=\mathbf{x}_2-\mathbf{x}_2$ instead. $\endgroup$ Commented Sep 16, 2014 at 19:34
  • $\begingroup$ what do you mean by $\mathbf{x_2} - \mathbf{x_2}$? $\endgroup$
    – ramgorur
    Commented Sep 16, 2014 at 19:56
  • $\begingroup$ I meant $\mathbf{x}_2-\mathbf{x}_1$. $\endgroup$ Commented Sep 16, 2014 at 20:07
  • $\begingroup$ Your statement that $\vec{v}\cdot(\mathbf{x}-\mathbf{x}_{mid})=0$ is a valid definition of the plane. But what you do after that isn't sensible: You can't divide by a vector, so $\mathbf{x}\neq \mathbf{x}_{mid}.$ Moreover, it's not really clear what you're asking at this point: Do you want to know about the plane, or how to reflect with respect to the plane (as per your original question). $\endgroup$ Commented Sep 16, 2014 at 20:30

2 Answers 2


Your calculations are true. You just need to consider the relation between the hyper-plane's normal and its bias value. You could do this by considering the projection of the point $\mathbf{o}$ (center of the coordinate) to the hyper-plane, call it $\mathbf{o'}$. The good thing about $\mathbf{o'}$ is that it is a multiple of the hyper-plane normal ($\mathbf{v}$) and it is a point of the hyper-plane which should satisfy $\mathbf{v}^T \mathbf{o'} = b$.

The final answer is:

Let the hyper-plane be $P = \lbrace \mathbf{x'} \in \Re^n | \mathbf{v}^T\mathbf{x'} = b \rbrace$. Then \begin{equation} \mathbf{v} = \frac{\mathbf{x_1} - \mathbf{x_2}}{||\mathbf{x_1} - \mathbf{x_2}||}, \\ b = \frac{||\mathbf{x_1}||^2 - ||\mathbf{x_2}||^2}{2||\mathbf{x_1} - \mathbf{x_2}||}. \end{equation}


Inverting a vector is not a valid function. That's where you're going wrong. Before that looked good. Done, even. If you want a more elementary-looking equation, you simply have to multiply out the dot product.

Also, I think the notation is part of the confusion: using $x_1$, $x_2$, ..., $x_n$ for independent variable coordinates while using $\boldsymbol{x}_1$ and $\boldsymbol{x}_2$ for your two fixed points. Using $\boldsymbol{u}_1$ and $\boldsymbol{u}_2$ for fixed points, for example, would make it much clearer.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .