# When $X$ and $Y$ are identically distributed they have the same mean

How can I prove this:

If $X$ and $Y$ are identically distributed and $X\in L^1(P)$, then $Y\in L^1(P)$ and $\mathbb{E}(X)=\mathbb{E}(Y)$.

I tried:

We have that for the density function $p_x=p_y$ since $X\sim Y$

$$\mathbb{E}(f(X))=\int f(X)p_x \mathrm{d}x=\int f(x)p_y \mathrm{d}x$$

Now chose the function $f$ to satisfy $f(X)=Y$, then $$\int f(x)p_y \mathrm{d}x=\int yp_y \mathrm{d}y=\mathbb{E}(Y)$$

But I don't think this is correct. Also what is the general notation for the density function?

Thank you for help

• Do you know measure theory? If I say that X,Y define the same measure on the image, do you understand this claim? Commented Sep 5, 2016 at 9:01
• Suppose $X,Y$ nonnegative with same law, you can show with Fubini that $E(X)=\int_{t\geq 0} P(X\geq t) dt$. Then, it follows that $X$ is $L^1$ with same mean. If $X,Y$ are not nonnegative, you can use the previous part to the negative/positive part of $X,Y$ to get the result. Commented Sep 5, 2016 at 9:12
• @anonymus Thank you, one short question, what is the general notation for the density function? Commented Sep 5, 2016 at 10:34
• Generally, i write the density function of a random variable $X$ as $x\mapsto f_X(x)$. Commented Sep 5, 2016 at 11:42

By the change of variable theorem (https://en.wikipedia.org/wiki/Pushforward_measure#Main_property:_Change-of-variables_formula) we have that $X$ is in $L^1(\mathbb P)$ if and only if $\omega \mapsto X(\omega)$ is integrable for $\mathbb P$ if and only if $x\mapsto x$ is integrable for $\mathbb P_X$ (the pushforward of $\mathbb P$ by $X$), and that in this case $\mathbb E[X] \stackrel{def} = \int_\Omega X(\omega) \mathbb P(d\omega) = \int_{\mathbb R} x \mathbb P_{X}(dx)$. The same being true, mutatis mutandis, for $Y$.

But the assumption $X\sim Y$ means exactly (by definition) the equality of measures $\mathbb P_X = \mathbb P_Y$. So we have $X \in L^1 \iff Y \in L^1$ and in that case $\mathbb E[X] = \int_{\mathbb R} x \mathbb P_{X}(dx)=\int_{\mathbb R} x \mathbb P_{Y}(dx) = \mathbb E[Y]$.

• Just a quick update since you just accepted my answer : note that I didn't use the density of $X$ or $Y$ because not all random variables have densities. I only used the distribution$\mathbb P_X$ of $X$ and $Y$, which is a probability measure, and is always defined. Commented Oct 7, 2016 at 11:43