# Is $E[g(X_1,…,X_n)] = E[E(g(X_1,…,X_n) | X_2,…X_n)]$?

I know that $$E(X_1) = E[E(X_1 | X_2)]$$, but I’m wondering if I can generalize this to $$E[g(X_1,…,X_n)] = E[E(g(X_1,…,X_n) | X_2,…X_n)]$$ based on the following:

$$E(g(X_1,…,X_n)) = \int_{-\infty}^{\infty}\dots\int_{-\infty}^{\infty} g(x_1,…,x_n)f(x_1,\dots,x_n)dx_1\dots dx_n$$

$$= \int_{-\infty}^{\infty}\dots\int_{-\infty}^{\infty} g(x_1,…,x_n)f(x_1 | x_2,\dots,x_n)f(x_2,\dots,x_n)dx_1\dots dx_n$$

$$= \int_{-\infty}^{\infty}\dots\int_{-\infty}^{\infty} g(x_1,…,x_n)f(x_1 | x_2,\dots,x_n)dx_1 f(x_2,\dots,x_n)dx_2\dots dx_n$$

$$= \int_{-\infty}^{\infty}\dots\int_{-\infty}^{\infty} E(g(X_1,…,X_n) | X_2 = x_2, \dots, X_n = x_n) f(x_2,\dots,x_n)dx_2\dots dx_n$$

$$= E[E(g(X_1,…,X_n) | X_2, \dots X_n)]$$

Is this correct?

## 1 Answer

Yes, that equation holds: The law of iterated expectation works for functions of random vectors, as well as random variables. Thus, you can let $$\mathbf{X}_* = (X_2,...,X_n)$$ and you then have:

\begin{aligned} \mathbb{E}(g(X_1,...,X_n)) &= \mathbb{E}(g(X_1,\mathbf{X}_*)) \\[6pt] &= \mathbb{E}(\mathbb{E}(g(X_1,\mathbf{X}_*)|\mathbf{X}_*)) \\[6pt] &= \mathbb{E}(\mathbb{E}(g(X_1,...,X_n)|X_2,...,X_n)). \\[6pt] \end{aligned}