Link between $L^p$ space in analysis and random variables I am having trouble figuring this very simple thing out. Consider the $L^1$ space. Saying that a positive random variable with density lies in $L^1$ means that $\mathbb{E}[X] < \infty$. On the other hand, the density itself lies in $L^1$ in the analysis framework since 
$$ \int_{\mathbb{R}} f(x) dx = 1 < \infty. $$
Does that mean that the two notions of $L^p$ space are not the same ?
I understand that the transfer theorem is probably what's linking the two notions. However I could not figure it correctly. 
 A: The definiton $L^{p}$ depends on the measure under consideration. In Probability Theory a random variable $X$ are defined on a probability space $(\Omega, \mathcal F,P)$ and integrability of $X$ means $\int_{\Omega} |X| dP<\infty$ which may or may not hold. If $X$ has a density $f$ then $f$ is always integrable w.r.t. Lebesgue measure: $\int_{\mathbb R} f(x)dx <\infty$. The statement $X \in L^{1}$ is equivalent to $\int_{\mathbb R} |x| f(x)dx <\infty$. This equivalence comes from the transfer theorem.
A: Indeed, a random variable belongs to $L^p$ if $\mathbb E\left[\left\lvert X\right\rvert^p\right]$ is finite or in other words, that the function $g_p\colon\mathbb R\to \mathbb R$ defined by $g_p(x)=\left\lvert x\right\rvert^p$ is integrable for the law of $X$, denoted $\mu_X$ (that is, for all Borel subset $B$ of $\mathbb R$, $\mu(B)=\mathbb P\left(X\in B\right)$).
When $X$ has a density $f$ with respect to the Lebesgue measure $\lambda$, the equality $\mu_X(B)=\int_B f(x)\mathrm d\lambda(x)$ holds as well as the equivalence
$$
\int_{\mathbb R}\left\lvert x\right\rvert^p f(x)\mathrm d\lambda(x)<+\infty\Leftrightarrow X\in L^p.
$$
