I have a function z=f(x,y) that is reasonably well behaved (single global maximum). I can readily compute the value of z as well as partials of z with respect to x and y. I can also quite easily find the maximum. The challenge is to find the maximum and minimum values of x where c = constant = f(x,y). In other words, I'm trying to find the extreme values of x for a given level curve. I also know that the extreme values of x occur along a ridge (i.e. where the partial of f with respect to y is zero). In a way, this is a backwards constrained optimization problem, where the value of the function is contrained and the goal is to optimize the values of the variables. Currently, I'm using a combination of Newton's method and Brent's method to successfully solve the problem, but I'm wondering if there might be a more elegant and mathematically rigorous approach. Any suggestions?