I am trying to understand the following computation of the conditional expectation: $$ \mathbb{E}\exp(\lambda s_i g_i g_i') = \mathbb{E}(\mathbb{E}(\exp(\lambda s_i g_i g_i')|g_i)) = \mathbb{E}\exp(\lambda^2s_i^2 g_i^2/2), $$ where $g_i, g_i'$ are independent standard normal random variables, $s_i \in \mathbb{R}$. I understand that if we treat $g_i$ as a given constant, the last equality simply follows from the MGF of a Gaussian variable. However, why exactly can we treat $g_i$ as a constant in the second term of the equality?

My definition of conditional expectation is the measure theoretical definition, where the conditional expectation is a random variable such that the integral of the conditional expectation is equal to the integration of the variable we are taking the conditional expectation for on all $\sigma(g_i)$-measurable sets. How does this "substituting $g_i$ as a constant" intuition follow from this definition?

I believe I might just be missing some basic rules of conditional expectations here.


2 Answers 2


For any non-negative measurable function $f$ and indepenednent random variables $X$ and $Y$ we have

$$Ef(X,Z)=\int Ef(X,t)dF_Z(t)$$

This means we can first treat $Z$ as constant $t$ , compute the expectation and then integrate w.r.t. the distribution of $Z$. In terms of conditional expectation this can be written as $$ Ef(X,Z) =EE(f(X,Z)|Z)$$

Proof of above formula is a simple application of Fubini/Tonelli Theorem since the joint distribution of $(X,Z)$ is a product measure.

  • $\begingroup$ This must be obvious, but why is what you are saying here solves the question? How do we apply this rule in this context? Taking $Z$ out doesn't change the fact that $Z$ is still a r.v., not a constant, right? $\endgroup$
    – Partial T
    Nov 2, 2023 at 0:45
  • $\begingroup$ I believe I understand the lemma that you are proving. However, how do we "pull out $g_i$" when $g_i$ is actually in a non-linear exponential function? Could you write out the computation that is happening between the lines using this lemma? $\endgroup$
    – Partial T
    Nov 3, 2023 at 3:48
  • $\begingroup$ Are you claiming that $\mathbb{E}(\mathbb{E}(e^{\lambda s_i g_i g_i'}|g_i)) = \mathbb{E}(g_i \mathbb{E}(e^{\lambda s_i g_i'}|g_i)) = \mathbb{E}(g_i \mathbb{E}(e^{\lambda s_i g_i'})) = RHS$? I don't think this is what you meant by "pulling out" $g_i$, right? I am still not seeing how you can use your lemma here. $\endgroup$
    – Partial T
    Nov 3, 2023 at 19:16
  • $\begingroup$ @PartialT I have edited my answer. $\endgroup$ Nov 4, 2023 at 4:55

What happened is $$E(\exp(\lambda s_i g_i g_i') \mid g_i = x) = E(\exp(\lambda s_i x g_i') \mid g_i = x) = E(\exp(\lambda s_i x g_i')).$$ In general, if $X$ and $Y$ are independent, you can easily prove by definition of conditional expectation that $$E(f(X, Y) \mid X = x) = E(f(x, Y) \mid X = x) = E(f(x, Y)),$$ that is, $$E(f(X, Y) \mid X) = E(f(x, Y))|_{x = X}.$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .