I am trying to compute $E[X_2]$ of a joint pdf with random variables $X_1$ and $X_2$ shown below:
$f_{{1},{2}}(x_1,x_2)=\frac{1}{4}(x_1-x_2)e^{-x_1}, 0<x_1<\infty, -x_1<x_2<x_1 $, and $0$ elsewhere
but I am a bit confused because if I try to solve it by first finding marginal pdf of $X_2$, I get
$f_2(x_2)=\int_{0}^{\infty}f_{{1},{2}}(x_1,x_2)dx_1=-\frac{1}{4}x_2-\frac{1}{4}$.
and if I integrate it by $x_2$, I get
$E(x_2)=\int_{-x_1}^{x_1}-\frac{1}{4}x_2^2-\frac{1}{4}x_2dx_2=-\frac{1}{6}x_1^3$
which is function of $x_1$
But if I just do double integration, (instead of getting marginal expectation of $X_2$ first) I get
$\int_{0}^{\infty}\int_{-x_1}^{x_1}\frac{1}{4}(x_1-x_2)e^{-x_1}=-1$
So this time I get a real number as the answer. I am not sure which approach is correct, could anyone help me? (I am guessing the second approach should be the right answer although I am not quite sure. I think this has to do with the fact that interval of $X_2$ is bounded by $x_1$.
Thank you.
If $(X,Y)$ is a random vector absolute continuos its components are random variable absolute continuos with density :
$$f_{X}(x) = \int_{\mathbb{R}} f_{(X,Y)}(x,y) dy, \hspace{0.2cm}f_{Y}(y) = \int_{\mathbb{R}} f_{(X,Y)}(x,y) dx$$
Besides, a random variable $X$ absolute continuos with density $f_{X}$ admits a momentum of order $k$ if and only if $$\mathbb{E} = (|X|^{k}) \int _{\mathbb{R}} |x|^{k}f_{X}(x)dx < +\infty$$
In this case the moment of order $k$ is given by $$\mathbb{E}(X^{k}) = \int _{\mathbb{R}} x^{k}f_{X}(x)dx $$
You just have to verify the above hypothesis since you are just searching $k = 1$.