Lagrange multipliers (3D)
About this app
Extrema under a constraint — a walking path on the function graph, gradient vectors of f and φ live, λ readable directly.
The idea behind Lagrange multipliers
We look for extrema of a function f(x, y) where the points must satisfy a constraint φ(x, y) = 0. At such an extremum you cannot improve f by moving along the constraint curve. Geometrically this means the gradient ∇f is perpendicular to the curve and therefore parallel to ∇φ. So there is a number λ, the Lagrange multiplier, with ∇f = λ∇φ. Together with φ = 0 this gives a system of equations for x, y and λ.
What the app shows
The surface is the graph of f(x, y) = −x²(eʸ − 2) + y², and the constraint is the circle φ(x, y) = x² + y² − 9 = 0. A point travels around the circle, and its projection onto the surface traces a hiking path. The gradient vectors ∇f and ∇φ are drawn live. As soon as they are parallel, the point changes colour and reports a constrained extremum; the values panel then shows λ.
Try it yourself
Move the point around the circle with the slider and watch the angle between the two gradients. “Auto” lets the point run on its own and pause briefly at extrema, and “Next extremum” jumps straight there. Notice that the path is locally highest or lowest at these spots, even though the surface itself need not be flat there. Drag with the mouse to rotate and scroll to zoom.
Frequently asked questions
- What is a Lagrange multiplier?
- The Lagrange multiplier λ is the number for which ∇f = λ∇φ holds at a constrained extremum. It turns a constrained optimisation into a system of equations. Its value describes how sensitive the optimal objective is to relaxing the constraint.
- Why are the gradients parallel at a constrained extremum?
- If ∇f had a component along the constraint curve, moving along the curve would still increase or decrease f. At the extremum that component is missing, so ∇f is perpendicular to the curve. Since ∇φ is also perpendicular to the curve, the two are parallel.
- How do you solve a problem with the Lagrange method?
- Set up ∂f/∂x = λ·∂φ/∂x, ∂f/∂y = λ·∂φ/∂y and φ(x, y) = 0. The solutions are the candidates for extrema. Comparing function values or further criteria tells which are maxima and which are minima.
- What does the app show at an extremum?
- The point on the path changes colour, the two gradients are parallel, and the values panel shows the corresponding multiplier λ. “Next extremum” jumps from one candidate to the next.
Subject: Analysis (multivariable)
More from Analysis (multivariable)
- Surfaces and contour lines (3D)
- Gradient and directional derivative (3D)
- Critical points (3D)
- Local extremum (3D)
- Multiple regression (3D)
- Optimum under a constraint: Lagrange (3D)
- Partial derivatives as cuts (3D)
- Stationary points: peak, valley or pass? (3D)
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps