Finding $E(Y_1 \mid \max(Y_1, Y_2))$ for independent $Y_1, Y_2$ random variables. Suppose that $Y_1, Y_2$ are two independent observations from the following distribution:
$$
f_\theta(y) = \begin{cases} \dfrac{3y^2}{\theta^3} &\text{for } 0 <y \leq \theta, \ \theta>0 \\[8pt]
0 & \text{otherwise}\end{cases} 
$$
I am trying to find $E(Y_1 \mid \max(Y_1, Y_2))$, and am not sure how to do this. I can directly compute the integral but I still need to find the joint distribution of $Y_1$ and $\max(Y_1,Y_2)$, which I am not sure how to derive. 
 A: Without computing the joint density:
Let's define an indicator random variable $K$ taking value $1$  if $Y_1 > Y_2$, $2$ otherwise. Clearly, from symmetry, $P(K=1)=\frac12$. Let $Z=\max(Y_1,Y_2)$. 
Then, using the law of total expectation with respect to variable $K$, $$E(Y_1 \mid Z) =E( E(Y_1 \mid Z , K))=\frac12  E(Y_1 \mid Z, K=1)+\frac12  E(Y_1 \mid Z ,K=2)$$
But $E(Y_1 \mid Z, K=1)=Z$ and 
$$E(Y_1 \mid Z, K=2)=E(Y_1 \mid Y_1 < Z)$$
This expectation corresponds to that of a truncated $Y_1$:
$$E(Y_1 \mid Y_1 < Z)=\frac{\int_0^Z y\, 3 y^2\, dy }{\int_0^Z 3 y^2 \,dy}=\frac{3}{4}Z$$
Putting all together:
$$E(Y_1 \mid Z)=\frac{1}{2}Z+\frac{3}{8}Z=\frac{7}{8}Z$$
A: Hint: to find the joint pdf of $(Y_1,\max(Y_1,Y_2))$:
The support of $(Y_1,\max(Y_1,Y_2))$ is 
Observe first that the CDF of $Y_i$ is $F_\theta(y)=\frac{y^3}{\theta^3}$ for $
0<y<\theta$
Now if $F$ and $f$ are the joint CDF and pdf of $Y_1$ and $Y_2$, then for $0<y_1,  y_2\le\theta$:
$$F(y_1,y_2)=P(Y_1\le y_1,\max(Y_1,Y_2)\le y_2)=P(Y_1\le y_1,Y_1\le y_2,Y_2\le y_2)\\=P(Y_1\le\min(y_1,y_2),Y_2\le y_2)=P(Y_1\le \min(y_1,y_2))P(Y_2\le y_2)=F_\theta(\min(y_1,y_2))F_\theta(y_2)$$
So
$$F(y_1,y_2)=
\begin{cases}
F_\theta(y_1)F_\theta(y_2)=\frac{9 y_1^2 y_2^2}{\theta^6}& \text{ if } y_1\le y_2\\
F_\theta(y_2)F_\theta(y_2)=\frac{9 y_2^4}{\theta^6}& \text{ if } y_1> y_2
\end{cases}
$$
The problem with this approach is that when you differentiate, there is a Dirac component coming from a discontinuity of $F$, which is messy to work with.
So for the simplest path to final goal, you should follow leonbloy advice in his answer and condition on whether $Y_1\le Y_2$ or not:
$$E[Y_1|\max(Y_1,Y_2)]=E[Y_1|\max(Y_1,Y_2),Y_1\le Y_2]P(Y_1\le Y_2)+E[Y_1|\max(Y_1,Y_2),Y_1>Y_2]P(Y_1>Y_2)$$
