Integral of convex set Let $D$ be a convex set and $X_1,\dots,X_d$ be integrable random variables. If $X= (X_1,\dots,X_d)$ is in $D$ almost surely, 
why is it true that the vector $a= (\mathbb{E}X_1,\dots,\mathbb{E}X_d)$ belongs to $D$ almost surely also?
Here $\mathbb{E}$ denotes the expectation with respect to a probability measure.
 A: The true reason is that the mean of every measure is in the convex hull of its support, hence if the support is included in a convex set then the mean is in the convex set. 
An elementary approach is to consider an i.i.d. sequence $(X^n)_{n\geqslant1}$ distributed like $X$. For every $n\geqslant1$, $M_n=\frac1n\sum\limits_{k=1}^nX^k$ is a barycenter of $n$ points of $D$, hence $M_n$ is in $D$ almost surely. Since $M_n\to a$ almost surely, this shows that $a$ is in the closure of $D$. 
If $a$ is not in $D$, there exists a closed semi-space $\{x\mid\langle x,u\rangle\geqslant\langle a,u\rangle\}$ which does not intersect $D$. Since $X_1$ is in $D$ almost surely, $Y^1=\langle X^1-a,u\rangle\lt0$ almost surely, which implies that $E[Y^1]\lt0$. Considering $Y^n=\langle X^n-a,u\rangle$ for every $n\geqslant1$, the law of large numbers applied to the i.i.d. sequence $(Y^n)$ implies that $\langle M_n-a,u\rangle=\frac1n\sum\limits_{k=1}^nY^k$ converges almost surely to $E[Y^1]\lt0$ although $M_n-a\to0$ when $n\to\infty$. This is absurd, hence $a$ is in $D$.
A: Here is a lemma we need: When D is convex, the distance function $f(x) = \inf_{ y \in D}\|x-y\|$ is convex.
Then by Jensen's inequality $ f(E[X]) \leq E[f(X)]$. Since $f(X)=0$ almost sure, we get the distance from $E[X]$ to D is zero, thus the final conclusion.
In some cases(when $D$ is not closed) we add some "almost surely" arguments to avoid  $E[X] \in \partial D$ and $E[X] \not \in D$
