Hi, I'm looking for conditions on $G(t,x)$ such that
$$
\sup\limits\_{t\in [0,1]}E[G(t,X)]=E[\sup\limits\_{t\in [0,1]}G(t,X)]
$$
where $X$ is a random variable (it's easy to see that $\sup\limits\_{t\in [0,1]}E[G(t,X)]\leq E[\sup\limits\_{t\in [0,1]}G(t,X)]$).


Any suggestion or reference is greatly appreciated!



When do maximum and expectation commute?
This will require very strong conditions on $G$. The most general result I know of is an "almost upward-filtering" condition: Assume $G(t,\cdot)$ is measurable for each $t \in [0,1]$, and $\sup\_{t \in [0,1]}\mathbb{E}[G(t,X)] < \infty$; then
$$
\sup\_{t \in [0,1]}\mathbb{E}[G(t,X)] = \mathbb{E}[\text{ess}\sup\_{t \in [0,1]}G(t,X)]
$$
if and only if for all $\epsilon > 0$ and $r,s \in [0,1]$ there exists $t \in [0,1]$ such that
$$
\mathbb{E}[(G(t,X) - G(s,X) \vee G(r,X))^-] \le \epsilon.
$$ I believe this result is originally due to J.A. Yan, in the hard-to-find paper "[On the commutability of essential infimum and conditional expectation operators](https://www.researchgate.net/publication/266961427_On_the_commutability_of_essential_infimum_and_conditional_expectation_operations)" and has since become become fairly well-known in the stochastic control literature.


*Note: $\sup\_{t \in [0,1]}G(t,X)$ need not be measurable, which is why the [essential supremum](https://metaphor.ethz.ch/x/2018/fs/401-3888-00L/appendix/A5_ess-sup.pdf) is used in the aforementioned theorem.*


A more transparent condition can be derived from the above if we add a continuity assumption: Assume $G(\cdot,x)$ is continuous for each $x$, $G(t,\cdot)$ is measurable for each $t$, and $\sup\_{t \in [0,1]}\mathbb{E}[G(t,X)] < \infty$. Then $\sup\_{t \in [0,1]}\mathbb{E}[G(t,X)] = \mathbb{E}[\sup\_{t \in [0,1]}G(t,X)]$ if and only if there exists $T \in [0,1]$ such that $G(T,X) = \sup\_{t \in [0,1]}G(t,X)$ almost surely.


**PROOF:** The continuity assumption guarantees that $\sup\_{t \in [0,1]}G(t,X)$ is indeed measurable (e.g. by Theorem 18.19 of Aliprantis & Border), and thus
$$
\text{ess}\sup\_{t \in [0,1]}G(t,X) = \sup\_{t \in [0,1]}G(t,X).
$$
The aforementioned theorem and a simple argument using compactness of $[0,1]$ and Fatou's lemma shows that (under our assumptions)
$$
\sup\_{t \in [0,1]}\mathbb{E}[G(t,X)] = \mathbb{E}[\sup\_{t \in [0,1]}G(t,X)]
$$ if and only if for all
$$
\mbox{$r,s \in [0,1]$ there exists $t \in [0,1]$ such that $G(t,X) \ge G(r,X) \vee G(s,X)$ a.s.}
$$
Since the "if" part is trivial, we now prove the "only if". Consider the set $S := \{G(t,X) : t \in [0,1]\}$ with the partial order given by almost sure inequality. Compactness of $[0,1]$ and continuity of $G(\cdot,x)$ for all $x$ yield the existence of an upper bound in $S$ for any chain of $S$, and thus by Zorn's lemma $S$ contains a maximal element. That is, there exists $T \in [0,1]$ such that there is no $s \in [0,1]$ for which
$$
\mbox{$G(s,X) \ge G(T,X)$ a.s. and $P(G(s,X) > G(T,X)) > 0$.}
$$
For any $t \in [0,1]$ there exists $r \in [0,1]$ such that
$$
G(r,X) \ge G(T,X) \vee G(t,X) \ge G(T,X) \mbox{a.s.}
\,,
$$ which implies $G(r,X) = G(T,X)$ a.s. and thus $G(T,X) \ge G(t,X)$ a.s.. Hence $G(T,X) \ge G(t,X)$ a.s. for any $t \in [0,1]$. $\blacksquare$


