[proofplan]
The forward implication is just the normalization forced by total probability: if $f$ is the density of $X$, then evaluating the density identity on all of $\mathbb R$ gives $1=\int_{\mathbb R}f\,d\mathcal L^1$. For the converse, we use the assumed normalization to define a [probability measure](/page/Probability%20Measure) by integrating $f$ over Lebesgue measurable sets. On this [probability space](/page/Probability%20Space), the identity [random variable](/page/Random%20Variable) has exactly the prescribed pushforward law, so $f$ is its density.
[/proofplan]
custom_env
admin
[step:Use total probability to obtain the normalization condition]
Assume that $(\Omega,\mathcal F,\mathbb P)$ is a probability space and that $X:(\Omega,\mathcal F)\to(\mathbb R,\mathcal B(\mathbb R))$ is a real-valued random variable with density $f$. By the definition of density, applied to the Borel set $\mathbb R\in\mathcal B(\mathbb R)$,
\begin{align*}
\mathbb P(X\in \mathbb R)=\int_{\mathbb R} f(x)\,d\mathcal L^1(x).
\end{align*}
Since $X$ is real-valued, $X^{-1}(\mathbb R)=\Omega$, and hence
\begin{align*}
\mathbb P(X\in \mathbb R)=\mathbb P(\Omega)=1.
\end{align*}
Combining the two equalities gives
\begin{align*}
\int_{\mathbb R} f(x)\,d\mathcal L^1(x)=1.
\end{align*}
[/step]
custom_env
admin
[step:Construct a probability measure by integrating the candidate density]Conversely, assume that
\begin{align*}
\int_{\mathbb R} f(x)\,d\mathcal L^1(x)=1.
\end{align*}
Let $\mathcal M$ denote the $\sigma$-algebra of Lebesgue measurable subsets of $\mathbb R$. Define a set function
\begin{align*}
\mathbb P:\mathcal M &\to [0,1]
\end{align*}
\begin{align*}
E &\mapsto \int_E f(x)\,d\mathcal L^1(x).
\end{align*}
The function $f$ is nonnegative and Lebesgue measurable, so the [Lebesgue integral](/page/Lebesgue%20Integral) over measurable sets is countably additive on disjoint unions. Also,
\begin{align*}
\mathbb P(\mathbb R)=\int_{\mathbb R} f(x)\,d\mathcal L^1(x)=1.
\end{align*}
Therefore $(\mathbb R,\mathcal M,\mathbb P)$ is a probability space.[/step]
custom_env
admin
[guided]We now build the probability space directly from the proposed density. Let $\mathcal M$ be the $\sigma$-algebra of Lebesgue measurable subsets of $\mathbb R$. Because $f:\mathbb R\to[0,\infty)$ is Lebesgue measurable, the expression
\begin{align*}
\int_E f(x)\,d\mathcal L^1(x)
\end{align*}
is defined for every $E\in\mathcal M$. Define
\begin{align*}
\mathbb P:\mathcal M &\to [0,1]
\end{align*}
\begin{align*}
E &\mapsto \int_E f(x)\,d\mathcal L^1(x).
\end{align*}
Why is this a probability measure? First, nonnegativity of $f$ gives $\mathbb P(E)\ge 0$ for every $E\in\mathcal M$. Second, if $(E_n)_{n=1}^{\infty}$ is a sequence of pairwise disjoint sets in $\mathcal M$, then the indicator functions satisfy
\begin{align*}
\mathbb 1_{\bigcup_{n=1}^{\infty}E_n}(x)f(x)=\sum_{n=1}^{\infty}\mathbb 1_{E_n}(x)f(x)
\end{align*}
for every $x\in\mathbb R$, where the sum is monotone increasing in the number of terms because every summand is nonnegative. By the monotone convergence property of the Lebesgue integral,
\begin{align*}
\mathbb P\left(\bigcup_{n=1}^{\infty}E_n\right)=\sum_{n=1}^{\infty}\mathbb P(E_n).
\end{align*}
Thus $\mathbb P$ is countably additive. Finally, the assumed normalization gives
\begin{align*}
\mathbb P(\mathbb R)=\int_{\mathbb R} f(x)\,d\mathcal L^1(x)=1.
\end{align*}
Hence $(\mathbb R,\mathcal M,\mathbb P)$ is a probability space.[/guided]
custom_env
admin
[step:Use the identity map to realize the density]
Define the identity map
\begin{align*}
X:(\mathbb R,\mathcal M)&\to(\mathbb R,\mathcal B(\mathbb R))
\end{align*}
\begin{align*}
\omega&\mapsto \omega.
\end{align*}
Since every Borel subset of $\mathbb R$ is Lebesgue measurable, $X$ is measurable. For every $A\in\mathcal B(\mathbb R)$,
\begin{align*}
\mathbb P(X\in A)=\mathbb P(A)=\int_A f(x)\,d\mathcal L^1(x).
\end{align*}
Thus $X$ is a real-valued random variable with density $f$. In particular, $X$ is continuous in the sense of having a Lebesgue density. This proves the converse implication and completes the proof.
[/step]