Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-292

Lagrange Equality Minimum Point

Problem

Minimizing x^2 + y^2 subject to x + y = c gives the symmetric solution (c/2, c/2): the constraint plane meets the circular level sets tangentially.

Given c, return the minimizer [x, y].

Hint

Stationarity of x^2 + y^2 + lambda (x + y - c) forces x = y.

Test cases

case 1
in: [2]
expected: [1,1]
case 2
in: [0]
expected: [0,0]
case 3
in: [-4]
expected: [-2,-2]
Starter codePython
def lagrange_equality_minimum_point(c):
    # Your code here
    pass

3 test cases · run your code against them in the editor