# Expectation in restricted bivariate distribution

It says: Let $$X$$ and $$Y$$ be two jointly continuous random variables with joint PDF

$$\begin{equation} \nonumber f_{XY}(x,y) = \left\{ \begin{array}{l l} 2 & \quad y+x \leq 1, x>0, y>0 \\ & \quad \\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation}$$

To find $$E[X]$$, I would expect it to be:

$$E[X] = \int_{0}^{1-y}{2dx}$$

And have $$E[X]$$ be a function of $$y$$.

But the solution actualy integrates the function over $$y$$ to get a function of $$x$$ and then integrate again to get $$E[X]$$:

\begin{align}%\label{} \nonumber f_X(x)&=\int_{-\infty}^{\infty} f_{XY}(x,y)dy \\ \nonumber &=\int_{0}^{1-x}2dy\\ \nonumber &=2(1-x). \end{align}

\begin{align}%\label{} \nonumber E[X]&=\int_{0}^{1}2x(1-x)dx\\ \nonumber &=\frac{1}{3}=EY, \end{align}

What is the idea behind integrating a bivariate $$PDF_{x,y}$$ before integrating to calculate the $$E[X]$$.

• Replacing an earlier, now deleted, comment ... $E[X] := \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}\, x f_{XY}(x, y)\, dx \, dy.$ With the integration over $y$ first this reduces to $\int_{-\infty}^{\infty}\, x f_{X}(x)\, dx$ where $f_X(x) := \int_{-\infty}^{\infty}\, f_{XY}(x, y)\, dy.$ Jan 6 at 1:41

The expectation of $$X$$ is a number here, which we compute by first finding the marginal distribution of $$X$$ (hence the integration over the joint density for all possible values of $$X$$). From the probability distribution of a random variable...we can compute its expectation (if it exists).
I don't see any reason it would be a function of $$Y$$.