Distance between a line given by planes and origin by Lagrange's multiplier.

Find the minimum distance of the line given by the planes $$3x+4y+5z=7$$ and $$x-z=9$$ from the origin, by the method of Lagrange’s multipliers.

As-

Is it ok to take the Lagrange functions as given below?

$$F(x,y,z)= x^2 + y^2 + z^2 + k(3x+4y+5z-7)+ m (x-z-9)$$

• It's o.k., but for God's sake don't use the letters $k$ and $m$ for real auxiliary variables. Use $\lambda$ and $\mu$, or similar, instead. – Christian Blatter Oct 30 '18 at 16:40
• Can you explain why such a function works? – Mittal G Oct 30 '18 at 16:41

When God created the world the point $$(x,y,z)$$ moved freely in $$3$$-space. In the problem at hand it is stipulated that this point shall a priori satisfy two equations, namely $$3x+4y+5z-7=0\>,\qquad x-z-9=0\ .\tag{1}$$ The problem asks for the admissible point $$(x,y,z)$$ for which the value $$f(x,y,z):=x^2+y^2+z^2$$ is minimal. The Lagrange gospel then tells you to set up (purely formally) the function $$F(x,y,z,\lambda,\mu):=x^2+y^2+z^2-\lambda(3x+4y+5z-7)-\mu(x-z-9)\ ,$$ and solve the system of five equations $${\partial F\over\partial x}=0,\quad {\partial F\over\partial y}=0,\quad {\partial F\over\partial z}=0\quad\wedge\quad(1)$$ for $$x$$, $$y$$, $$z$$, whereby the values of $$\lambda$$ and $$\mu$$ sometimes jump out as well, but may be thrown away. Go back to your textbook in order to find out why this works. But I'm sure it has been explained on MSE many times as well.