Suppose we have function $f_n$ all p-integrable for $p<\infty$. We define new measurable functions $g_n$ as:

$$g_n := \sum_{i=1}^n f_i$$

Further we assume that $g_n\to g$ in $L^p$. Now why is the following true ($\mu# probability measure):

$$ \int{g d\mu} = \int{\lim_{n\to \infty}\sum_{i=1}^n f_id\mu} = \lim_{n\to \infty} \sum_{i=1}^n \int{f_id\mu}$$

The question is, why could we interchange the limit and the integral? If we know that $f_n\ge 0$ this is clear. But what is for example if $f_n$ are random variables? 

Thanks for your help.

In the usual topology of $\mathbb{R}$, $\mathbb{Q}$ is neither open nor closed.

The interior of $\mathbb{Q}$ is empty (any nonempty interval contains irrationals, so no nonempty open set can be contained in $\mathbb{Q}$). Since $\mathbb{Q}$ does not equal its interior, $\mathbb{Q}$ is not open.

The closure of $\mathbb{Q}$ is all of $\mathbb{R}$: every real number is the limit of a sequence of rationals, so every real number lies in the closure of $\mathbb{Q}$. Since $\mathbb{Q}$ does not equal its closure, it is not closed.

Naturally, since $\mathbb{Q}$ is not open, its complement is not closed; since $\mathbb{Q}$ is not closed, its complement is not open.

But this is in the usual topology. $\mathbb{R}$ can be endowed with lots of topologies, and it is certainly possible for $\mathbb{Q}$ to be open (or closed) in some of them. For example, in the discrete topology, where every subset of $\mathbb{R}$ is both open and closed, $\mathbb{Q}$ is both open and closed.
