[guided]Fix one stratum index $k \in \{1,\dots,K\}$. The goal in this step is to compute the variance of the average of the samples inside this single stratum. Define, for each $j \in \{1,\dots,n_k\}$, the centered random variable
\begin{align*}
Z_{k,j} : \Omega \to \mathbb{R}, \qquad Z_{k,j}(\omega) := g(X_{k,j}(\omega)) - \mu_k
\end{align*}
The centering is useful because variance is the second moment of the centered variable. Since $X_{k,1},\dots,X_{k,n_k}$ are independent and each $Z_{k,j}$ is obtained from $X_{k,j}$ by applying the measurable map $g$ and subtracting the constant $\mu_k$, the variables $Z_{k,1},\dots,Z_{k,n_k}$ are independent. Also,
\begin{align*}
\mathbb{E}[Z_{k,j}] = \mathbb{E}[g(X_{k,j})] - \mu_k = 0
\end{align*}
The equality $\mathbb{E}[g(X_{k,j})] = \mu_k$ holds because all variables $X_{k,j}$ have the same uniform distribution on $D_k$. Similarly, the second centered moment is the common stratum variance:
\begin{align*}
\mathbb{E}[Z_{k,j}^2] = \operatorname{Var}(g(X_{k,j})) = \operatorname{Var}(g(X_{k,1})) = \sigma_k^2
\end{align*}
Now write the centered sample mean in terms of these centered variables:
\begin{align*}
Y_k - \mathbb{E}[Y_k] = \frac{1}{n_k}\sum_{j=1}^{n_k} Z_{k,j}
\end{align*}
By the definition of variance,
\begin{align*}
\operatorname{Var}(Y_k) = \mathbb{E}\left[\left(Y_k - \mathbb{E}[Y_k]\right)^2\right] = \mathbb{E}\left[\left(\frac{1}{n_k}\sum_{j=1}^{n_k} Z_{k,j}\right)^2\right]
\end{align*}
Because the sum is finite, we may expand the square algebraically before taking expectation:
\begin{align*}
\operatorname{Var}(Y_k) = \frac{1}{n_k^2}\sum_{j=1}^{n_k}\sum_{\ell=1}^{n_k}\mathbb{E}[Z_{k,j}Z_{k,\ell}]
\end{align*}
There are two kinds of terms. For off-diagonal terms with $j \neq \ell$, independence gives factorisation of expectation, and the zero means make the term vanish:
\begin{align*}
\mathbb{E}[Z_{k,j}Z_{k,\ell}] = \mathbb{E}[Z_{k,j}]\mathbb{E}[Z_{k,\ell}] = 0
\end{align*}
For diagonal terms with $j = \ell$, the term is exactly the second centered moment:
\begin{align*}
\mathbb{E}[Z_{k,j}Z_{k,j}] = \mathbb{E}[Z_{k,j}^2] = \sigma_k^2
\end{align*}
Thus the double sum has $n_k$ nonzero diagonal contributions, each equal to $\sigma_k^2$. Hence
\begin{align*}
\operatorname{Var}(Y_k) = \frac{1}{n_k^2} n_k \sigma_k^2 = \frac{\sigma_k^2}{n_k}
\end{align*}
This is precisely the variance-reduction factor for averaging $n_k$ independent samples in the $k\text{-th}$ stratum.[/guided]