1

I need to find signed distance from the point to the intersection of 2 hyperplanes. I was quite sure that this is something that every mathematician do twice a week :) But not found any good solution or explanation for same problem.

In my case the hyperplanes is defined as $y = w'*x + x_0$, but it is ok to define it with the set of points if there is no other way to solve.

The only solution i found is method to find points of intersection from points from hyperplanes here: https://www.mathworks.com/matlabcentral/fileexchange/50181-affinespaceintersection-intersection-of-lines-planes-volumes-etc

But i stuck how to find signed distance after that.

I have strong feeling that there is easy solution, but i don't know correct keywords.

It will be great to see formulas and implementation on any language. But for sure any help highly appreciated.

Thank you.

KReiser
  • 65,137
johngull
  • 119
  • 1
    You’re asking about a signed distance. How do you decide which “side” of the plane a point lies on? Unlike a hyperplanes, a plane doesn’t divide the four-dimensional space in two. An analogous situation is distance from a line in $\mathbb R^3$: what would the sign of this distance represent? – amd Oct 17 '18 at 07:53
  • @amd thank you for the reply. To be honest I can't remember now what exact meaning of sign was expected in that task. But your question is very logical - its impossible to make without some restriction, like putting the target point to some of the hyperplanes. I guess that is how it was. – johngull Oct 18 '18 at 08:29

2 Answers2

1

To find the plane of intersection of two hyperplanes, just perform a simple variable replacement and you will get the intersection plane. For instance, if you have two hyperplanes:

3x + 4y + 2z - 7w = 10
2x - 3y + 2z + 1w = 2

You can then isolate "$w$" (or any other variable):

w = 2 - 2x + 3y - 2z

And replace it in the first equation:

3x + 4y + 2z - 7(2 - 2x + 3y - 2z) = 10

And now you have your intersection plane. Then use the (signed) plane-point distance formula to get your answer. Just simple math.

  • Thank you for answer. Can you please add example how to calc distance. Lets say point $(1,2,3,4)$. As i understand we need to substitute $x=1, y=2, z=3$. But what to do with $w$ if it is isolated? Sorry for dumb question - not made any geometry math for last 10 years. – johngull Dec 07 '16 at 14:06
  • Seems your answer is incorrect – johngull Dec 07 '16 at 14:32
1

Generally speaking, the distance from a point $\mathbf p$ to a flat is the norm of the orthogonal rejection from the flat. A flat is a translation $\mathbf p_0+V$ of a vector subspace $V$, so this rejection can be computed by orthogonally projecting $\mathbf p-\mathbf p_0$ onto $V$ and subtracting, or by projecting directly onto $V^\perp$. This vector is independent of the choice of the representative point $\mathbf p_0$ on the flat. As I mentioned in my comment, I’m not sure how one would even define a signed distance in this context, but computing the unsigned distance to the intersection of a pair of hyperplanes is fairly straightforward.

You haven’t specified the dimension of the ambient space, but in this case it turns out not to really matter because of the particular structure of your hyperplanes. Their equations only constrain $x$ and $y$ (which I’ll assume are the first two coordinates), so their intersection, if it exists, will consist of all points with $x$- and $y$-coordinates equal to some fixed values. This means that your problem reduces to a two-dimensional one on the $x$-$y$ plane: that of finding the distance from the projection of the given point onto the $x$-$y$ plane (which you find by discarding all of its other coordinates) and the intersection of a pair of lines with equations of the form $y=w'x+x_0$. I assume that you know how to do that.

This conclusion can be verified by treating this as a Lagrange multiplier problem: the constraints are the equations of the two hyperplanes and we can take the square of the distance to the given point $\mathbf p$ as the objective function so that $$\mathcal L(\mathbf x) = (\mathbf x-\mathbf p)^T(\mathbf x-\mathbf p)-\lambda_1(\mathbf n_1^T\mathbf x+d_1)-\lambda_2(\mathbf n_2^T\mathbf x+d_2)$$ and $\nabla\mathcal L = 2(\mathbf x-\mathbf p)-\lambda_1\mathbf n_1-\lambda_2\mathbf n_2.$ In your case, all but the first two components of the two normal vectors are zero, so for those components the resulting equation is simply $2(x_k-p_k)=0$. At the closest point to $\mathbf p$, we will therefore have $x_k=p_k$ for $k\gt2$, which means that none of those coordinates contribute to the minimal distance. Neither do they appear in the equations that arise from the first two components of $\nabla\mathcal L$, so all of those other coordinates can be safely ignored.

If the two hyperplanes are in general position, the problem can similarly be reduced to a two-dimensional one by orthogonal projection onto a plane, but now the plane is defined by the two hyperspace normals $\mathbf n_1$ and $\mathbf n_2$. If $(\mathbf u,\mathbf v)$ is an orthonormal basis of this plane, then the coordinates relative to this basis of the orthogonal projection of a vector $\mathbf x\in\mathbb R^4$ are $(u,v)=(\mathbf u\cdot\mathbf x,\mathbf v\cdot\mathbf x)$.

Applying this to the example in Rohan’s answer, we have (suppressing superscript $T$s to reduce clutter) $\mathbf n_1=(3,4,2,-7)$ and $\mathbf n_2=(2,-3,2,1)$. An orthonormal basis for their span is $$\mathbf u = \left(\frac{\sqrt2}3,-\frac1{\sqrt2},\frac{\sqrt2}3,\frac1{3\sqrt2}\right) \\ \mathbf v = \frac17\left(4\sqrt{\frac23},\frac5{\sqrt6},\sqrt6,-\frac{13}{\sqrt6}\right).$$ The projection of the two hyperplanes are the lines $$-\frac3{\sqrt2}u+7\sqrt{\frac32}v=10 \\ 3\sqrt2 u = 2,$$ which intersect at $\left(\frac{\sqrt2}3,\frac{11}7\sqrt{\frac23}\right)$. The point $(1,2,3,4)$ projects to $\left(\sqrt2,-\frac87\sqrt{\frac23}\right)$ and, finally, the distance between them is $\frac{\sqrt{2558}}{21}$. The same answer is obtained by solving the corresponding Lagrange multipler problem.

amd
  • 53,693