<s>[INST] Let X and Y have a joint uniform distribution on the triangle with corners at $(0, 2)$, $(2, 0)$, and the origin. Find $E(Y | X = 1/2)$ so $f(x,y) = 1/2$ on the region of the triangle.
$f(x) = \int_0^{2-x}\cfrac{1}{2}dy = \cfrac{1}{2}(2-x)$
so $f(y|x) = \cfrac{1/2}{\cfrac{1}{2}(2-x)} = \cfrac{1}{2-x}$
So $E(Y|X=1/2) = \int_0^2y\cfrac{1}{3/2}dy = \int_0^2\cfrac{2}{3}ydy = [\cfrac{2}{6}y^2]^2_0 = 4/3$
But the answer is $3/4$
Where have I gone wrong?
 [/INST] When $X = 1/2$, the support of the conditional density $$f_Y(y \mid x) = \frac{1}{2-x}$$ is not on $Y \in [0,2]$ as suggested by your integral, but rather, $Y \in [0, 2 - 1/2] = [0, 3/2]$.  Therefore, the correct expression is $$\operatorname{E}[Y \mid X = 1/2] = \int_{y=0}^{3/2} y \cdot \frac{1}{3/2} \, dy = \frac{3}{4}.$$
You would not have been led astray had you used indicator functions:
$$f_Y(y \mid x) = \frac{1}{2-x} \mathbb 1 (0 \le y \le 2-x).$$
</s>