Calculate the conditional expectation for a uniformly distributed variable 
Let $X$ be a random variable with a uniform distribution over $(0,1)$ and $Y$ be a random variable with a uniform distribution over $(0,x)$, $x$ being a specific value of $X$. Calculate $E(Y | X = x)$. 

I was wondering if it was correct to say that $E(Y|X=x) \sim U(0,x)$ and the mean of a uniform distribution on an interval $(a,b)$ is given by $\dfrac{a+b}{2}$, which means that we have $E(Y | X = x) = \dfrac{x}{2}?$
The reason I'm doubting this is because the above is also valid for $E(Y)$, so that means that $E(Y|X=x)$ and $E(Y)$ would have the same expected mean. I don't know if you're simply allowed to assume this.
 A: Yes, you are right. Since $Y|X = x\sim U(0,x)$, then 
$$E[Y|X=x] = \frac{0+x}{2}= \frac{x}{2}$$
immediately. We can confirm via calculus.
$$E[Y|X=x] = \int_0^x y\cdot f_{Y|X}(y|x) \,dy = \int_0^xy\cdot \frac{1}{x}\,dy = \frac{x}{2}.$$
You are wrong about this "is also valid for $E[Y]$". It is not true that $E[Y|X=x] = E[Y]$. First, notice that $E[Y|X=x]$ is a function of $X$, whereas $E[Y]$ will be a real number. Alternatively, you were not given the distribution of $Y$. You can find the marginal distribution by integrating out $x$ using $f_{X,Y}(x,y) = f_{Y|X}(y|x)f_X(x).$ Then you can use $f_Y(y)$ to find the expectation of $Y$ and verify that the expectations are not equal.
A: Remember that $x$ is just a value from the random variable $X$.
The correct statement is that $Y|X=x \sim U(0,x)$ and then you are right, the $E(Y | X = x) = \dfrac{x}{2}$.
Thus, the $E(Y)$ is not the same as $E(Y|X=x)$.
The $E(Y) = \int_{-\infty}^{\infty} yf(y)dy $, where $f(y) = \dfrac{1}{x}$ if $y\in[0,x]$, otherwise $0$
