 Now, before we get too comfortable with Lagrange multipliers, we note that if the constraint function f is nonlinear, lambda times the gradient will contain nonlinear terms. And likewise, if the objective function l is not linear or quadratic, the gradient of l will contain nonlinear terms. And so, in general, the equation that we're trying to solve will generally be a nonlinear system of equations. And the problem is these are extremely hard to solve algebraically, although numerical solutions do exist. Now, we can deal with this difficulty in one of two ways. First, we can focus on the cases where the system of equations can be solved by hand, or we can focus on more realistic problems. Now, since you'll probably have to solve optimization problems outside of a math class, and this is true even if you're a professional mathematician, then we'll focus on the setup and let a computing device solve the equations. So, for example, let's set up the system of equations needed to find the point on an ellipse that is closest to a point in the plane. So, since we're on the ellipse, we require that x squared plus 4y squared equals 16. That's what being on the ellipse means. Now, since all of our variables are on one side, we can define a function of two variables, x squared plus 4y squared, and our constraint then becomes f of x, y equals 16. The distance from a point x, y on the ellipse to the point 3, 8 will be... And again, as this is minimized, so will it square, so it's easier and better to work with our objective function. So, we want our gradient of our objective to equal lambda times the gradient of our constraint, so we'll find those partial derivatives. And if we compare the components, we get two equations. Additionally, since our point has to be on the ellipse, we have the equation of the ellipse as our third equation, and now we have our system of three equations and three unknowns. Now, we can try to solve this, but if we do that, we actually obtain a fourth-degree equation where there are two real solutions. And by the geometry, if you consider what this ellipse looks like and where that point is, it's easy to see that the point 1.626, 1.827 is closest to 3.8, while the other point is farthest. Or, suppose you want to make a box with a constant volume and the material for the top and bottom cost differently than the material for the sides. And we want to set up the system of equations needed to minimize the cost of the box. So, if you want x, y, and z to be the length, width, and height of the box, we want the volume, the product, to be 240. And so our constraint can be expressed as v of x, y, z equals 240, where v of x, y, z is x, y, z. Now, we're trying to minimize the cost, so let's explode the box and determine what our cost function is. The top and bottom of the box have area x, y, so the cost will be the left and right sides have area x, z, so the cost will be, and the front and back have area y, z, so the cost will be. And we're trying to minimize this total cost, so that will be our objective function. And we want the gradient of our objective to be lambda times the gradient of our constraint. So we find those partial derivatives, and that gives us the vector equation. Comparing the components gives us the system of equations. Now, there's four unknowns, x, y, z, and lambda, so we need a fourth equation, and the requirement that the volume be 240 gives us that fourth equation. And at this point we have set up the system of equations to be solved, and we can pass this off to a mechanical device. The problem is that if we try to solve this system algebraically, we end up with a third-degree equation. And so we can solve this numerically, and there's only one real solution, and you should convince yourself that this does actually give us a minimum value of the cost.