Fix \(n\geq 2\) and let \(X,Y_1,\ldots ,Y_n\) be jointly distributed random variables. We say that \(Y_1,\ldots ,Y_n\) are conditionally i.i.d. given \(X\) if \[ \mathbb {P}(Y_1\leq y_1,\ldots ,Y_n\leq y_n\mid X) =\mathbb {P}(Y_1\leq y_1\mid X)\cdots \mathbb {P}(Y_1\leq y_n\mid X) \]
for all \(y_1,\ldots ,y_n\). Show that, if \(Y_1,\ldots ,Y_n\) are conditionally i.i.d. given \(X\), then \[ \operatorname {Var}(Y_1+\cdots +Y_n)=n^2\operatorname {Var}(Y_1)-n(n-1)\mathbb {E}[\operatorname {Var}(Y_1\mid X)]. \]