Finding conditional density $p_{x \vert S}(x \vert s)$ when $S = X + Y$ So in this problem I have two i.i.d random variables $X$ and $Y$, which are uniformly distributed over interval $[0,1]$.
I know that $S = X + Y$.  To find the density of $S$, I find the convolution of $X$ and $Y$.  However I am struggling conceptually to understand what $p_{X \vert S}(x \vert s)$ is, for a given real value of $S$.
The conflict is that $X$ is defined as a uniform over [0,1], so it seems that the pdf should remain just that.  However clearly if we condition on $S$ being 0.5 for example, then $X$ cannot sample values greater than that.
I am inclined to say
$p_{X \vert S}(x \vert s) = \begin{cases}
  \frac{1}{s} & \mathrm{for}\ 0 \le x \le s, \\[8pt]
  0 & \mathrm{otherwise}\ 
  \end{cases} $
But this is clearly wrong if s > 2, or s < 0, and I am not sure it is correct.  Could someone offer advice on how $p_{x \vert S}(x \vert s)$ would be derived?
 A: *

*Given $S = X+Y = s$ where $0 \leq s \leq 1$, the random point $(X,Y)$ is
constrained to be somewhere on the straight-line segment with endpoints 
$(0,s)$ and $(s,0)$. 

*Given $S = X+Y = s$ where $1 < s \leq 2$, the random point $(X,Y)$ is
constrained to be somewhere on the straight-line segment with endpoints 
$(1,s-1)$ and $(s-1,1)$. 
In both cases, $(X,Y)$ is uniformly distributed on the line segment.
Note that conditioned on $S$, $X$ and $Y$ are both continuous random
variables uniformly distributed 
on $[0,s]$ (or $[s-1,1]$ as the case may be), but they are not
jointly continuous; they do not have a joint density function.
In fact, given $S=X+Y=s$, we have that $Y = s-X$ and the two
random variables
are conditionally linearly related. 
So your conditional density $p_{X|S}(x|s) = 1/s$ for $0 \leq x \leq s$ is 
correct for $0 \leq s \leq 1$, but not for $1 < s \leq 2$. The conditional density is undefined for $s < 0$ or $ > 2$ because $S$ cannot take on values outside the interval $[0,2]$. 
