When Can Integration and Expectation be Exchanged? When is it possible to move expectations into integrals?
I want to find the expectation of a random variable that is defined as an integral. I want to bring the expectation inside the integral, but I'm not sure if/when that is possible.
 A: Generally speaking, the expected value of an integral is an iterated integral, and so the normal mathematical rules for interchange of integrals apply.  To see this more clearly, we first note that the expectation operator is an integration operation.  Formally, a random variable $X$ in the probability space $(\Omega, \mathscr{G}, P)$ has expected value defined by the Lebesgue integral:
$$\mathbb{E}(X) \equiv \int_\Omega X(\omega) dP(\omega).$$
Now, suppose we have a random variable that is an integral over some other function:
$$X(\omega) = \int_\mathbb{R} H(r,\omega) dr.$$
In this case, the expected value can be written as an iterated integral as follows:
$$\mathbb{E}(X) = \int_\Omega \Bigg( \int_\mathbb{R} H(r,\omega) dr \Bigg) dP(\omega).$$
Now, there are a number of theorems relating to when you are allowed to interchange the order of integration in this kind of iterated integral, but the most important is Fubini's theorem.  (If $H$ is a measureable function in the above expression and $\mathbb{E}|H|$ is finite then you will be able to interchange the order of integration under this theorem.)  This is a large subject, so I will not attempt to set it out fully here.  Instead, I will refer you to books on integration and measure theory, which deal with the basis of Lebesgue integration and the application of iterated integrals.  Good luck with your explorations!
