How to Calculate the Lebesgue Integral Question
The measurable function sequence $f_n: X \to \mathbb{R}, n=1, 2, \dots$ is assumed to satisfy $0 \leq f_n \leq f_{n+1} \leq 1$ for each $n \in \mathbb{N}$.
The sequence $\{\mu_n\}_{n=1}^\infty$ is defined by the following and is assumed to be $\mu_n \in (0, \infty)$ for each $n \in \mathbb{N}$:
$$
\mu_n = \int_X f_n\ d\mu.
$$
The function sequence $g_n: X \to \mathbb{R}$ is defined below.
$$
g_1 = \frac{1}{\mu_1}f_1,\\
g_n = -\frac{1}{\mu_{n-1}}f_{n-1} + \frac{1}{\mu_n}f_n\ (\forall n \geq 2).
$$
At this point, we would like to ask the following

*

*$\sum_{n=1}^\infty \int_X g_n\ d\mu = 1 \to$Solved!


*$\int_X \sum_{n=1}^\infty g_n\ d\mu$ if $\lim_{n\to\infty}f_n$ is integrable.


*$\int_X \sum_{n=1}^\infty g_n\ d\mu$ if $\lim_{n\to\infty}f_n$ is NOT integrable.
What I know


*

$$
\sum_{i=1}^n g_i = \frac{1}{\mu_1}f_1 - \frac{1}{\mu_1}f_1 + \frac{1}{\mu_2}f_2 - \dots - \frac{1}{\mu_{n-1}}f_{n-1} + \frac{1}{\mu_n}f_n = \frac{1}{\mu_n}f_n,\\
\sum_{n=1}^\infty g_n = \lim_{n\to\infty}\sum_{i=1}^n g_i = \lim_{n\to\infty} \frac{1}{\mu_n}f_n,\\
\forall n\in\mathbb{N}, f_n \leq f_{n+1} \therefore \int_X f_n d\mu \leq \int_X f_{n+1} d\mu \therefore \mu_n \leq \mu_{n+1}.
$$
Therefore,
$$
\int_X \sum_{n=1}^\infty g_n\ d\mu = \int_X \lim_{n\to\infty} \frac{1}{\mu_n}f_n = \cdots\ ?
$$
We can't use the monotonic convergence theorem now, can we?
When do we use the fact that $\lim_{n\to\infty}f_n$ is integrable?
 A: [This answer is for an earlier verison of the question].
$\sum\limits_{n=1}^{N}g_n$ is a telscopic sum and its value is just $\frac {f_N} {\mu_N}$. Hence, $\sum\limits_{n=1}^{\infty}g_n=\frac f {\mu}$ where $f=\lim f_n$. By monotone convergenceTheorem we get $\int \sum\limits_{n=1}^{\infty}g_n d\mu=1$.
By the same computation of partial sums we get  $ \sum\limits_{n=1}^{\infty} \int g_n d\mu=1$.
Your mistake: $\int g_md \mu$ is actually $0$ for all $n>1$.
A: Notice that $$\sum^\infty_{k=1}\int_Xg_n\,d\mu=\lim_N\sum^N_{n=1}\int_Xg_n\,d\mu=\lim_N\int_X\Big(\sum^N_{n=1}g_n\Big)\,d\mu
$$
Let $f_0=0$ and $\mu_0=1$ so that $g_n=\frac{f_n}{\mu_n}-\frac{f_{n-1}}{\mu_n}$ holds for all $n\in\mathbb{N}$.

*

*Suppose $f=\lim_nf_n\in L_1(\mu)$, that is $\int f\,d\mu<\infty$
(monotone convergence implies that $\lim_n\mu_n=\int_Xf_n\,d\mu=\int_X\lim_nf_n\,d\mu=\int_Xf\,d\mu=:\mu_\infty$. The assumption $f\in L_1$ means that $\mu_\infty<\infty$).
One the one hand, a simple telescopic sum argument yields
\begin{align}
\sum^N_{n=1}\int_Xg_n\,d\mu=\sum^N_{n=1}\int_X\Big(\frac{f_n}{\mu_n}-\frac{f_{n-1}}{\mu_{n-1}}\Big)\,d\mu=\int_X\frac{f_N}{\mu_N}\,d\mu-\int_X\frac{f_0}{\mu_0}\,d\mu=1
\end{align}
One the other hand, another telescopic sum type of argument yields
\begin{align}
\sum^\infty_{n=1}g_n=\lim_N\sum^N_{n=1}g_n=\lim_N\Big(\frac{f_N}{\mu_N}-\frac{f_0}{\mu_0}\Big)=\lim_N\frac{f_N}{\mu_N}=\frac{f}{\mu_\infty}
\end{align}
where $\mu_\infty=\lim_N\int_Xf_n\,d\mu=\int_Xf\,d\mu$.
Putting things together
\begin{align}
\sum^\infty_{n=1}\int_Xg_n\,d\mu&=\lim_N\int_X\sum^N_{n=1}g_n\,d\mu=\lim_N\sum^N_{n=1}\int_Xg_n\,d\mu =1\\
&=\int_X\frac{f}{\mu_\infty}\,d\mu=\int_X\lim_N\sum^N_{n=1}g_n\,d\mu=\int_X\big(\sum^\infty_{n=1}g_n\Big)\,d\mu
\end{align}


*If $\mu_\infty=\infty$, then $\sum_ng_n=0$, in which case we have that
$$\int_X\sum_ng_n\,d\mu=0<\sum^\infty_{n=1}\int_Xg_n\,d\mu=1$$
