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.
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.