TITLE: Mean value staying in a convex or a subspace
QUESTION [6 upvotes]: Let $f : \mathbb{R}^n \to \mathbb{R}^m$ such that $\forall x\in \mathbb{R}^n$, $f(x)\in C$ where $C$ is a convex set of $\mathbb{R}^m$ (respectively $f(x)\in F$ where $F$ is a linear subspace of $\mathbb{R}^m$) and $f$ is in $L^1_{\text{loc}}(\mathbb{R}^n,\mathbb{R}^m)$. Then it seems quite natural that for all $K$ compact convex set of $\mathbb{R}^n$,
$$\frac{1}{\text{mes}(K)}\int_K f(x)\text{d} x \in C\text{ (resp. } \in F).$$
But is it true ? And if it is, how to prove it ?

REPLY [2 votes]: Let us denote
$$\mu_K(g) := \frac{1}{\operatorname{mes}(K)}\int_K g(x)\,dx$$
for all compact $K$ with positive measure and locally integrable $g$.
For any linear functional $\lambda \colon \mathbb{R}^m\to\mathbb{R}$, we have
$$\lambda\left(\mu_K(f)\right) = \mu_K(\lambda\circ f),$$
so if $\lambda(y) \leqslant 1$ for all $y\in C$, then also $\lambda(\mu_K(f))\leqslant 1$.
By the Hahn-Banach theorem(s), we have
$$\bigcap_{C\subset \lambda^{-1}\bigl((-\infty,1]\bigr)} \lambda^{-1}\bigl((-\infty,1]\bigr) = \overline{C},$$
hence we know that $\mu_K(f) \in \overline{C}$ for all eligible $K$. If $C$ is closed, then that means $\mu_K(f) \in C$. The case of a linear (or affine) subspace is a special case of this. If $C$ is open, then $\lambda(y) \leqslant 1$ for all $y\in C$ implies $\lambda(y) < 1$ for all $y\in C$, since for $\lambda\neq 0$, the image $\lambda(C)$ is open, and that in turn implies $\mu_K(\lambda\circ f) < 1$, whence in fact $\mu_K(f) \in C$.
If $C$ is neither open nor closed, the above allows to conclude that $\mu_K(f)\in C$ if for every boundary point $p \in \overline{C}\setminus C$ we can find a linear functional $\lambda_p$ with $\lambda_p(p) = 1 > \lambda_p(y)$ for all $y \in C$, which is for example the case if $C$ has no line segments in its boundary. For the fully general case, while I'm rather convinced that it does hold, I don't see yet how to prove it.