I came across a problem that looks easy but turns out to be extremely hard. The problem goes as follows:
$X,Y$ are two independent random variables with support on interval $[0,1]$ and $\mathrm{E}[X]=\mathrm{E}[Y]=\mu \in (0,1)$. Construct a random variable $Z=f(X,Y)$ as a function of $X,Y$ with the following two properties:
- $Z$ has support [0,1].
- $\mathrm{E}[f(X,Y)|X] = X$ and $E[f(X,Y)|Y]=Y$.
Remark 1. The first example I have is $Z=XY/\mu$ which satisfies 2 but not 1 because $Z$ could take on value $Z=1/\mu>1$. The second example is $Z=X+Y-\mu$ which satisfies 2 but not 1 again.
Remark 2. In fact, my best strategy now is to consider a class of random variables $$ Z= \alpha \frac{XY}{\mu} + (1-\alpha) (X+Y-\mu) + \beta\mathrm{E}[(g(X)-\mathrm{E}g(X))(h(Y)-\mathrm{E}h(Y))] $$ for any functions $g,h$ and scalars $\alpha,\beta$. $Z$ clearly satisfies 2. But it is very hard to restrict the support of $Z$ to interval $[0,1]$.
I am stuck and I am looking forward to a fresh set of ideas from the community.
Here is an example in the very special case that $X$ and $Y$ are uniformly distributed on $[0,1]$, with $\mu=1/2$. Let $$Z=\begin{cases}1 & 1\le X+Y\\0 & \text{otherwise.}\end{cases} $$ Property 1 is obviously satisfied. To check property 2, note that $E[Z|X]$ is the conditional probability (conditional on the value of $X$) that $Y\ge1-X$ which is the length of the interval $[1-X,1]$ which is $X$. Similarly (or by symmetry) $E[Z|Y]=Y$.
Added 22 March 2022: This problem is addressed in a 1991 paper of Gutmann, et al. "Existence of probability measures with given marginals" (Annals of Probability, 19, 1781-1797), where section 3 (inspired by a mathematical model of baseball) addresses the exact problem in this MSE post. Theorem 4 gives the answer. A function $f$ exists with the desired properties if and only if $$U(s)+V(t)\le\mu+(1-F(s))(1-G(t))$$ for all $0\le s, t\le1$, where $F$ and $G$ are the cumulative distribution functions of $X$ and $Y$, and $$U(s)=\int_{s^+}^1xF(dx)$$ $$V(t)=\int_{t^+}^1y G(dy).$$ Example 2 on p.1792 reproduces my example above. I know I had read this paper carefully soon after it came out, but have not thought about it since. It is possible that I had some subconscious memory of it when I first posted on this problem.
Added 23 March 2022: Here is another example; it exhibits a continuous $f$. Let $X,Y$ be iid uniform on $[1/4,3/4]$, and let $$ F(x)=\begin{cases}0&x<1/4\\2x-1/2&x\in[1/4,3/4]\\1&x>3/4\end{cases}$$ be their common distribution function, and let $f(x,y)=(F(x)+F(y))/2$. The function $f$ is continuous and obeys $0\le f\le1$. Then one can check that the expectation of $Z=f(X,Y)$, conditional on $X$, is the random variable $F(X)/2+E[F(Y)]/2=F(X)/2+1/4$ using the trick that $F(Y)$ is uniformly distributed on $[0,1]$. Finally, one notes that $P(X = F(X)/2+1/4)=1$, that is, the random variable $X$ equals the random variable $E[Z|X]$. (And similarly with $E[Z|Y]$.) It is true that $x=F(x)/2+1/4$ holds only for $x\in[1/4,3/4]$, but the complement of this range is a null set with regard to the distribution of $X$.