Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-282

Strong Convexity Modulus 2x2

Problem

For the quadratic f(x) = 0.5 x^T A x with symmetric A = [[a, b], [b, d]], the strong convexity modulus is the smaller eigenvalue (a + d - sqrt((a - d)^2 + 4 b^2)) / 2.

Given the entries, return the modulus.

Hint

Use the closed-form eigenvalues of a symmetric 2x2 matrix.

Test cases

case 1
in: [2,0,4]
expected: 2
case 2
in: [3,1,3]
expected: 2
case 3
in: [5,-2,5]
expected: 3
Starter codePython
def strong_convexity_modulus_2x2(a, b, d):
    # Your code here
    pass

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