# difference between expectation of a random variable in measure theory and in regular calculus probability books

let X be a random variable with a density function $f_{X}(x)$. The expectation of X is defined as

$E[X] = \int x f_{X}(x) dx$

While in the probability books that uses the measure theory it is defined as

$E[X] = \int X dP$

how are these two definitions related? and if I have another random variable Y is its expectation defined in a similar manner, i.e., :

$E[Y] = \int Y dP$

if yes, how can I know that I am integrating with respect to r.v X or Y ?

any help is appreciated

• It's a question of notational style. The probability books' notation is intended to be useful even if the distributions do not have densities. But the calculus books' notation is intended to make it easy to recognize integration exercises in story problems. There almost as many different notations for writing integrals of the sort you ask about as there are mathematics books, so some inconvenience is to be expected. Jan 4, 2018 at 13:00

Let $(\Omega,\mathcal{A},P)$ be a probabilty space, $(\mathbb{R},\mathcal{B})$ a measurable space and $X\colon \Omega\to\mathbb{R}$ a random variable. The expected value of $X$ is defined as the Lebesgue integral \begin{align} \mathbb{E}_P(X):=\int_{\Omega}X\,\mathrm{d}P \end{align} and by the change of variables formula it holds \begin{align} \int_{\Omega}X\,\mathrm{d}P=\int_{\mathbb{R}}x\,\mathrm{d}P_{X} \end{align} where $P_X:=P\circ X^{-1}$ is the distribution (push forward, image measure, $\ldots$) of $X$ with respect to $P$. If $X$ has a probabilty density function $f=\frac{\mathrm{d}P_X}{\mathrm{d}\lambda}$, we can write \begin{align} \int_{\mathbb{R}}x\,\mathrm{d}P_{X}=\int_{\mathbb{R}}x\cdot f(x)\;\mathrm{d}\lambda(x) \end{align}
• what do you mean by "change of variables formula"? and what does $\lambda$ represent in this context? Jan 4, 2018 at 17:06
• @Jasmine In this context $\lambda$ represents the lebesgue measure as usual in measure and probability theory. For the other question please take a look at this wikipedia entry and read the sections "definition" and "main property: change of variable formula" Jan 5, 2018 at 8:17
• thank you for your reply. I have another question, in the second formula that you posted, what is the difference between $X$ and $x$, and is the final integration Lebesgue integration ? and could you please answer the second part of the question, if I have a second R.V, how can I know that I am integrating with respect to y (without using the change of variable formula) ? Jan 6, 2018 at 7:45
• @Jasmine Well, $X$ is the random variable and $x$ is the value of the real function $\mathrm{id}\colon\mathbb{R}\to\mathbb{R},x\mapsto x$. The final integration in my answer above is a lebesgue integration, but often you can calculate it as a usual with fundamental theorem of calculus. For $\mathbb{E}(Y)=\int Y dP$ we have $\int Y dP=\int y dP_Y$ Jan 6, 2018 at 12:56
• thanks for the reply, when I need to work with the integration in the original equation, how can I deal with $X$? I mean I keep it as $X$, or I substitute it with its density function? also could you please help me answering this question and this question Jan 7, 2018 at 6:59