Integral 0f a function with range in convex set is in the convex set The question is: Consider the set $X$ with measure $\sigma(X)=1$. Let $K$ be a compact convex subset of $\mathbb{C}$. Let $f$ be a complex valued, measurable function defined on $X$ such that the range of $f$ is in $K$. Show that $f$ is integrable w.r.t. $\sigma$ and that
$$
\int_X f(x)\sigma(dx) \in K
$$
What have I done so far: I was able to show that $f$ is integrable w.r.t. to $\sigma$. However, I am having a lot of grief showing that the integral is in the compact convex set. I can see that this is true for a small non-trivial case like say a unit square with the four corners having the value $\frac14$ but this is proving to be beyond me. I have consulted Rudin's Real and Complex Analysis and Folland's Real Analysis but to no avail. It seems like this might be a theorem of a corollary of a theorem and I am missing a link. Any suggestions?
 A: An informal argument is that, since the values of $f$ are in $K$ a compact convex subset of $\mathbb{C}$ and $\int_X f(x)\sigma (dx)$ is an average of the values of $f$, then this average exists (since $f$ is finite) and must belong to $K$.

Now I will show a formal proof. In this proof, I will assume you are familiar with Hahn-Banach separation theorem I
By contradiction, assume $z_0=\int_X f(x)\sigma (dx)\notin K$. Using $K$ and $\{z_0\}$ are compact convex disjoint sets, by Hahn-Banach separation theorem, there exists $v\in \mathbb{C}$ and $d\in\mathbb{R}$, s.t. 
$$
\langle v,z\rangle < d < \langle v,z_0\rangle
$$ 
for all $z\in K$. Then 
$$
\langle v,f(x)\rangle < d < \langle v,z_0\rangle
$$
for all $x\in X$. 
Let $g:X\to \mathbb{R}$ be defined by $g(x)=\langle v,f(x)\rangle$. We can show $g$ is a measurable and integrable function, using $f$ measurable and integrable. 
On the one hand, we can show
\begin{eqnarray}
\int_X g(x)\sigma (dx) dx & = &\int_X \langle v,f(x)\rangle\sigma(dx)\\
& = & \langle v,\int_X f(x)\sigma(dx)\rangle\\
& = & \langle v,z_0\rangle
\end{eqnarray}
while on the other hand, 
$$
\langle v,z_0\rangle=\int_X g(x)\sigma (dx) dx<d<\langle v,z_0\rangle
$$
which is a contradiction.
A: Another approach can based on the distance-to-the-boundary  function. As a bonus, $K$ need only be convex and bounded. (For unbounded $K$, one must assume that $\int|f(x)|\,\sigma(dx)<\infty$.) Define $\varphi(z)=\inf\{|z-w|:w\in\partial K\}$ (the distance to the boundary $\partial K$ of $K$) for $z\in K$ and $\varphi(z)=-\infty$ for $z\notin K$. Then $\varphi:\Bbb C\to[-\infty,\infty)$ is concave. Let $m$ denote $\int_X f(x)\,\sigma(dx)$. By the vector-valued form of Jensen's inequality,
$$
\varphi(m)\ge\int_X \varphi(f(x))\,\sigma(dx)\ge 0,
$$
the final inequality following because $f$ takes values in $K$ and $\varphi(z)\ge 0$ for all $z\in K$. It follows that $\varphi(m)\ge 0$; in particular, $\varphi(m)>-\infty$, so $m\in K$.
This argument works in all dimensions, and more generally in topological vector spaces for which (i) barycenters of probability measures exist and (ii) an appropriate form of Jensen's inequality holds.
