[step:Apply the nonnegative layer-cake identity to both sides]
We use the following nonnegative layer-cake identity. If $(E,\mathcal E,\mu)$ is a [measure space](/page/Measure%20Space) and $f:E\to[0,\infty]$ is measurable, then
\begin{align*}
\int_E f(y)\,d\mu(y)
=
\int_{[0,\infty)}\mu(\{y\in E:f(y)>t\})\,d\mathcal L^1(t).
\end{align*}
Indeed, for every $y\in E$,
\begin{align*}
f(y)=\int_{[0,\infty)}\mathbb 1_{\{t<f(y)\}}\,d\mathcal L^1(t).
\end{align*}
Define the function $H:E\times[0,\infty)\to[0,\infty]$ by $H(y,t):=\mathbb 1_{\{t<f(y)\}}$. To verify measurability, observe that
\begin{align*}
\{(y,t)\in E\times[0,\infty):t<f(y)\}
=
\bigcup_{r\in\mathbb Q\cap[0,\infty)}\{y\in E:f(y)>r\}\times([0,r)\cap[0,\infty)).
\end{align*}
Each set $\{y\in E:f(y)>r\}$ belongs to $\mathcal E$ because $f$ is measurable, and each set $[0,r)\cap[0,\infty)$ belongs to $\mathcal B([0,\infty))$; the displayed countable union is therefore product-measurable. Hence $H$ is measurable and nonnegative, so Tonelli's theorem gives
\begin{align*}
\int_E f(y)\,d\mu(y)
=
\int_{[0,\infty)}\int_E \mathbb 1_{\{f(y)>t\}}\,d\mu(y)\,d\mathcal L^1(t).
\end{align*}
The inner integral equals $\mu(\{y\in E:f(y)>t\})$, proving the identity in the extended nonnegative sense.
Apply this identity first to the measure space $([0,1],\mathcal B([0,1]),\mathcal L^1)$ and the measurable function $Q_X:[0,1]\to[0,\infty]$. We obtain
\begin{align*}
\int_{[0,1]} Q_X(p)\,d\mathcal L^1(p)
=
\int_{[0,\infty)}\mathcal L^1(\{p\in[0,1]:Q_X(p)>t\})\,d\mathcal L^1(t).
\end{align*}
Using the superlevel identity from the previous step gives
\begin{align*}
\int_{[0,1]} Q_X(p)\,d\mathcal L^1(p)
=
\int_{[0,\infty)}\mathbb P(\{\omega\in\Omega:X(\omega)>t\})\,d\mathcal L^1(t).
\end{align*}
Apply the same layer-cake identity to the measure space $(\Omega,\mathcal F,\mathbb P)$ and the measurable function $X:\Omega\to[0,\infty)$. This gives
\begin{align*}
\mathbb E[X]
=
\int_\Omega X(\omega)\,d\mathbb P(\omega)
=
\int_{[0,\infty)}\mathbb P(\{\omega\in\Omega:X(\omega)>t\})\,d\mathcal L^1(t).
\end{align*}
Comparing the two displayed identities yields
\begin{align*}
\mathbb E[X]=\int_{[0,1]} Q_X(p)\,d\mathcal L^1(p).
\end{align*}
All integrals involved are integrals of nonnegative extended-real-valued functions, so the equality is valid even when the common value is $\infty$.
[/step]