Functions of several variables: Lagrange multipliers
The method of Lagrange multipliers (general)
In general, you can find an extreme value of a function of several variables under one or more side conditions using following method.
Lagrange multipliers Extreme values of the function \[f(x_1,\ldots,x_n)\] of \(n\) variables \(x_1,\ldots,x_n\) under the side conditions \[g_k(x_1,\ldots,x_n)=0\] with \(k=1,\ldots,m,\) can be calculated by identifying the critical points of the function \[h = f+\lambda_1\cdot g_1+\cdots+\lambda_m\cdot g_m\text.\] In other words, you must find the solutions in \(x_1,\ldots,x_n, \lambda_1,\ldots,\lambda_m\) of the following system of \(n+m\) equations \[\left\{\begin{aligned}\frac{\partial h}{\partial x_i} &=0,\quad\text{for } i=1,\ldots, n\\ \\ \frac{\partial h}{\partial \lambda_j} &=0,\quad\text{gor } j=1,\ldots, m\end{aligned}\right.\] The last equations are obviously nothing but the \(m\) constraints.
We set the system of equations to be satisfied by the crtitical points: \[\left\{\begin{aligned}0&=\frac{\partial h}{\partial x} = 2x+\lambda(34x+12y)\\ \\ 0&=\frac{\partial h}{\partial y} = 2y+\lambda(12x+16y)\\ \\ 0 &= \frac{\partial h}{\partial \lambda} = 17x^2+12xy+8y^2-100\end{aligned}\right.\] We can isolate the variable \(\lambda\) in the first two equations and set the two expressions for \(\lambda\) equal to each other; this gives \[\frac{-2x}{34x+12y}=\frac{-2y}{12x+16y}\text.\] But then \[-2x(12x+16y)=-2y(34x+12y)\text.\] This can be reduced to \[2x^2-3xy-2y^2=0\text.\] If we multiply the left- and right-hand sides of this equation with \(4\) and add to the third equation from the above system (the side condition) we get \[25x^2=100\] and thus \[x=\pm2\text.\] Substituting each these values into the equation \(2x^2-3xy-2y^2=0\) always yields a quadratic equation in \(y\):
For \(x=2\): \(\phantom{-}\) \(\quad y^2+3y-4=0\) and thus \((y-1)(y+4)=0\).
For \(x=-2\): \(\quad y^2+3y-4=0\) and thus \((y+1)(y-4)=0\).
There are four points: \((2,1)\) and \((-2,-1)\) are closest to the origin, and \((2,-4)\) and \((-2,4)\) are furthest away from the origin.