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