As a simple example, suppose we have a function $f: \mathbb{R}^3 \to \mathbb{R}$ defined on the set (and taking $+\infty$ everywhere else),


$$\{x \in \mathbb{R}^3| x\_1 \in [-1, 1], x\_2 \in [-1, 1], x\_3 = 0\}$$


The set has no interior but a relative interior given by $(-1,1) \times (-1,1) \times \{0\}$.


Similarly, consider sets such as $\{x \in \mathbb{R}^3| \langle e, x\rangle = 1, x\_i \geq 0\}$, where $e$ is the one-vector. Once again, it has no interior, but has a relative interior relative to the hyperplane $\langle e, x \rangle = 1$ given by $\{x \in \mathbb{R}^3| \langle e, x\rangle = 1, x\_i > 0\}$,


Example functions could include:


$f(x) = \langle x, x \rangle$ for the first set


$f(x) = -\langle e, \ln(x) \rangle$ for the latter set


Are such function differentiable on such sets (i.e. the gradient exists)? If not, why? Can't seem to find any resource on this.


Edited per comment: Also, is it problematic if I were to pretend that the function was defined on the whole space, take the gradient there, and restrict it to the relative interior? For example, consider $f(x) = \langle x, x \rangle$ defined on the set $[-1, 1]^2 \times \{0\}$. What is wrong if I were to take the gradient as usual, $\nabla f(x) = 2 x$ and define it on the relative interior of the same set $(-1, 1)^2 \times \{0\}$?



Can functions be differentiable on sets with empty interiors?
I think what you are looking for is the standard definition of once-differentiable manifold with boundary.


In order to define derivative, you need a normed vector space. You need a vector space because differentiation is ${\Bbb R}$-linear. You want to preserve the linearity because in a sense, differentiation is linearization. You need the norm to take the limit.


The concept is generalized to manifolds by looking at the infinitesimal neighborhood of a point, the tangent space, which is a vector space.


As LSpice commented, your examples are manifolds with boundary. The boundary is itself of a manifold one dimension lower, so you can define derivative there.


You can also consider a boundary point as part of the whole space. There your "tangent space" is only half of a vector space. You can generalize linearity here also, if you like.


Finally, manifolds are define by charts and you want to make sure that your differentiation operator is defined consistently across the charts. This means that the transition maps should be differentiable.


