# Does convexity on a set implies hessian PSD on the boundary?

Let $$C \subset \mathbb{R}^N$$ be a closed convex set with nonempty interior. Let $$f : \mathbb{R}^N \to \mathbb{R}$$ be twice differentiable on $$C$$. We also assume that it is convex on $$C$$:

$$(\forall x,y \in C) (\forall \alpha \in [0,1]) \quad f((1- \alpha)x + \alpha y) \leq (1- \alpha)f(x) + \alpha f(y).$$

My main question is : can we say that the Hessian of $$f$$ is positive semidefinite on $$C$$?

The basic result I know holds when $$C$$ is an open set ; so applying such result on the interior of $$C$$, we immediately get that for all $$x \in {\rm{int}}~C$$, $$\nabla^2 f(x) \succeq 0$$. So my question is about what happens at the boundary.

What is also clear is that if I assume further that $$f$$ is of class $$C^2$$ on $$C$$ (and not only twice differentiable), we could pass to the limit from the interior to the boundary of $$C$$ to conclude that yes, $$\nabla^2 f(x) \succeq 0$$ for all $$x \in C$$.

I have been trying to find a counterexample, but every example of "twice differentiable but not $$C^2$$" function I find is highly nonconvex, so I start to wonder if convexity and twice differentiable implies $$C^2$$? After all, it is known that:

• convex functions are always continuous in the interior of their domain
• the subdifferential of a convex function has a closed graph ; so differentiable convex functions have a continuous gradient

So my secondary question is : is the hessian of a twice differentiable convex function always continous?

• What does it mean to be twice differentiable on a closed set? Is $C$ strictly contained in the effective domain of $f$ (i.e., $C\subset \{x:f(x)<+\infty\}$? Commented Oct 2, 2023 at 18:27
• It means that $f$ is twice differentiable at $x$, for every $x \in C$. This implies that $C$ is included in some open set $U$ where $f$ is twice differentiable. In particular, $C$ is in the interior of the effective domain. I believe that for this question we can assume the fuction to have a full domain. Commented Nov 24, 2023 at 14:47
• Assuming that $C$ is contained in an open set $U$, on which $f$ is twice differentiable in addition to being twice differentiable on $C$, we can be sure that the Hessian of $f$ is psd on all of $C$. To see this, just apply the result you've referenced to the open set $U$, which contains $C$. Commented Nov 24, 2023 at 16:22
• The standard result requires the function to be twice differentiable and convex on an open set. Unfortunately your suggestion wouldn't apply, because $f$ is only assumed to be convex on $C$, not $U$. Commented Nov 26, 2023 at 13:00
• Yes this was a misunderstanding, thanks for clarifying. Commented Nov 26, 2023 at 14:12