# When do maximum and expectation commute?

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!

• Are $I$ and $X$ fixed? Sep 23, 2012 at 9:25
• I talked with a mathematician once who expressed frustration with some modern theoretical physics writing, exactly because of this point. They would use this without justification, or even without noticing. If the random variable $X$ is constant a.s. it would have been OK (in that setting, at least); and in thermodynamics it often turns out that they are constant; but some physicists would forge ahead, maximizing the r.v. by maximizing instead the expectation. Sep 23, 2012 at 12:55
• Yes, $I$ and $X$ are fixed. I've also added an assumption that $I=[0,1]$. Sep 23, 2012 at 16:00
• Is there anything more you're prepared to specify about $X$? Sep 23, 2012 at 18:17
• @Yemon Choi: I would like the result to hold for any distribution of $X$, but if you want to impose some conditions on $X$, that's fine. I'm still clueless on how to approach the problem. Sep 24, 2012 at 2:21

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" 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 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$$

• Thanks Dan! In the statement of the necessary and sufficient condition, did you mean there exists $T\in [0,1]$ such that $G(T,X)=\sup_{t\in [0,1]}G(t,X)$ a.s. ? I think there's another way of coming up with the condition, which also follows from pgassiat's suggestion above: if $\sup_{t\in [0,1]}\mathbb{E}[G(t,X)]$ is obtained at $t=T$ then we have $\mathbb{E}[\sup_{t\in [0,1]}G(t,X)−G[T,X]]=0$. This implies that $G(T,X)=\sup_{t\in [0,1]}G(t,X)$ a.s. I'm not sure if this condition is very useful for me in action because I'm not sure how to check it for a given function $G(t,x)$. Sep 25, 2012 at 2:14
• Yes, you're right. I edited the answer to reflect this, and also to change "the dominated convergence theorem" to "Fatou's lemma", to be a bit more precise. But your argument is much better! Last night I missed this simple proof: If $\sup_{t \in [0,1]}\mathbb{E}[G(t,X)] =\mathbb{E}[\sup_{t \in [0,1]}G(t,X)] < \infty$, then Fatou's lemma and continuity of $G$ in $t$ imply that $t \mapsto \mathbb{E}[G(t,X)]$ is upper-semicontinuous. Thus $\sup_{t \in [0,1]}\mathbb{E}[G(t,X)]$ is attained, and the rest is as you said. I knew Zorn's lemma felt like overkill for this problem...
– Dan
Sep 25, 2012 at 13:46
1. The equality holds if $G(t,x) = f(t) + g(x)$.

2. If $G(t,x) = f(t) g(x)$, then $$E(\sup(G(t,X))=\sup f(t) E(g(X)1_{g(X)\geq0}) + \inf f(t) E(g(X)1_{g(X)<0})$$ and \begin{equation} \sup E(G(t,X)) = \begin{cases} E(g(X)) \sup f(t) & \text{ if } E(g(X)) \geq 0 \newline E(g(X)) \inf f(t) & \text{ if } E(g(X)) < 0 \end{cases} \end{equation} So the equality holds if $g(X) \geq 0$ a.s. or $g(X) \leq 0$ a.s.

• Thanks, but I would like necessary and sufficient conditions on $G(t,x)$ (or at least a condition that allows for a more general class of functions $G(t,x)$ if possible). Sep 23, 2012 at 14:30
• If $X$ keeps its sign, one can also consider the Taylor series of $G(t,x)$: $G(t,x) = \sum_{k,n\ geq 0} a_{kn} t^k x^n$ and analyze the conditions under which $\sup_t E(\sum a_{kn} t^k x^n) = \sup_t \sum a_{kn} t^k E(x^n) = \sum a_{kn} \sup_t(t^k) E(x^n) = E(\sum a_{kn} \sup_t(t^k) x^n) = E( \sup_t( \sum a_{kn} t^k x^n))$. Sep 23, 2012 at 19:47
• Is $\sup_t\sum a_{kn}t^kE(x^n)=\sum a_{kn}\sup_t(t^k)E(x^n)$ a typo? How can you pass $\sup$ into the summation? Sep 23, 2012 at 20:22
• This step requires $\sum a_{kn} t^k E(X^n)$ to be an increasing function of $t$. It may be a very strong condition, but I don't see any other way to exchange $\sup(\cdot)$ and $E(\cdot)$ here. Sep 23, 2012 at 20:48
• That indeed is a very strong condition :) Sep 24, 2012 at 0:50