All problems
Hessian Determinant
Problem
For f(x, y) = a*x^2 + b*x*y + c*y^2 the Hessian is the constant matrix [[2a, b], [b, 2c]].
Return its determinant 4*a*c - b^2, which distinguishes minima, maxima, and saddle points.
Hint
For a 2x2 matrix [[p, q], [q, r]] the determinant is p*r - q^2.
Test cases
case 1
in: [1,2,3]
expected: 8
case 2
in: [1,0,1]
expected: 4
case 3
in: [1,2,2]
expected: 4
case 4
in: [0,1,0]
expected: -1
case 5
in: [2,4,2]
expected: 0
Starter codePython
def hessian_determinant(a, b, c):
# Your code here
pass5 test cases · run your code against them in the editor