$X$ and $Y$ be i.i.d $U(0,1)$ random variables. Then $E(X|X>Y)$ 
Let $X$ and $Y$ be i.i.d $U(0,1)$ random variables. Then $E(X|X>Y)$
equals?

The way I interpreted it is as follows:
$E(X|X>Y)$ is $E(X)$ realizing $X>Y$
so $E(X)=\int_{0}^{1}\int_{y}^{1}xdxdy=\int_{0}^{1}(\frac{x^2}{2})_{y}^{1}dy=\frac{1}{2}\int_{0}^{1}(1-y^2)dy=\frac{1}{2}(y-\frac{y^3}{3})_{0}^{1}=\frac{1}{2}\cdot\frac{2}{3}=\frac{1}{3}$
What can be a better alternative to solve this problem? I tried so hard but couldn't get the answer using the proper definition of expectation, can anyone help me?And can we use law of total expectation here?
 A: This is an answer how to use strictly the proper definition of conditional expectation to justify the interpretation in the question:
The conditional expectation conditioned by the event $\{X>Y\}$ is the conditional expectation conditioned by the $\sigma$-algebra generated by the event: $$\mathcal M:=\sigma(\{X>Y\})=\{\emptyset,\Omega,\{X>Y\},\{X>Y\}^\complement\}.$$ This $E(X|\mathcal M)$ is a $\mathcal M$-measureable random variable satisfying
$$\int_MX\mathrm dP=\int_ME(X|\mathcal M)\mathrm dP
$$ for all $M\in\mathcal M$.
So you have to find out which $\mathcal M$-measureable RV satisfies
$$\int_{\{X>Y\}}X\mathrm dP\color{blue}{=}\int_{\{X>Y\}}E(X|\mathcal M)\mathrm dP,\\
\int_{\{X\leq Y\}}X\mathrm dP\color{blue}{=}\int_{\{X\leq Y\}}E(X|\mathcal M)\mathrm dP,\\
\int_\Omega X\mathrm dP\color{blue}{=}\int_\Omega E(X|\mathcal M)\mathrm dP.
$$
As being $\mathcal M$-measureable it should be constant on the sets $\{X>Y\}$ and $\{X>Y\}^\complement$, i.e. $E(X|\mathcal M)(\omega)=c_1$ for $\omega\in\{X>Y\}$ and $E(X|\mathcal M)(\omega)=c_2$ for $\omega\in\{X\leq Y\}$. So you want to have (calculated for this special case; everything written above holds general)
\begin{align}
\frac{1}{3}=\int_{\{X>Y\}}X\mathrm dP&\color{blue}{=}\int_{\{X>Y\}}c_1\mathrm dP=c_1P(\{X>Y\})=c_1/2,\\
\frac{1}{6}=\int_{\{X\leq Y\}}X\mathrm dP&\color{blue}{=}\int_{\{X\leq Y\}}c_2\mathrm dP=c_2P(\{X\leq Y\})=c_2/2,\\
\frac{1}{2}=E(X)=\int_\Omega X\mathrm dP&\color{blue}{=}\int_\Omega (c_1 \cdot1_{\{X>Y\}}+c_2\cdot1_{\{X\leq Y\}})\mathrm dP\\&=c_1P(\{X>Y\})+c_2P(\{X\leq Y\})=(c_1+c_2)/2.
\end{align}
Usually when you determine this random variable $E(X|\mathcal M)$ you are just interested in the values for $\omega\in\{X>Y\}$, since this is the inital intention of $E(X|X>Y)$. But to write it completely
\begin{align}
E(X|\mathcal M)(\omega)=\begin{cases}c_1=\frac{2}{3}, &\text{for }\omega\in\{X>Y\}\\
c_2=\frac{2}{6}=\frac{1}{3}, &\text{for }\omega\in\{X\leq Y\}.
\end{cases}
\end{align}
A: The cdf of $\mathcal U(0,1)$ is $U(x) = x$, and the the pdf $u(x) = 1$.
Note that $\mathbb E[X|X>Y] = 2\mathbb E[X1_{\{X>Y\}}]$ since $$\mathbb E[X|X>Y] = \frac{\mathbb E[X1_{\{X>Y\}}]}{\mathbb P(X>Y)},$$ and $\mathbb P(X>Y) = \frac{1}{2}$. Moreover, $$\mathbb E[X1_{\{X>Y\}}] = \mathbb E[\mathbb E[X1_{\{X>Y\}}]|X] = \mathbb E[X\mathbb P(X>Y|X)]$$ using the law of iterated expectations. Since $\mathbb P(X>Y|X) =U(X)$, we obtain $$\mathbb E[X1_{\{X>Y\}}] = \mathbb E[XU(X)] = \int_0^1xU(x)u(x)\,\mathrm dx = \int_0^1x^2\,\mathrm dx = \frac{1}{3}$$
