Proof of linearity of abstract integration using simple functions Proof of linearity of abstract integrals for simple functions by Prof. David Gamarnik and Prof. John Tsitsiklis - Lecture notes of Fundamentals of Probability
6-436j OCW MIT
In the proof provided above, it seems very confusing to me that the sum of two simple functions
 $g = \sum_{i=1}^n a_i \mathbf{1}_{A_i}$ 
and $h=\sum_{i=1}^m b_i \mathbf{1}_{B_i}$,
where $\mathbf{1}_{S}$ is the indicator function, 
is given by 
$f = \sum_{i=1}^n \sum_{j=1}^m (a_i+b_j) \mathbf{1}_{A_i\cap B_j}$. 
For example, let $g = 3\times\mathbf{1}_{\omega\geq 0}$ and $h = 2\times\mathbf{1}_{\omega< 0}$.
If $\omega = 2$, then $g(2) = 3, h(2) = 0$, while $f(2) = 0 $ since the intersection of ${\omega\geq 0}$ and ${\omega< 0}$ is empty. 
Moreover, in the third equality in the proof where $\sum_{j=1}^m\mu(A_i\cap B_j)$ is said to be $ = \mu(A_i)$ by finite additivity, how do we know that the union of all intersections of $B_j$'s with $A_i$ will cover all of $A_i$ ? 
Thanks in advance!
Link to lecture notes

As your example show, writing $g+h$ as  $\sum_{i=1}^n \sum_{j=1}^m (a_i+b_j) \mathbf{1}_{A_i\cap B_j}$ may not be the simplest way to write it, because there are a lot of empty sets. Nevertheless, in this way, we are sure that we wrote the sum as a linear combination of indicator function of disjoint sets. In order to verify its validity, if we take an element $x$ in the set of definition, there are several cases:


*

*$x$ belongs to some $A_i$ and some $B_j$: in this case, the double sum is $a_i+b_j=f(x)+g(x)$.

*$x$ does not belong to any $A_i$ but to some $B_j$: in this case, the double sum is $b_j=f(x)+g(x)$.

*$x$ does not belong to any $B_j$ but to some $A_i$: in this case, the double sum is $a_i=f(x)+g(x)$.

*
*

*$x$ does not belong to any $A_i$ and $x$ does not belong to any $B_j$: in this case, the double sum is $0=f(x)+g(x)$.



In writing $h$ as a simple function, we can assume without loss of generality that $\bigcup_{j=1}^m B_j$ equals to whole space, say $X$; otherwise we add $b_{m+1}=0$ and $B_{m+1}= X\setminus\bigcup_{j=1}^m B_j$.   
