Two functions that agree at a point and their second derivatives Why is it that if two $C^2(\mathbb{R})$ functions $f,g:\mathbb{R}\rightarrow\mathbb{R}$ that agree at a point $x_0$ and that $f(x)\geq g(x)$ in a neighborhood of $x_0$ must we have $f''(x_0)\geq g''(x_0)$ in that same neighborhood. Intuitively it is clear, but I can't think of the proof. My calculus is a little bit rusty. It would be great if someone could help out. I'm sure the answer is something simple but I just can't think of it.
 A: Although you have already answered your own question, another way to see it is to consider the $C^2$ function $h(x) := f(x) - g(x)$.
This function must have a local minimum at the point $x_0$, since that point is at least as small as all other nearby points. But since it is a minimum, we must have $h'(x_0) = 0$, and $h''(x_0) \ge 0$, which implies $f''(x_0) \ge g''(x_0)$, as desired.
This chain of reasoning also works for higher dimensional functions, and the generalization being that the difference between the hessian matrices is positive semidefinite.
A: I think I have it. We can reduce our question to the following. We can assume that $f(0)=0$ and $f(x)\geq 0$ in a neighborhood of $0$. Then by definition of the derivative we see that taking the right derivative 
$$f'(0)=\lim_{x\rightarrow 0^+}\frac{f(x)}{x}\geq 0$$
and 
$$f'(0)=\lim_{x\rightarrow 0^-}\frac{f(x)}{x}\leq 0$$
Thus, $f'(0)=0$. But notice then that the tangent line at the point $0$ is always below the graph of the function $f(x)$. This means that our function is not concave, so in particular $f''(0)\geq 0$. So were done.
A: Define the function $\psi(x):=(f-g)(x)$. Then $\psi(x_0)=0$ and by assumption $\psi(x)\geq0\forall x\in U(x_0)$ (in a neighborhood of $x_0$.
Now if $\psi'(x)\geq0$ then psi is constant 0 in $U(x_0)\cap(-\infty,0]$ and in $U(x_0)\cap[0,\infty)$ monotonically increasing. In particular $\psi(x_0)''\geq0$.
Same considering the case where $\psi'(x)\leq0$.
In $U(x_0)\cap(-\infty,0]$ the function is monotonically decreasing and in $U(x_0)\cap[0,\infty)$ constant 0. In particular $\psi(x_0)''\geq0$.
