Second-order partials nonpositive at maximum Let $f:U\rightarrow\mathbb{R}$ be a twice-differentiable function on an open set $U\subseteq\mathbb{R}^2$. Suppose that $f$ attains a maximum (global or local) at a point $(x_0,y_0)$.
We know that the gradient of $f$ at $(x_0,y_0)$ is zero, i.e. that $f_x(x_0,y_0)=f_y(x_0,y_0)=0$, but I want to prove that the second-order partials at $(x_0,y_0)$ are nonpositive. That is, how do you prove that $f_{xx}(x_0,y_0)\le 0$ and $f_{yy}(x_0,y_0)\le 0$? This is a partial converse to the second-derivative test for functions of two variables. I couldn't quite get the inequalities to work, but I assume it is true just from intuition. Weirdly though, almost all material online or in textbooks do not show this, but rather just a proof of the second derivative test.
To start, by definition we have that
$$f_{xx}(x_0,y_0) = \lim_{h\rightarrow 0}\frac{f_x(x_0+h, y_0) - f_x(x_0, y_0)}{h} = \lim_{h\rightarrow 0}\frac{f_x(x_0+h, y_0)}{h},$$
since $f_x(x_0, y_0)=0$. But how can we conclude that the right hand side of the above equation should be nonpositive? I tried to consider the right and left limits to see if either would be easier:
$$\lim_{h\rightarrow 0^+}\frac{f_x(x_0+h, y_0)}{h}\qquad\text{and}\qquad \lim_{h\rightarrow 0^-}\frac{f_x(x_0+h, y_0)}{h},$$
but still I don't know how to compute the sign for either.
Note: This post asks the same question, but I didn't find that answer particularly illuminating.
 A: It is true for essentially the same reason as the second derivative test. Assume $f \in C^2(U, \mathbb{R})$, where $U$ is an open subset of $\mathbb{R}^n$. Suppose $f$ attains a local max at a point $x_0 \in U$. Let $j \in \{1, 2, \dots, n\}$ be arbitrary. Pick $r > 0$ so that $f$ has $x_0$ as a global max on $B(x_0, r)$.
By Taylor's theorem, for $h \in (-r, r)$,
$$f(x_0 + he_j) = f(x_0) + f_{x_j}(x_0)h + \frac{f_{x_j x_j}(x_0 + \theta he_j)}{2}h^2 = f(x_0) + \frac{f_{x_j x_j}(x_0 + \theta he_j)}{2}h^2,$$
where $\theta \in (0, 1)$. If $f_{x_j x_j}(x_0) > 0$, then by continuity, $f_{x_j x_j}(x_0 + te_j) > 0$ for $t$ near $0$, which implies $f(x_0 + he_j) > f(x_0)$ for $h$ near $0$, a contradiction.
A: Suppose one of the second-order partials is positive, let's say $f_{xx}(x_{0},y_{0})>0$ without loss of generality (in other words, the same proof could be used if $f_{yy}(x_{0},y_{0})$ was positive). This implies that $f_{x}$ is increasing as x increases (and is decreasing as $x$ decreases) in some neighborhood around $(x_{0},y_{0})$, and because $f_{x}(x_{0},y_{0})=0$, $f_{x}(x_{0}+h,y_{0})>0$ for all $h \in (-\delta,0)\bigcup(0,\delta)$ for some $\delta>0$. This, of course, shows that $f$ is not a local maximum.
