A Generalization of the Distance Formula

Geometry Level pending

Everybody knows that the distance of a point (3D vector) q q from the plane n ( r r 0 ) = 0 n \cdot ( r - r_0 ) = 0 is given by

d = n ( q r 0 ) n n d = \dfrac{ | n \cdot (q - r_0) | }{ \sqrt{ n \cdot n } }

In this problem, I generalize the formula to R n \mathbb{R}^n , and to multiple hyperplanes.

So consider the point q = ( 3 , 3 , 4 , 4 , 5 ) R 5 q = (3, 3, 4, 4, 5) \in \mathbb{R}^5 , we want to find the minimum distance between q q and a point x = ( x 1 , x 2 , x 3 , x 4 , x 5 ) R 5 x =(x_1, x_2, x_3, x_4, x_5) \in \mathbb{R}^5 that lies on the intersection of the following hyperplanes

x 1 + 2 x 2 + 3 x 3 + 4 x 4 + 5 x 5 = 10 x_1 + 2 x_2 + 3 x_3 + 4 x_4 + 5 x_5 = 10

3 x 1 + 2 x 2 4 x 3 + 5 x 4 + 6 x 5 = 20 3 x_1 + 2 x_2 - 4 x_3 + 5 x_4 + 6 x_5 = 20

Report your answer rounded to 3 decimal places.

Details and Assumptions:

  • The distance between x x and q q is defined as

d = ( x q ) ( x q ) = ( x q ) T ( x q ) d = \sqrt{ (x - q) \cdot (x - q ) } = \sqrt{ (x - q)^T (x - q) }


The answer is 7.254.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Hosam Hajjir
Apr 24, 2017

The problem can be stated as follows:

Minimize ( x q ) T ( x q ) , subject to A T x = b \text{Minimize } (x- q)^T (x - q) , \text{subject to } A^T x = b

Direct application of the Lagrangian multipliers method yields the desired result.

Define g ( x ) = ( x q ) T ( x q ) + m T ( A T x b ) g(x) = (x - q)^T (x - q) + m^T(A^T x - b)

where m m is the Lagrangian multipliers vector. Then, the gradient with respect to x x is

x g = 2 ( x q ) + A m = 0 ( 1 ) \nabla_x {g} = 2 (x - q) + A m = 0 \cdots \cdots (1)

and the gradient with respect to m m is

m g = A T x b = 0 ( 2 ) \nabla_m {g} = A^T x - b = 0 \cdots \cdots (2)

From (1), we obtain,

x = q ( 1 / 2 ) A m ( 3 ) x = q - (1/2) A m \cdots \cdots (3)

Substituting this into (2),

A T ( q ( 1 / 2 ) A m ) b = 0 A^T (q - (1/2) A m) - b = 0

( 1 / 2 ) A T A m = b A T q -(1/2) A^T A m = b - A^T q

Therefore,

m = 2 ( A T A ) 1 ( b A T q ) m = -2 (A^T A)^{-1} (b - A^T q)

Substituting this into (3),

x q = ( 1 / 2 ) A m = A ( A T A ) 1 ( b A T q ) x - q = -(1/2) A m = A (A^T A)^{-1} (b - A^T q)

Finally,

f min = ( x p ) T ( x p ) = ( b A T q ) T ( A T A ) T A T A ( A T A ) 1 ( b A T q ) = = ( b A T q ) T ( A T A ) 1 ( b A T q ) = ( A T q b ) T ( A T A ) 1 ( A T q b ) \begin{aligned} f_{\text{min}} &= \sqrt{(x - p)^T (x - p)} = \sqrt{ (b - A^T q)^T (A^T A)^{-T} A^T A (A^T A)^{-1} (b - A^T q)} = \\ &= \sqrt{ (b - A^T q )^T (A^T A)^{-1} (b - A^T q)} \\ &= \sqrt{ (A^T q - b )^T (A^T A)^{-1} (A^T q - b)} \\ \end{aligned}

And this is the generalized formula. What remains is to substitute the given values to obtain f min = 7.254 f_{\text{min}}=7.254

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...