Given that $X,Y\sim U(0,1)$ calculate:
(1) $E(X\mid X+Y)$
I am stuck at this point:
$$E(X\mid X+Y)=\int_0^1 xf_{X\mid X+Y}(x\mid x+Y) \, dx=\int_0^1 xf_{X, Y}(x, Y) \, dx$$
Given that $X,Y\sim U(0,1)$ calculate:
(1) $E(X\mid X+Y)$
I am stuck at this point:
$$E(X\mid X+Y)=\int_0^1 xf_{X\mid X+Y}(x\mid x+Y) \, dx=\int_0^1 xf_{X, Y}(x, Y) \, dx$$
On
The answer in the comment by "Did" is probably the best way to do this, but I think we should also look at how to deal correctly with your integral.
pair $(X,Y)$ is uniformly distributed in the square $[0,1]\times[0,1]$. If $0\le s\le 2$, the the set of points where $X+Y = s$ is a line segment passing diagonally through the square. Given the event $X+Y=s$, the random variable $X$ is uniformly distributed on that segment. If $0\le s\le 1$ then $X$ is uniformly distributed on $[0,s]$; if $1\le s\le 2$ then $X$ is uniformly distributed on $[s-1,1]$. (Draw the picture and you'll see that.) Either way, $X$ is uniformly distributed on $\big[\max\{s-1,0\}, \min\{1,s\}\big]$. Hence $$ f_{X\,\mid\,X+Y=s} (x) = \begin{cases} \left.\begin{cases} 1/s & \text{if } 0<x<s \\ 0 & \text{if }x<0 \text{ or }x>s \end{cases} \right\} & \text{if } 0\le s\le 1, \\[10pt] \left.\begin{cases} 1/(2 - s) & \text{if } s-1<x<1, \\ 0 & \text{if } x<s-1, \text{ or } s>2 \end{cases} \right\} & \text{if } 1\le s\le 2. \end{cases} $$ Consequently $$ f_{X\,\mid\,X+Y} (x) = \begin{cases} \left.\begin{cases} 1/(X+Y) & \text{if } 0<x<X+Y \\ 0 & \text{if }x<0 \text{ or }x>X+Y \end{cases} \right\} & \text{if } 0\le X+Y\le 1, \\[10pt] \left.\begin{cases} 1/(2 - X - Y) & \text{if } X+Y-1<x<1, \\ 0 & \text{if } x<X+Y-1, \text{ or } X+Y>2 \end{cases} \right\} & \text{if } 1\le X+Y\le 2. \end{cases} $$ So you need $$ \int_0^2 x f_{X\,\mid \, X+Y}(x)\,dx = \begin{cases} \displaystyle \int_0^{X+Y} \frac x {X+Y} \, dx & \text{if }0\le X+Y\le 1, \\[8pt] \displaystyle \int_{X+Y-1}^1 \frac x {2-X-Y} \, dx & \text{if }1\le X+Y\le 2. \end{cases} $$ Either way, the value of the integral is $\dfrac{X+Y}2$. To get that from the second integral, I had to know that $$ \frac 1 2 \cdot\frac{1 - (X+Y-1)^2}{2-X-Y} = \frac 1 2 \cdot \frac{(2-X-Y)(X+Y)}{2-X-Y}, $$ and it might have taken me a while to figure that out if I had not had $\text{“}$Did$\text{''}$'s solution to guide me.
So:
We know $(X,X+Y)\sim U(D)$ (i.e., a uniform distribution over $D$), where $D$ is the shaded area as below:
So $$ X\mid X+Y\sim \begin{cases} U[0,X+Y] & \text{if } 0\le X+Y\le 1\\ U[X+Y-1,1] & \text{if } 1\le X+Y \le 2 \end{cases} $$
In either case, $E[X\mid X+Y]=\frac{1}{2}(X+Y)$.