# Lagrange Multipliers with Two Constraints

Thus far we have solved problems regarding finding extreme values of a function $f$ restricted to a constraint function $g$. Of course, we can extend the concept of Lagrange Multipliers to finding the extreme values of a function $f$ restricted to two constraint functions, say $g$ and $h$.

For example, suppose that we want to find the extreme values of the function $w = f(x, y, z)$ subject to the constraint equations $g(x, y, z) = C$ and $h(x, y, z) = D$. We note that since $w = f(x, y, z)$ is a three variable real-valued function, then the domain of $f$ is a subset of $\mathbb{R}^3$. In particular, we note that $g(x, y, z) = C$ is a level surface to the three variable real-valued function $w = g(x, y, z)$, and $h(x, y, z) = D$ is a level surface to the three variable real-valued function $w = h(x, y, z)$. Thus, we are looking for extreme values of $f$ when the points $(x, y, z) \in D(f)$ are subject to lie on both the level surfaces $g(x, y, z) = C$ and $h(x, y, z) = D$, that is, the curve of intersection between these level surfaces.

If $P(x_0, y_0, z_0)$ is a point that produces an extrema of $f$ when restricted to the curve of intersection of these two level surfaces, then the gradient of $f$ at $(x_0, y_0, z_0)$ will be perpendicular to the curve of intersection.

Now recall from The Perpendicularity of The Gradient at a Point on a Level Curve page that if we have a two variable real-valued function, then the gradient of this function at a point in its domain will be perpendicular to the level curve that passes through this point in the domain. As a higher-dimensional analogue to the theorem presented on that page - if we have a three variable real-valued function, then the gradient of this function at a point in its domain will be perpendicular to the level surface that passes through this point in the domain.

From this, we note that $\nabla g$ is perpendicular to the level surface $g(x, y, z) = C$, and $\nabla h$ is perpendicular to the level surface $h(x, y, z) = D$. Therefore $\nabla f$ will be contained in the plane spanned by $\nabla g$ and $\nabla h$.

Since $\nabla f$ is contained in the plane spanned by these two vectors, then we must have that the gradient of $f$ at $(x_0, y_0, z_0)$ is a linear combination of the gradient of $g$ at $(x_0, y_0, z_0)$ and the gradient of $h$ at $(x_0, y_0, z_0)$, that is for some $\lambda, \mu \in \mathbb{R}$:

(1)Using the Method for Lagrange multipliers, all we need to do is solve the following system of equations for $x$, $y$, and $z$:

(2)In this case, the we have two Lagrange multipliers, $\lambda$ and $\mu$, which may not need to be solved for in order to find points for which $f$ attains extrema subject to the constraints of $g$ and $h$.