# Why doesn't this proof work?

In my youthful naiveté (i.e. fifteen minutes ago), I was trying to prove that if $X$ was a random variable with zero mean, then $XY$ also had zero mean for any random variable $Y$. My proof used integration by parts:

$\int_{\Omega} x(\omega)y(\omega)f(\omega)d\omega = y(\omega) \int_{\Omega}x(\omega)f(\omega)d\omega - \int_{\Omega}[\int_{\Omega}x(\omega)f(\omega)d\omega] dy(\omega)$

Since $X$ has zero mean, $\int_{\Omega} x(\omega)f(\omega)d\omega$ should be $0$, so the entire expression should be $0$. However, I don't think this is true. In fact, if $X \sim N(0, 1)$, then $E(X) = 0$ but $E(X^2) = 1$. What am I doing wrong?

Thanks!

-
$$\int_{\alpha}^{\beta} a(x) b(x)\,\mathrm dx = a(x)B(x)\biggr\vert_{\alpha}^{\beta} - \int_{\alpha}^{\beta} \frac{\mathrm da(x)}{\mathrm dx}B(x)\,\mathrm dx$$ where $B(x)$ is an antiderivative of $b(x)$. – Dilip Sarwate Nov 12 '11 at 1:29
For the first time I see the integration by parts in the integral over a general probability space. You cannot use integration by parts simply because there is no analogue of derivative in your case in general. Moreover, LHS is a constant in your formula while RHS depends on $\omega$ – Ilya Nov 15 '11 at 22:01
@Gortaur: good point, I guess I could just restrict this to the real line then. Thank you :) – badatmath Nov 16 '11 at 7:32
Even when $\Omega$ is $\mathbb R$ or an interval, the formula is ludicrous. Somebody should check the basics of the integration by parts technique. – Did Nov 16 '11 at 15:00

The formula you used in your answer is incorrect and not only because of using integration by parts. It seems that you're mixing definitions of an expectation because sometimes one think of three definitions while there is only one. Just for the case, let us recall some theory. Maybe it seems boring - but I hope if you put a bit of attention to it, you will benefit.

Let us talk only about real-valued random variables. Given some probability space $(\Omega,\mathscr F,\mathsf P)$ the random variable $X$ is a measurable function $$X:(\Omega,\mathscr F)\to(\mathbb R,\mathscr B)$$ where $\mathscr B$ is the Borel $\sigma$-algebra of reals. That means that for any Borel set (i.e. any open or closed set) $B$ the probability $\mathsf P\{X\in B\}$ is well-defined because measurability of $X$ implies $$\{\omega:X(\omega)\in B\}\in\mathscr F$$ and the probability measure $\mathsf P$ is defined for any element of $\mathscr F$. Due to this reason, we can define the expectation of $X$ as just its Lebesgue integral: $$\mathsf E[X] = \int\limits_\Omega X(\omega)\mathsf P(d\omega).$$ In such construction you cannot apply any kind of intergartion by parts in general, since there is no a right analogue for the derivative. On the other hand, you can recall that if we define $$\mathsf Q_X(B) = \mathsf P\{X\in B\}$$ for any $B\in\mathscr B$ then $\mathsf Q_X$ will be a probability measure on $(\mathbb R,\mathscr B)$ called the distribution of $X$. Note that $\mathsf Q_X$ is not the same as $\mathsf P$: first of all, they are defined on different spaces; second, $\mathsf Q_X$ certainly depends on $X$ so probability measure $\mathsf P$ can produce a lot of distributions if we vary $X$.

The benefit from using distributions is that calculation of expectations becomes easier: $$\mathsf E[X] = \int\limits_\Omega X(\omega)\mathsf P(d\omega) = \int\limits_\mathbb R x\,\mathsf Q_X(dx)\quad (1)$$ where $x$ and $\omega$ are just integration variables so that we can call them $y$ and $\zeta$ as an example - it does not matter. Note that going from $\omega$ to $x$ is just a sort of change of variables.

As we already discussed, there are lots of distributions so we should find a kind of common denominator for most of them to be able to calculate the last integral in $(1)$. Such a denominator was chosen to be Lebesgue measure (which is the length of an interval). Further, if $\mathsf Q_X$ has a density w.r.t. to Lebesgue measure, i.e. $$\mathsf Q_X ((a,b]) = \int\limits_a^b f_X(x)\,dx$$ for some function $f$ then $$\mathsf E[X] = \int\limits_\mathbb R x\,\mathsf Q_X(dx) = \int\limits_{-\infty}^\infty x\cdot f_X(x)dx\quad (2)$$ which is maybe the most popular formula to calculate expectations.

Now, what is $\Omega$ if we one to describe only a single random variable? Ok, it appears that in this case that set of reals has enough randomness to model single real-valued random variable: no matter of the original construction we can put $\Omega = \mathbb R, \mathscr F = \mathscr B$ and $\mathsf P = \mathsf Q_X,X = \operatorname{Id}$, i.e. for any $\omega\in \mathbb R$ it holds that $X(\omega) = \omega$. This construction immediately implies $(1)$ since spaces, measures and functions are the same. Bur it does not imply your formula in which you have multiple random variables which cannot be always modeled by taking $\Omega = \mathbb R$.

When you're dealing with two real random variables $X,Y$, you should think not of them as a joint random variable $Z = (X,Y)$ with values in $\mathbb R^2$ because of possible dependence between $X$ and $Y$. That's why if $\mathsf Q_{XY}$ is their joint distribution and $f_{XY}$ is a density of this distribution then you have $$\mathsf E[XY] = \int\limits_{\mathbb R^2}xy\,\mathsf Q_{XY}(dxdy) = \int\limits_{-\infty}^\infty\int\limits_{-\infty}^\infty xy \cdot f_{XY}(x,y)\,dx\,dy$$ and so if you want to apply integration by parts in this integral you should do it in a different way, not like you've done in your question.

-

If $X$ and $Y$ have $0$ mean then $\mathbb{E}(XY)=0$ if $X$ and $Y$ are independent; otherwise one cannot conclude anything about $\mathbb{E}(XY)$. For example, take $X$ to be a random variable with mean $0$ and variance $1$ and $Y=X$.

-