I need to find minimum of objective function $Q=f(x,y,z)$ inside a cube region. Hence the constraints are in the form $0 \leq x \leq 1$ and $0 \leq y \leq 1$ and $0 \leq z \leq 1$. Should the Lagrangian be

$$ L = Q + \lambda_1(x) + \lambda_2(1-x) + \lambda_3(y) + \lambda_4(1-y) + \lambda_5(z) + \lambda_6(1-z) $$

All the examples I've seen have constraints on one side, such as $x\leq 1$, but what to do when the constraints have inequality on both sides? In general, how do I constraint the $Q$ for minimization inside 3D object such a cube.


An example $Q= n-z-x-y+x^2+y^2$ where $n$ is a number. and I want to find its min in a cube, hence constraints are the sizes of each of the three edges as given above. Just need to know how to write the constraints.


There is no one Lagrangian that will solve this problem. The minimum could be:

  • inside the cube
  • on one of the faces
  • on one of the edges
  • on one of the corners

That's $1 + 6 + 12 + 8 = 27$ different cases. In general, you would have to solve each case, and reject all solutions that are not in the cube or on its surface. But perhaps your $Q$ allows some simplifications. Is $Q$ fixed? Or perhaps the second derivative matrix is positive definite?

  • $\begingroup$ $Q$ is fixed. It is function of $x,y,z$, but not linear. it has terms in it such as $x^2$ and $y^2$. How can I then write the constraints such that they indicate Q is only inside the cube? Let us forget the surfaces and corners for now. Don't I need to use inequality on both sides to do this? strange that I am not able to find one example like this so far. $\endgroup$ – Steve H Dec 8 '14 at 11:31
  • $\begingroup$ It would help if you told us what $Q$ is. In general, you can't use Lagrange multipliers to minimise over ranges like this; but perhaps the form of $Q$ admits simplifications. $\endgroup$ – TonyK Dec 8 '14 at 14:10
  • $\begingroup$ fyi, just added an example of $Q$. $\endgroup$ – Steve H Dec 8 '14 at 19:31

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.