TITLE: Bathtub principle proof
QUESTION [5 upvotes]: Let $ (\Omega, \Sigma, \mu) $ be a measure space and let $f$ be a real valued function on $\Omega $ such that  $\mu (x :f(x)<t) $ is finite for all t $\in \mathbb{R}$. Let the number $G>0$ be and given and defined a class of measurable functions $\Omega$ by $C= (g: 0\le g(x) \le 1  $ for all $x$ and $ \int g(x)\mu(dx)=G) $
Then the minimization problem I= $\inf_{g \in C} \int f(x)g(x) \mu(dx)$ is solved by $g(x)= \chi_{(f<s)}(x) + c\chi_{(f=s)}(x)$
where $s=\sup(t: \mu((x :f(x)<t)) \le G) $ and $c\mu ((x :f(x)=s))=G-\mu ((x :f(x)<s))$
My question is, how can one show that g(x) given above is the minimizer.
Thanks

REPLY [3 votes]: The proof depends on the form of the minimizer $g$:
$$g(x) := \chi_{(f<s)}(x) + c\chi_{(f=s)}(x).$$
For any $h$ satisfying $0\le h\le1$ and $\int_\Omega h\,d\mu=G$, we compute
\begin{equation*}
\begin{split}
\int_\Omega fg\,d\mu &= \int_{\{f<s\}}f\,d\mu + c\int_{\{f=s\}} f\,d\mu \\
&= \int_{\{f<s\}}f\,d\mu + cs\mu(\{f=s\}) \\
&= \int_{\{f<s\}}f\,d\mu + s\big(G-\mu(\{f<s\})\big) \\
&= \int_{\{f<s\}}(f-s)\,d\mu + sG \\
&= \int_{\{f<s\}}(f-s)\,d\mu + s\int_\Omega h\,d\mu \\
&= \int_{\{f<s\}}(f-s)\,d\mu + \int_\Omega(s-f)h\,d\mu + \int_\Omega fh\,d\mu\\
&= \int_{\{f<s\}}(f-s)(1-h)\,d\mu + \int_{\{f\ge s\}}(s-f)h\,d\mu + \int_\Omega fh\,d\mu \\
&\le 0 + 0 + \int_\Omega fh\,d\mu \\
&= \int_\Omega fh\,d\mu.
\end{split}
\end{equation*}
The equality above holds if and only if
\begin{equation*}\begin{split}
\left\{
\begin{split}
\int_{\{f<s\}}(f-s)(1-h)\,d\mu &= 0, \\
\int_{\{f\ge s\}}(s-f)h\,d\mu &= 0,
\end{split}
\right.
&\iff
\left\{
\begin{split}
h=1 &\quad\text{in } {f<s}, \\
h=0 &\quad\text{in } {f>s},
\end{split}
\right. \\
&\Longrightarrow
G=\int_\Omega h\,d\mu=\mu(\{f<s\})+\int_{\{f=s\}} h\,d\mu.
\end{split}\end{equation*}
Hence, when $G=\mu(\{f<s\})$, the minimizer is unique (up to a set of measure zero); when $G=\mu(\{f\le s\})$, since $0\le h\le1$, the minimizer is also unique.