# Is it possible to solve this question with Lagrange Multipliers?

What is the shortest distance from the surface $$π₯π¦+15π₯+π§^2=209$$ to the origin?

My professor wasn't able to solve it with Lagrange multipliers when I asked him.

The easy way to solve it without Lagrange multipliers was solving for $$z^2$$ and then plugging it into the distance formula squared $$D^2 = x^2 + y^2 + z^2$$ because when distance squared is minimum, distance is also minimum.

However, it seems a lot harder to solve through Lagrange multipliers.

We need to minimize $$f(x,y,z)=x^2+y^2+z^2$$ with the constraint $$\phi(x,y,z)=π₯π¦+15π₯+π§^2-209=0$$ therefore we have

• $$2x=(y+15)\lambda$$
• $$2y= x\lambda$$
• $$2z= 2z\lambda \implies \lambda=1 \lor z=0$$

for $$z=0$$ we obtain

• $$2x=(y+15)\lambda$$
• $$2y= x\lambda \implies2y=x\frac{2x}{y+15}\implies 2(y+15)=x\frac{2x}{y+15}+30$$
• $$π₯π¦+15π₯-209=0 \implies x(y+15)=209$$

and by $$y+15=t$$ we need to solve

• $$2t^2-30t=2x^2$$
• $$tx=209$$

that is

$$2t^4-30t^3-2\cdot 209^2=0$$

for $$\lambda=1$$ we obtain

• $$2x=(y+15)$$
• $$2y= x$$
• $$π₯π¦+15π₯+z^2-209=0$$
• I still get stuck on solving for the case of z=0. What would you do with that case. Nov 12, 2019 at 16:00
• @ebehr Yes indeed it is not a simple case. We can obtain an equation of 4th degree.
– user
Nov 12, 2019 at 16:32

Solving with the Lagrange multipliers is also easier when you use minimization relative to squared distance rather than just distance -- the square roots do create some complications. (In fact, minimization allows you to replace any objective function with another that produces the same ordering of "heights".)

For Lagrangian $$\mathcal{L} = x^2 + y^2 + z^2 +\lambda(xy+15x+z^2-209) \text{,}$$ we find \begin{align*} \frac{\partial\mathcal{L}}{\partial x} &= 2x+(15+y)\lambda \\ \frac{\partial\mathcal{L}}{\partial y} &= 2y + x \lambda \\ \frac{\partial\mathcal{L}}{\partial z} &= 2z(1+\lambda) \\ \frac{\partial\mathcal{L}}{\partial \lambda} &= 15 x + xy + z^2 - 209 \text{.} \end{align*} From the partial derivative with respect to $$z$$, $$\mathcal{L}$$ is stationary only if $$z = 0$$ or $$\lambda = -1$$. From the partial derivatives with respect to $$x$$ and $$y$$, we can solve for $$x$$ and $$y$$: if $$\lambda^2 -4 \neq 0$$, $$x = \frac{30 \lambda}{\lambda^2 - 4}$$ and $$y = \frac{-15 \lambda^2}{\lambda^2 - 4}$$.

Our first attempt at a solution is $$15 \frac{30 \lambda}{\lambda^2 - 4} + \frac{30 \lambda}{\lambda^2 - 4} \cdot \frac{-15 \lambda^2}{\lambda^2 - 4} + (0)^2 - 209 = 0 \text{,}$$ which, after much manipulation, gives that $$\lambda$$ is any of the four roots of $$209\lambda^4 - 1672\lambda^2 + 1800 \lambda + 3344$$. Since neither $$\lambda = 2$$ nor $$\lambda = -2$$ are roots of this polynomial, we may use our rational expressions for $$x$$ and $$y$$. From this, $$x$$ is any root of $$x^4+3135x-43681$$, $$y = \frac{x^3}{209}$$, and $$z = 0$$. (There is a correspondence between choices of root for $$\lambda$$ and choices of root for $$x$$, but since $$\lambda$$ is not a coordinate of a solution, we do not consider it further.)

Our other attempt starts from $$\lambda = -1$$. Solving $$\{ 2x - (15+y) = 0, 2y - x = 0\}$$ gives $$x = 10$$, $$y = 5$$. Placing those into the constraint (the partial derivative with respect to $$\lambda$$), we obtain $$z = \pm 3$$

So we have five candidate minima:

• $$\lambda = -3.0160\dots$$, $$x = -17.753\dots$$, $$y = -26.772\dots$$, $$z = 0$$, with squared distance $$1031.9\dots$$,
• $$\lambda = -1.0187\dots$$, $$x = 10.318\dots$$, $$y = 5.2558\dots$$, $$z = 0$$, with squared distance $$134.98\dots$$,
• $$\lambda = 2.0174\dots \pm 1.0664 \mathrm{i}$$, both of which we ignore because the resulting $$x$$, $$y$$, and squared distance are not real.
• $$\lambda = -1$$, $$x = 10$$, $$y = 5$$, and $$z = \pm 3$$, with squared distance $$134$$.

As we can see, the minimum distance is $$\sqrt{134}$$, attained at $$(x,y,z) = (10,5,\pm 3)$$.

This can be done with the usual distance formula (not squared distance, as was done above). It is wise to replace $$\sqrt{x^2 + y^2 + z^2}$$ with a shorter name, perhaps "$$\alpha$$" during algebraic manipulations (while always remembering $$\alpha$$ contains $$x$$s, $$y$$s, and $$z$$s). Doing this, $$\mathcal{L} = \sqrt{x^2 + y^2 + z^2} +\lambda(xy+15x+z^2-209) \text{,}$$ we find \begin{align*} \frac{\partial\mathcal{L}}{\partial x} &= \frac{x}{\alpha}+(15+y)\lambda \\ \frac{\partial\mathcal{L}}{\partial y} &= \frac{y}{\alpha} + x \lambda \\ \frac{\partial\mathcal{L}}{\partial z} &= z \left( \frac{1}{\alpha} + 2\lambda \right) \\ \frac{\partial\mathcal{L}}{\partial \lambda} &= 15 x + xy + z^2 - 209 \text{.} \end{align*}

Without "unwrapping" $$\alpha$$, the same procedure as above gives:

• $$\alpha + 1/\lambda = 0$$, $$x = 10$$, $$y = 5$$, and $$z = \pm 3$$, or
• $$\alpha\lambda$$ is any root of $$209t^4 - 418t^2 + 225t + 209$$, $$x = \frac{209}{15}(1-(\alpha \lambda)^2)$$, $$y = \frac{209}{15} (\alpha \lambda)( (\alpha \lambda)^2 - 1)$$, and $$z = 0$$.

This is the same set of five potential solutions (again, two roots aren't real, so we reject them quickly) as above.