How this calculation works
A stationary point under a constraint need not be an unconstrained stationary point. This page restricts a quadratic objective to one regular affine line or one axis-aligned ellipse and solves the resulting stationary equations. The line case becomes an exact one-variable quadratic. The ellipse case becomes a trigonometric quadratic, whose half-angle derivative is an exact polynomial of degree at most four. Distinct real roots are isolated with Sturm counts, and the omitted half-angle point is checked separately.
∇f=λ∇g and g=0. On an ellipse, x=h+rx*cos(θ), y=k+ry*sin(θ); on a line, substitute an exact affine parameterization.A worked example
For f=x*y on x²+y²=1, the four stationary points have coordinates (±1/√2,±1/√2). Equal signs give maximum 1/2 and opposite signs give minimum −1/2. With g=x²+y²−1 and convention ∇f=λ∇g, the corresponding multipliers are +1/2 and −1/2. The same objective on the line x+y=1 has maximum 1/4 at (1/2,1/2), but no finite minimum because x(1−x) tends to −∞ along the line.
Good to know
Supports one quadratic objective with rational coefficients within ±10⁶ and a regular line or nondegenerate axis-aligned ellipse. Ellipse semiaxes range from 10⁻⁶ through 10⁶. Exact restriction and root counts support candidate completeness; ellipse coordinates, objective values, multipliers and second-derivative classifications are numerical. Ill-conditioned root evaluation can be rejected. Higher-order stationary types are left undetermined. General nonlinear constraints, multiple equalities and inequality-constrained optimization are outside this page’s family.
Reference: OpenStax — Lagrange multipliers and regular equality constraints (opens in a new tab) ↗
Enumerating every supported stationary candidate avoids relying on one numerical guess
A root finder started near one contact point can repeatedly find the same solution and miss another branch of the constraint. The ellipse method instead converts the angular derivative using t=tan(θ/2). Exact real-root counts identify all distinct finite roots of that polynomial, including roots of even multiplicity. The angle θ=π is not represented by a finite t and must be checked independently. Omitting that point would lose legitimate candidates on the leftmost part of the ellipse.
The default product objective gives four contacts, not just the first-quadrant maximum. For f=x²+2y² on the unit circle, the horizontal-axis points give minimum one and the vertical-axis points give maximum two. If the objective is x²+y² instead, it is constant at one on the entire circle. There are then infinitely many stationary points. The page reports a constant family and zero isolated candidates rather than presenting a few sampled points as the complete solution.
The Implicit differentiation calculator for first and second derivatives examines a local polynomial level curve rather than optimizing a quadratic along a full feasible constraint.
A compact ellipse and an unbounded line justify different global conclusions
A continuous quadratic attains both extrema on the compact ellipse, and every extremum of this regular constraint is among the complete stationary candidates. Comparing their values therefore supplies the numerical global range within the stated arithmetic limitations. The angular second derivative labels a local minimum or maximum when decisively nonzero. When it is numerically degenerate, the page does not infer a local type from that test alone, even if a global comparison still identifies a lowest value.
A feasible line has no such compactness guarantee. Substitution gives A*t²+B*t+C: a positive A proves one global minimum and unbounded growth above, a negative A proves one global maximum and unbounded behavior below, and A=0 requires inspecting B. If both vanish, the whole line is a stationary constant family. If only A vanishes, there is no stationary point and both directions are unbounded. A zero line normal or zero ellipse semiaxis is rejected because it would invalidate the regular constraint used by this method.
A few questions, answered
Why can the multiplier change when I rewrite the same constraint?
Multiplying g by a nonzero constant rescales λ under the convention ∇f=λ∇g. The feasible set and objective extrema stay the same; the multiplier belongs to the chosen equation.
Does a small stationarity residual prove global optimality?
No. It measures agreement with the stationary equations. Global conclusions here rely on the supported family, complete candidate enumeration and compactness or exact line restriction, with numerical value comparison on the ellipse.