0

Consider the hyperplanes $\{x | P_1^T \cdot x + q_1 = 0\}$ and $\{x | P_2^T\cdot x + q_2 = 0\}$ in $\mathbb{R}^n$. Let $C \in \mathbb{R}^n$ and we want to compute te distance from $C$ to the intersection of these hyperplanes.

Solution

Let $x = C + a \cdot \frac{P_1}{\|P_1\|} + b\cdot \frac{P_2}{\|P_2\|}$ then from $$ \begin{cases} P_1^T \cdot \left( C + a \cdot \frac{P_1}{\|P_1\|} + b\cdot \frac{P_2}{\|P_2\|}\right) + q_1 = 0\\ P_2^T \cdot \left( C + a \cdot \frac{P_1}{\|P_1\|} + b\cdot \frac{P_2}{\|P_2\|}\right) + q_2 = 0 \end{cases} $$ one gets $$ \begin{bmatrix} \|P_1\| &\frac{P_1^T\cdot P_2}{\|P_1\|}\\ \frac{P_2^T\cdot P_1}{\|P_2\|} &\|P_2\|\end{bmatrix} \cdot \begin{bmatrix} a\\ b\end{bmatrix} = \begin{bmatrix} -q1 - P_1^T\cdot C\\ -q_2 - P_2^T\cdot C\end{bmatrix} $$ therefore $$ \begin{bmatrix} a\\ b\end{bmatrix} = \begin{bmatrix} \|P_1\| &\frac{P_1^T\cdot P_2}{\|P_1\|}\\ \frac{P_2^T\cdot P_1}{\|P_2\|} &\|P_2\|\end{bmatrix}^{-1} \cdot \begin{bmatrix} -q1 - P_1^T\cdot C\\ -q_2 - P_2^T\cdot C\end{bmatrix} $$ Finally one gets the distance as $\|x - C\|^2 = a^2 + b^2 + 2\cdot a\cdot b\cdot \frac{P_1^T\cdot P_2}{\|P_1\|\cdot \|P_2\|}$

Question

Is the derivation correct? I have seen in this post a solution with Lagranje multipliers, but although somehow similar at some point, not exactly as what I am doing here

C Marius
  • 1,257
  • 1
    I haven't checked your calculations in detail, but with $a$ and $b$ as in your final display the distance formula looks reasonable. <> If it helps, it suffices to assume $P_1$ and $P_2$ are unit vectors (which simplifies the notation), and (translating everything by $-C$) that we're seeking the distance from the origin to the intersection of two affine hyperplanes. That amounts to finding the point on the intersection that is a linear combination of the normal vectors. – Andrew D. Hwang Sep 10 '23 at 17:25
  • Thank you @AndrewD.Hwang for your comment! – C Marius Sep 10 '23 at 20:24
  • @AndrewD.Hwang of course it looks ok in $a,b$ ... that is trivial. The real question is if the values of $a,b$ are obtained correctly :) Or at least using the correct technique. It seems to me that this technique can be generalized to finding the distance to an intersection of $k$ hyperplanes ... – C Marius Sep 10 '23 at 20:37
  • To rephrase/clarify: At first I was tentatively skeptical because your final formula involves quantities $a$ and $b$ that appear without definition the first line of the solution. Then I saw the last displayed formula where you express $a$ and $b$ in terms of geometric data, which looks reasonable (though I haven't checked). – Andrew D. Hwang Sep 10 '23 at 23:13
  • @AndrewD.Hwang ahh ... ok! Thank you for your additional explanation! – C Marius Sep 11 '23 at 07:52

0 Answers0