# lagrange multiplier with interval constraint

Given a function $g(x,y,z)$ we need to maximize it given constraints $a<x<b, a<y<b$.

If the constraints were given as a function $f(x,y,z)$ the following equation could be used.

$\nabla f(x,y,z) = \lambda \nabla g(x,y,z)$

How would I set up the initial equation given an interval constraint. Or how would I turn the interval constraint into a function constraint.

EDIT:: Added $a<y<b$ to the constraints.

-
Hint: consider a function such as $(x-(a+b)/2)^2$ –  Jonathan Christensen Nov 10 '12 at 19:51

Maximize $g$ ignoring the constraint. If the solution fulfills the constraint, you're done. If not, there's no maximum, since it would have to lie on the boundary, but the boundary is excluded by the constraint.
@Kassym: I don't see how it could make sense for the question to specifically ask to use a Lagrange multiplier. Even if the constraint were $a\le x\le b$, so you could find a maximum on the boundary, you'd still just have to substitute $a$ and $b$ for $x$ -- the only situation in which you'd need a Lagrange multiplier would be if the constraint were of the form $a\le f(x,y,z)\le b$; then, if the unconstrained maximization wouldn't yield a maximum satisfying the constraint, you could find the maximum on the boundary by setting $f(x,y,z)$ to $a$ and $b$ and then using a Lagrange multiplier. –  joriki Nov 10 '12 at 19:52