# Marginal Density and Expected value of two continous random variables

I'm trying to find the expected value of a random variable using its marginal pdf.

Suppose the joint pdf of $X$ and $Y$ is $$f_{XY}(x,y) = \begin{cases}1 && 0<x<1, x<y<x+1\\0 && otherwise\end{cases}$$ Find E(X) and E(Y).

Here's my process for finding $E(X)$

$$f_x = \int_{-\infty}^{\infty}f_{XY}dy = \int_{0}^{1}1dy + \int_{1}^{x+1}1dy\\=1 + x\\$$

Also

$$f_y = \int_{-\infty}^{\infty}f_{XY}dx = \int_{0}^{y}1dy + \int_{0}^{1}1dy\\=y + 1\\$$

Hence

$$E(X)=\int_{-\infty}^{\infty}xf_{X}dx = \int_{0}^{y}x(1+x)dx + \int_{0}^{1}x(1+x)dx$$

In which the final answer will be a function of $y$, hence I stopped. The book's answer is $1/2$.

Can you point out where did I go wrong?

• Using indicator functions to express densities would save you, nolens volens... – Did Oct 18 '17 at 16:02