# Expectation of a uniform point chosen out of a triangle with vertices $(0,0), (1,0), (0,2)$

This is a question from an intro to probability text book. I see that one can represent the interval of $x$ in terms of $y$ like such $[0,(2-y)/2]$. But, for the conditional expectation of $X$ conditioned on $Y=y$, is said to be $$E[X\mid Y=y] = \frac{2-y}{4}\quad \text{for}\;\; 0<y<2,$$ which does not seem right to me. Why would this be the answer?

Problem: Let $X$ and $Y$ be two random variables that are uniformly distributed over the triangle formed by the points $(0,0),\, (1,0)$ and $(0,2)$. Calculate $E[X]$ and $E[Y]$.

-
Please correct the title. –  Did Dec 14 '12 at 6:31
Suppose $Y = y$. Then the interval of possible $x$-values is $[0, 1-y/2] = [0, (2-y)/2]$ as you said. Intuitively: since $x$ is uniformly distributed over this interval, the expectation will be in the middle of the interval. Which is, of course, $(1/2)((2-y)/2) = (2-y)/4$. Thus $E[X \mid Y = y] = (2-y)/4$.
For $X\sim U([a,b])$, we have $E(X)=(a+b)/2$. Put $a=0$ and $b=(2-y)/2$, you get the result.