Lagrange Multipliers and Inequalities

Is there a way to apply the method of Lagrangian Multipliers when your equation of constraint is an inequality(it won't be called an equation of constraint then I guess). Here is an example of what I came up with.

Say $\displaystyle f(x)=x^2$

You want to find the extrema satisfying the inequality $\displaystyle -1\le x\le1$

If you introduce a variable $\displaystyle z$ that satisfies the equation $\displaystyle x^2+z^2=1$ that means $\displaystyle x\in[-1,1]$

$\displaystyle g(x,z)=x^2+z^2=1$ becomes your equation of constraint. Now we have

$\displaystyle \nable f=\lambda\nabla g$ where $\displaystyle \nabla =\left(\dfrac{\partial}{\partial x},\dfrac{\partial}{\partial z}\right)$

We get $\displaystyle \left(2x,0\right)=\lambda\left(2x,2z\right)$

From $\displaystyle 2\lambda z=0$ we get $\displaystyle z=0$ or $\displaystyle \lambda=0$

From $\displaystyle 2x=2\lambda x$ we get $\displaystyle x=0$ or $\displaystyle \lambda=1$

For $\displaystyle x=0$ we get our minimum.

For $\displaystyle \lambda=1$ we have $\displaystyle z=0$ and $\displaystyle x^2=1\therefore x=\pm 1$ which is the local maximum.

Now what I want to know is, if there is a way to solve for more general inequalities like $\displaystyle x<3$ or $\displaystyle x>7$.

Any input will be appreciated.