TITLE: Conditional expectation $E[X\mid\max(X,Y)]$ for $X$ and $Y$ independent and normal
QUESTION [5 upvotes]: I am trying to obtain the conditional expectation
$$E[X\mid Z]$$
where $Z= \max(X,Y)$ and $X,Y$ are independent Gaussian random variables.

REPLY [7 votes]: This is an interesting question, more involved than it may look at first sight. Here are the explicit formulae which answer it.

Let us first assume that $X$ and $Y$ follow the same distribution with cumulative distribution function $F$, hence $F(x)=\mathrm P(X\leqslant x)=\mathrm P(Y\leqslant x)$ for every real number $x$. 
Then, $\mathrm E(X\mid Z)=g(Z)$ almost surely, with
$$
g(z)=z-\frac1{2F(z)}\int_{-\infty}^zF(x)\mathrm dx.
$$
When the common distribution of $X$ and $Y$ is standard Gaussian, $F=\Phi$ and an integration by parts yields
$$
g(z)=\frac12\left(z-\frac{\mathrm e^{-z^2/2}}{\sqrt{2\pi}\Phi(z)}\right).
$$

In somewhat more generality now, assume that the distribution of $X$ has density $f_X$ and cumulative distribution function $F_X$ and the distribution of $Y$ has density $f_Y$ and cumulative distribution function $F_Y$. 
Then $\color{red}{\mathrm E(X\mid Z)=g(Z)}$ almost surely, with
$$
g(z)=\frac{zf_X(z)F_Y(z)+f_Y(z)\,\mathrm E(X;X\leqslant z)}{f_X(z)F_Y(z)+f_Y(z)F_X(z)}.
$$
The only term in $g(z)$ which is not $z$, $f_X(z)$, $f_Y(z)$, $F_X(z)$ or $F_Y(z)$ is
$$
\mathrm E(X;X\leqslant z)=\int_{-\infty}^zxf_X(x)\mathrm dx=zF_X(z)-\int_{-\infty}^zF_X(x)\mathrm dx,
$$
which yields the definitive expression
$$
\color{red}{g(z)=z-\frac{f_Y(z)}{f_X(z)F_Y(z)+f_Y(z)F_X(z)}\int_{-\infty}^zF_X(x)\mathrm dx}.
$$
This holds for any independent random variables $X$ and $Y$ with continuous distributions. Two remarks. First, when $X$ and $Y$ are identically distributed, one recognizes the expression written in the first part of this answer. Second, I call this expression definitive because I do not think there exists a much simpler expression for general Gaussian random variables.