Everybody knows that the distance of a point (3D vector) q from the plane n ⋅ ( r − r 0 ) = 0 is given by
d = n ⋅ n ∣ n ⋅ ( q − r 0 ) ∣
In this problem, I generalize the formula to R n , and to multiple hyperplanes.
So consider the point q = ( 3 , 3 , 4 , 4 , 5 ) ∈ R 5 , we want to find the minimum distance between q and a point x = ( x 1 , x 2 , x 3 , x 4 , x 5 ) ∈ 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 = 1 0
3 x 1 + 2 x 2 − 4 x 3 + 5 x 4 + 6 x 5 = 2 0
Report your answer rounded to 3 decimal places.
Details and Assumptions:
d = ( x − q ) ⋅ ( x − q ) = ( x − q ) T ( x − q )
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.
Problem Loading...
Note Loading...
Set Loading...
The problem can be stated as follows:
Minimize ( x − q ) T ( x − q ) , 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 )
where m is the Lagrangian multipliers vector. Then, the gradient with respect to x is
∇ x g = 2 ( x − q ) + A m = 0 ⋯ ⋯ ( 1 )
and the gradient with respect to m is
∇ m g = A T x − b = 0 ⋯ ⋯ ( 2 )
From (1), we obtain,
x = q − ( 1 / 2 ) A m ⋯ ⋯ ( 3 )
Substituting this into (2),
A T ( q − ( 1 / 2 ) A m ) − b = 0
− ( 1 / 2 ) A T A m = b − A T q
Therefore,
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 )
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 )
And this is the generalized formula. What remains is to substitute the given values to obtain f min = 7 . 2 5 4