Maximize the distance to the origin of a function with four variables given the constraints:

\begin{align} xyza &= 1 \\ x + y + z + a &= 4 \end{align}

Here's my solution: We maximize $f(x,y,z,a) = x^2+y^2+z^2+a^2$ subject to the given constraint equations. The Lagrange multiplier method yields six equations with six variables.

\begin{align} 2x &= \lambda_1yza+\lambda_2\\ 2y &= \lambda_1xza+\lambda_2\\ 2z &= \lambda_1xya+\lambda_2\\ 2a &= \lambda_1xyz+\lambda_2\\ xyza &= 1\\ x + y + z + a &= 4 \end{align}

Mathematica is unable to solve this system. Is there something wrong in the question (I made it up) itself? Thanks!

  • 1
    $\begingroup$ Well, it has the solution $x=y=z=a=\lambda_1=\lambda_2=1$... $\endgroup$ – Brandon Mar 4 '16 at 4:40
  • $\begingroup$ Yes, well spotted. Is that the optimal solution in this case? Also, out of curiosity, can it be possible that my two constraint equations conspire to give no possible solution? $\endgroup$ – user1936752 Mar 4 '16 at 4:43
  • $\begingroup$ The problem is the solution is not unique for $\lambda_1, \lambda_2$ because the intersection of the constraints is exactly tangential so Mathematica cannot solve it uniquely since there is no such a thing. $\endgroup$ – Hamed Mar 4 '16 at 4:50
  • $\begingroup$ There is no solution. $\endgroup$ – copper.hat Mar 4 '16 at 5:48
  • 1
    $\begingroup$ If $x, y, z, a > 0$, then there is only one point which satisfies the system, viz. $x=y=z=a=1$, so that's a trivial maximum/minimum. If negatives are allowed, the feasible region is unbounded, so there is no maximum distance. $\endgroup$ – Macavity Mar 4 '16 at 6:40

The question is ill posed.

One of the first things you should do before applying Lagrange is to verify that there is indeed a solution. There is no solution in this case.

Fix $z=-1$, then look for solutions of $x+y-1-{1 \over xy} = 4$. Multiplying across by $x$ gives $x^2+x (y-5) -{1 \over y} = 0$, which has a solution $x= {1 \over 2} (5-y -\sqrt{(y-5)^2+{4 \over y}})$.

Letting $y \to \infty$ there are solutions, hence the distance to the origin is unbounded.

  • $\begingroup$ This is nice but apart from the intuition of knowing that it was unbounded for negative numbers, is there a systematic way to verify that there is indeed a solution? $\endgroup$ – user1936752 Mar 4 '16 at 7:15
  • 1
    $\begingroup$ In general, no. $\endgroup$ – copper.hat Mar 4 '16 at 7:44

If you forget the first constraint, and instead minimize the distance to the origin from the hyperplane $x + y + z + a = 4$, your equations will look like: \begin{align*} 2x & = \lambda_1 \\ 2y & = \lambda_1 \\ 2z & = \lambda_1 \\ 2a & = \lambda_1 \\ 4 & = x + y + z + a \end{align*} This gives the unique solution $x = y = z = a = 1$. (You might have guessed this, since $\langle 1, 1, 1, 1 \rangle$ is the normal vector and also represents a point on the plane.)

In any case, adding a second constraint cannot possibly decrease the minimum distance to the origin, and since $(1,1,1,1)$ also lies on the hypersurface represented by your first constraint, it must be the unique solution.

EDIT: Sorry, just realized you wanted to maximize. Still, you can solve the system you wrote. We know from equation 5 that $x,y,z,a$ are nonzero, so we can multiply the first equation by $x$, the second by $y$, etc. Using the 5th equation to simplify gives: \begin{align*} 2x^2 & = \lambda_2x \\ 2y^2 & = \lambda_2y \\ 2z^2 & = \lambda_2z \\ 2a^2 & = \lambda_2a \\ \end{align*} We can divide each by its respective variable (again since they are all nonzero) to get $x=y=z=a=\frac{\lambda_2}{2}$, and again we get the unique solution $(1,1,1,1)$. This may be the only point at which your constraints intersect.


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.