Lagrange Optimizer - Constrained Optimization Practice
Loading a fresh constraint…
About Lagrange Optimizer
Maximize xy on a budget line ax + by = k by solving the Lagrange condition ∇f = λ∇g for x* with nothing but the algebra - there is no live readout to chase.
Each round generates a fresh problem: maximize f(x, y) = xy subject to ax + by = k with x, y ≥ 0, where a and b are random integers from 1 to 4 and k is a random integer from 6 to 21. You are asked for x* at the optimum and must type the number - there is no live objective readout to converge on visually.
The hint on screen sets up the method: ∇f = (y, x) and ∇g = (a, b), so the Lagrange condition ∇f = λ∇g gives y = λa and x = λb. Substituting both into the constraint yields a(λb) + b(λa) = k, so λ = k/(2ab), and then x* = λb and y* = λa.
After you check, the reveal walks the full solution: λ, x*, y*, a numerical check that ax* + by* ≈ k, and the maximum value of xy. Press next round for a new (a, b, k).
Why quant interviews test this
Constrained optimization is the backbone of the quant-research canon: mean-variance portfolios, maximum likelihood under constraints, and utility maximization are all Lagrange computations, and interviews regularly ask a small closed-form instance exactly like this game's - maximize a product or a log-sum under a linear budget.
The two follow-ups to prepare: interpret λ as a shadow price (the derivative of the optimal value with respect to the constraint level), and reproduce the answer by a second route such as AM-GM or direct substitution of y = (k - ax)/b followed by one-variable calculus. Interviewers use the second route to separate memorized formulas from understanding.
The Lagrange Optimizer guide covers how scoring works, the strategy that wins, a worked example and the mistakes most players make.
More Calculus & Linear Algebra games
- Eigenvector Spotter - Given a 2x2 matrix and four candidate directions, click the one that A merely stretches instead of rotating - the eigenvector.
- Newton Stepper - Predict how many Newton iterations it takes to drive x² - a = 0 from x₀ = 1 to within 1e-4 of √a - then watch the step table and see how quadratic convergence behaves.
- PSD Classifier - Classify a symmetric 2x2 matrix as positive definite, positive semidefinite, indefinite, or negative definite using trace and determinant - the test that decides whether it could be a covariance matrix.
- Taylor Slider - Sum a Taylor polynomial by hand - order 2, 3, or 4 for eˣ, sin, cos, or ln(1+x) at a given point - and see how fast the error shrinks.
- All Calculus & Linear Algebra practice
- Every game guide