(Expectation)Consider the joint density $f(x,y)=c(x−y)e^{−x}, 0 \le y \le x$. 
Consider the joint density $f(x,y)=c(x−y)e^{−x}, 0 \le y \le x$.


a) Determine the value of c.


b) Calculate the marginal of Y.


c) Calculate the expectation E(Y).

a)$1=\int_0^x c(x−y)e^{−x} = \frac{cx^2e^{-x}}{2} = 1 \to c = \frac{2e^x}{x^2}, x \ne 0 $
b)$F_Y(Y) = \int_{-\infty}^{\infty} f(x,y)dx =\int_y^x\frac{\frac{2e^x}{x^2}(x^2-y)e^{-x}}{2}d_x = \frac{x^2 + y}{x}- y - 1$
c)$E[Y] = \int_{-\infty}^{\infty}yc(x−y)e^{−x}dy =\int_0^xy\frac{2e^x}{x^2}(x−y)e^{−x}dy =\frac{x}{3}$
This is what I managed to do, but I don't know if it's right, it's looking kind of weird, am I by the monos on the right track?
Thanks for any help.
 A: $X$ and $Y$ are jointly distributed, so the total probability over the common support $0 \le Y \le X$ must be $1$.  In other words, you cannot equate the constant $c$ to some function of $x$.  That makes no sense:  $c$ is a number that does not depend on $X$ or $Y$.
Specifically, we must find $c$ such that $$\int_{x=0}^\infty \int_{y=0}^x f_{X,Y}(x,y) \, dy \, dx = 1.$$  This is because the support of the density is the set of all ordered pairs $(X,Y)$ such that $0 \le Y \le X$.
For the second part, you would compute $$f_Y(y) = \int_{x=y}^\infty f_{X,Y}(x,y) \, dx.$$  This result must not be a function of $x$, only of $y$.  Note the interval of integration is $x \in [y, \infty)$ because $0 \le y \le x$.
For the third part, you would compute $$\operatorname{E}[Y] = \int_{y=0}^\infty y f_Y(y) \, dy$$ using the result from the second part.  Note that the interval of integration is not $y \in [0,x]$, because the marginal density of $Y$ does not depend on $x$.
A: I will just point out (a). What you have done for (a) is not correct. You are supposed to get a constant that does not depend on $x$ or $y$.
Write $A$ for the set of all $(x,y) \in \mathbb{R}^2$ such that $0 \leqslant y \leqslant x$. To find $c$, you need to apply the definition of density correctly, that is:
\begin{equation*}
\int_Ac(x-y)e^{-x}dm(x,y)=1
\end{equation*}
Here $m$ denotes the Lebesgue measure in $\mathbb{R}^2$. Therefore:
\begin{equation*}
c=(\int_A(x-y)e^{-x}dm(x,y))^{-1}
\end{equation*}
This is legitimate as the integrand positive in the interior of $A$. All you need to do is to compute out the integral explicitly.
