Consider the function $f(x) :\mathbb{R}\rightarrow \mathbb{R}$, such that $f(x)\geqslant 0\; \forall x\in \mathbb{R}$, and has a set of extremum points at $x_{j}$. Consider the integral : $$\int_{\bar{x}}^{g_{c}(\bar{x})}f(x)dx=c$$ where c is a constant, and $g_{c}(\bar{x})$ is a function of $\bar{x}$, that depends on our choice of c. intuitively, we have that : $$x_{j}\in[\bar{x_{j}},g_{c}(\bar{x_{j}})]$$ for which the quantity $g_{c}(\bar{x})-\bar{x}$ is maximum or minimum. By the fundamental theorem of calculus, this condition is equivalent to $f(g_{c}(\bar{x_{j}}))=f(\bar{x_{j}})$. In other words, every $x_{j}$ lies in a set, whose boundary is a level set of $f(x)$. In order to solve for $x_{j}$, one finds the anti-derivative of $f(x)$ : $$F(x)=\int f(x)dx$$ and then takes the limit $c\rightarrow 0$. or $F(g_{0}(\bar{x_{j}}))=F(\bar{x_{j}})$. Together with $f(g_{0}(\bar{x_{j}}))=f(\bar{x_{j}})$, we can solve for $x_{j}$
My question, how does this generalize to the case of functions in many variables ? for instance, in the case of $f:\mathbb{R}^{2}\rightarrow \mathbb{R} $ one expects that $(x,y)_{j} \in \Gamma_{f}$. where $\partial\Gamma_{f}$ is a level set of $f(x,y)$. Also, the quantity to be maximized (or minimized) is $$\int_{\Gamma_{f}}dx dy$$ How to formalize this intuition rigorously ?