This Demonstration illustrates the 2D case, where in particular, the Lagrange multiplier

is shown to modify not only the relative slopes of the function

to be minimized and the rescaled constraint

(which was already shown in the 1D case), but also their relative orientations (which do not exist in the 1D case).

This in turn shows how the independence of

and

is restored by the introduction of

(which is adjusted so that

and

are strictly parallel in both slope and orientation, so that their height difference

remains constant near the solution, with no more constraint between

and

).

The global problem can be understood as finding a point that is:

1. on the particular contour line

, and

2. on a contour line

or

(the constant is unknown, as the contour line is what we are looking for) tangent to the previous one.

By imposing

(for any

), we impose that

and

share the same orientation but with different relative slopes (depending on

).

is then a tuning tool to find the place where the functions

and

have the same slope (strict parallelism) and hence where the potential

is an extremum (equilibrium situation).

Here are a few explanations for each of the four plots displayed:

• upper-left: this is the case treated without the Lagrange multiplier. The thick blue line is the constraint, the thick red line is its projection on

, and the solution is the top of the red thick line.

• upper-right: this is the case treated with the help of

. The constraint function

is rescaled (

), but as

, the constraint (thick blue line) keeps the same position as in the previous case. The function

plotted in green is the new potential, which is to be optimized without constraint on

. When equilibrium is forced, its extremum corresponds to the solution of the problem. When equilibrium is not forced, it is a function of the three variables

,

,

.

• bottom-left: same as upper-right, but with a contour representation, which shows more clearly the contour lines and the extremums of the three functions involved. The orange point is the one given by the 2D slider. When equilibrium is forced, it shows the solution of the problem (top of the green function

); otherwise it can be used to explore the slopes with the bottom-right panel.

• bottom-right: this is a close-up (tangent planes) of the plots of the three functions involved around the position (orange point) chosen by the 2D slider. It allows a comparison between their slopes. In particular, when

,

and

have the same orientation but different slopes (this amounts to the 1D problem), and near the solution, they become completely parallel. When

, their orientations are different. When equilibrium is forced, their slopes remain parallel, hence

remains horizontal (constant).

When forcing equilibrium, you can only change

(then

,

, and

are the computed unique solution of the problem).

With the equilibrium box unchecked, you can change

(a slider) and

(2D slider) to get a feeling of how they act and what they mean.