0
$\begingroup$

I need to find the minimal distance between a point $(x_0,y_0)$ and a line $ax+by = c$ for some constants $a,b,c ∈ ℝ$ using the Lagrange Multiplier Method.

Knowing the distance between two points, $(x_0,y_0)$ and $(x,y)$ is given by the following equation, I know that I need to minimise this equation.

$D = \sqrt{(x-x_0)^2 + (y-y_0)^2)}$

I also know that $D_{min}$ = $D^2_{min}$ , which will make it easier to use the Lagrange Method since I can "discard" the square root.

Then I let:

$f(x,y) = D^2 = (x-x_0)^2 + (y-y_0)^2$

Since this distance must be on the line $ax + by = c$ , I set my constraint:

$G(x,y) = ax + by - c = 0$

Then:

$∇f = <2x-2x_0, 2y-2y_0> ; ∇G = < a, b >$

Using the Lagrange Method for some constant $λ$, we have:

$∇f = λ∇G \Rightarrow < 2x-2x_0, 2y-2y_0 > = λ < a, b>$

Eliminating $λ$, we have:

$y = y_0 + \frac ba (x-x_0)$

Plugging this into my original constraint, $G(x,y)$, we have:

$G(x,y) = ax + b(y_0 + \frac ba (x-x_0)) = 0$

Solving for $x$, we have:

$x = \frac { c+ \frac {b^2}{a}{x_0} - by_0 }{a + \frac {b^2}a}$

Plugging back in once more, we have:

$y = \frac ba \left( \frac { c+ \frac {b^2}{a}{x_0} - by_0 }{a + \frac {b^2}a} \right) - \frac ba{x_0} + y_0$

The Hessian seems to confirm that any critical point of $f$ will be a local maximum of $f$, but the overall complexity of the point I found is making me question whether I took the right approach.

If I plug back these coordinates into $D$, I should get the minimum distance.

$D = \sqrt{\left(\frac { c+ \frac {b^2}{a}{x_0} - by_0 }{a + \frac {b^2}a}-x_0\right)^2 + \left(\frac ba \left( \frac { c+ \frac {b^2}{a}{x_0} - by_0 }{a + \frac {b^2}a} \right) - \frac ba{x_0})^2\right)}$

This seems unnecessarily complicated and wrong. Where did I go wrong (if I did)?

$\endgroup$
  • $\begingroup$ Have you tried simplifying that horrendous-looking expression that you got for $x$ before proceeding? If nothing else, your solution is undefined when $a=0$. $\endgroup$ – amd Oct 18 '18 at 23:51
0
$\begingroup$

Let me restart the problem from scratch.

You want to minimize $$F=(x-x_0)^2+(y-y_0)^2+\lambda (a x+b y-c)\tag 1$$ Computing the partila derivatives with respect to $x$ and $y$ and setting them equal to $0$ gives $$\frac{\partial F}{\partial x}=2(x-x_0)+a \lambda=0 \implies x=x_0-\frac 12 a \lambda\tag 2$$ $$\frac{\partial F}{\partial y}=2(y-y_0)+b \lambda=0 \implies y=y_0-\frac 12 b \lambda\tag 3$$ Now $$\frac{\partial F}{\partial \lambda}=ax+by-c=-\frac{1}{2} \lambda \left(a^2+b^2\right)+a {x_0}+b {y_0}-c\tag 4$$ $$\frac{\partial F}{\partial \lambda}=0 \implies \lambda=\frac{2 (a {x_0}+b {y_0}-c)}{a^2+b^2}$$ So, from $(2)$ and $(3)$, after simplifications $$x=\frac{b^2 {x_0}-a b {y_0}+a c}{a^2+b^2}\qquad \text{and} \qquad y=\frac{a^2 {y_0}-a b {x_0}+b c}{a^2+b^2}$$ making after simplifications

$$(x-x_0)^2+(y-y_0)^2=\frac{(ax_0+by_0-c)^2}{a^2+b^2}$$ which is the square of the well known distance of a point to a straight line.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.