Given a point $P:(x_0,y_0)$ in $\mathbb{R}^2$, and a constraint function $$x^2+y^2=R^2$$where $R$ is the radius of the circle. The distance from $P$ to any point on the circle is to be minimized using the method of Lagrange Multiplier. The distance $d$ is given by $$d(x,y)=\sqrt{(x-x_0)^2+(y-y_0)^2}.$$ Then the Lagrange function becomes $$\mathcal{L}(x,y,\lambda)=d(x,y)+\lambda\ (x^2+y^2-R^2)$$ with the optimality conditions $\partial_x\mathcal{L}=0$, $\partial_y\mathcal{L}=0$ and $\partial_\lambda\mathcal{L}=0$. These conditions yield: $$\left[(x-x_0)^2+(y-y_0)^2\right]^{-\frac{1}{2}}(x-x_0)+2\ \lambda\ x=0$$ $$\left[(x-x_0)^2+(y-y_0)^2\right]^{-\frac{1}{2}}(y-y_0)+2\ \lambda\ y=0$$ $$x^2+y^2-R^2=0$$ How should I continue from this point?
Lagrange Multiplier Problem - Distance from point With a Circle Constraint
3.6k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 4 best solutions below
On
HINT:
As $d(x,y)\ge 0, d(x,y)$ will be minimum if $d^2(x,y)$ is minimum
So, start with $$\mathcal{L}(x,y,\lambda)=d^2(x,y)+\lambda\ (x^2+y^2-R^2)=(x-x_0)^2+(y-y_0)^2+\lambda\ (x^2+y^2-R^2)$$
On
$\left[(x-x_0)^2+(y-y_0)^2\right]^{-\frac{1}{2}}(x-x_0)=-2\ \lambda\ x$
$\left[(x-x_0)^2+(y-y_0)^2\right]^{-\frac{1}{2}}(y-y_0)=-2\ \lambda\ y$
$\dfrac{x}{x-x_0}=\dfrac{y}{y-y_0} \ = \ -\dfrac{1}{2\lambda}\left[(x-x_0)^2+(y-y_0)^2\right] \ \to \ x(y-y_0)=y(x-x_0) $
$ \to \ xy_0=yx_0 \ \to \ x^2=\dfrac{(x_0R)^2}{x_0^2+y_0^2} \ , \ y^2=\dfrac{(y_0R)^2}{x_0^2+y_0^2} $
On
I thought it might be worth remarking on the geometric interpretation of the result, since we have two extrema for the distance function of points on the circle measured from the external point $ \ (x_0 \ , \ y_0) \ . $
I made the Lagrange calculation in a fashion somewhere between that of chenbai and lab bhattacharjee , extremizing the "distance-squared" function:
$$ f(x,y) \ = \ (x - x_0)^2 \ + \ (y - y_0)^2 \ \ , \ \ g(x,y) \ = \ x^2 \ + \ y^2 \ - \ R^2 $$
$$ \Rightarrow \ \ 2·(x - x_0) \ \ = \ \ \lambda · 2x \ \ \ , \ \ \ \ 2·(y - y_0) \ \ = \ \ \lambda · 2y $$
$$ \Rightarrow \ \ \lambda \ \ = \ \ \frac{x - x_0}{x} \ \ = \ \ \frac{y - y_0}{y} \ \ \Rightarrow \ \ xy \ - \ x_0y \ \ = \ \ xy \ - \ y_0x $$ $$ \Rightarrow \ \ \frac{y}{x} \ = \ \frac{y_0}{x_0} \ \ \ \text{or} \ \ \ y \ \ = \ \ \frac{y_0}{x_0} \ x . $$
Something we notice immediately is that the line through the center of the circle to $ \ (x_0 \ , \ y_0) \ $ is the line which contains the solution points on the circle that are closest and farthest from the external point. [chebai comments to the OP concerning this.] This is reasonable because that line contains the radii from the origin to the solution points, so it is perpendicular to the circumference of the circle (hence, in the direction of the gradient $ \ \nabla g \ $ ) .
Inserting this result into the constraint equation, we obtain
$$ x^2 \ + \ \left(\frac{y_0}{x_0} \ x \right)^2 \ = \ R^2 \ \ \Rightarrow \ \ x^2 \ \ = \ \ \left( \frac{x_0^2}{x_0^2 \ + \ y_0^2} \right) \ R^2 $$ $$ \Rightarrow \ \ x \ \ = \ \ \pm \left( \frac{R}{\sqrt{x_0^2 \ + \ y_0^2}} \right) \ x_0 \ \ = \ \ \pm \frac{R}{\rho} \ x_0 \ \ \ , \ \ \ y \ \ = \ \ \pm \frac{R}{\rho} \ y_0 \ \ , $$
where $ \ \rho \ = \ \sqrt{x_0^2 \ + \ y_0^2} \ $ is the distance of the external point from the center of the circle. The extremal points are symmetrically positioned in opposite quadrants on a diameter of the circle. [Note that this suggests how the coordinates of the extremal points could be generalized for a circle not centered on the origin, without needing to re-work the Lagrangian calculation.]
The extremal distances of $ \ (x_0 \ , \ y_0) \ $ from the circle are thus found from
$$ D^2 \ \ = \ \ \left(\pm \frac{R}{\rho} \ x_0 \ - \ x_0 \right)^2 \ + \ \left(\pm \frac{R}{\rho} \ y_0 \ - \ y_0 \right)^2 \ \ = \ \ \left(\pm \frac{R}{\rho} \ - \ 1 \right)^2 \ · \ (x_0^2 \ + \ y_0^2) \ \ = \ \ \left( \frac{\rho \ \mp \ R}{\rho} \right)^2 \ · \ \rho^2 $$ $$ \Rightarrow \ \ \ D \ \ = \ \ | \ \rho \ \mp \ R \ | \ \ , $$
as we would expect from the geometrical arrangement.
Finally, there is almost no restriction in this calculation on the location of the point $ \ (x_0 \ , \ y_0) \ $ relative to the origin; the point could as easily be within the circle to use these results. If this point is on the circle, we have $ \ \rho \ = \ R \ \ \rightarrow \ \ x_0 \ = \pm x_0 \ \ , \ \ y \ = \pm \ y_0 \ , \ D \ = \ 0 \ , \ 2R \ \ . $ There is no difficulty with a point $ \ (x_0 \ , \ 0) \ $ ; if the point lies on the $ \ y-$ axis, we do not use the ratio, but return to $$ \ x_0y \ = \ y_0x \ \rightarrow \ 0·y \ = \ y_0·x \ \ \Rightarrow \ \ x \ = \ 0 \ \ , \ \ y \ = \ \pm \left( \frac{R}{\sqrt{ y_0^2}} \right) \ y_0 \ \ = \ \pm R \ \ . $$ It is only if we place the point at the origin that the formulas fail, since we have $ \ \frac{y}{x} \ = \ \frac{0}{0} \ $ and $ \ \rho \ = \ 0 \ . $ We can interpret the ambiguity of the ratio as meaning that extremal points on the circle lie in every direction at the distance $ \ D \ \ = \ \ | \ 0 \ \mp \ R \ | \ = \ R \ $ from this point.
This discussion can be readily extended to a point and $ \ n- $ sphere in $ \ \mathbb{R}^n \ \ . $ We find that the Lagrange method confirms our geometrical intuition.
Accepting @lab's hint, the Lagrange function can be rewritten as $$\mathcal{L}(x,y,\lambda)=d^2(x,y)+\lambda\ (x^2+y^2-R^2)=(x-x_0)^2+(y-y_0)^2+\lambda\ (x^2+y^2-R^2)$$ Then the optimality conditions would become $$\partial_x\mathcal{L}=2(x-x_0)+2x\lambda=0,\ \partial_y\mathcal{L}=2(y-y_0)+2y\lambda=0$$ $$\partial_\lambda\mathcal{L}=x^2+y^2-R^2=0$$ The first two conditions yield $$x=\cfrac{x_0}{1+\lambda},\ y=\cfrac{y_0}{1+\lambda}\tag{1}$$ These can be substituted in the third condition to obtain $$\cfrac{x_0^2+y_0^2}{(1+\lambda)^2}=R^2$$ Solving for $\lambda$ yields $$\lambda=\left[\cfrac{x_0^2+y_0^2}{R^2}\right]^{\frac{1}{2}}-1$$ $\lambda$ can be substituted in Equation 1 to obtain $$(x,y)=\left(x_0 \left[\cfrac{x_0^2+y_0^2}{R^2}\right]^{\frac{-1}{2}},\, y_0 \left[\cfrac{x_0^2+y_0^2}{R^2}\right]^{\frac{-1}{2}}\right)$$ This point represents the point closest to $P$ and the minimum distance can be found by using the original function $$d(x,y)=\sqrt{(x-x_0)^2+(y-y_0)^2}.$$