Equality of simple functions with measures. 
Let $(X,\mathcal{M},\mu)$ be a measure space. Let $a_i, b_j \geq 0$ and $A_i, B_j \in 
 \mathcal{M}$ of finite measure, for $1 \leq i\leq n$, $1 \leq j \leq m$. If 
      $\sum_{i=1}^n a_i\chi_{A_i} \leq \sum_{j=1}^m b_j\chi_{B_j}$, show that $\sum_{i=1}^n
 a_i\mu(A_i) \leq \sum_{j=1}^m b_j\mu(B_j)$.

This is a homework problem that I'm working on. The hint given was to make use of the canonical form of simple functions, but I'm unsure how to use that in order to show the inequality holds. 
 A: As this is a homework problem, this will be only a hint. My recommendation would be as follows. Suppose we have two measurable, simple functions $s,t$ such that $0\leqslant s$ and $s\leqslant t$. 
First we can write $s$ and $t$ as $s=\sum_{i=1}^m c_i\chi_{C_i}$ where the $C_1, \ldots, C_m$ are disjoint, $c_i\geqslant 0$, and $C_1, \ldots, C_m$ is a partition of the measure space (see my comment above if you aren't sure how to do this).  Do the same thing for $t=\sum_{i=1}^n d_i \chi_{D_i}$.  
Now let $T=\{(i,j): 1\leqslant i\leqslant m, 1\leqslant j\leqslant n, C_i\cap D_j\neq \varnothing\}$ and note that $(C_i\cap D_j)_{(i,j}\in T\}$ is a partition of the measure space, and we may write $$s=\sum_{r\in T} x_r \chi_{S_r}$$ and $$t=\sum_{r\in T}y_r\chi_{S_r}$$ for some numbers $x_r$ and $y_r$.  Now we have written $s$ and $t$ as linear combinations of the same, disjointly supported charcteristic functions, $(\chi_{S_r})_{r\in T}$. From here to the end, it should be okay.  
A: We may decompose everything until comparison becomes trivial. In order to realize this idea, we prepare some notations:


*

*Write $A_{n+j} = B_j$ for convenience.

*For each set $A \subseteq X$, write $ A^{(1)} = A $ and $A^{(0)} = X\setminus A$. (Using indicator functions, $\mathbf{1}_{A^{(1)}} = \mathbf{1}_A$ and $\mathbf{1}_{A^{(0)}} = 1 - \mathbf{1}_A$.)

*Let $\Omega = \{0, 1\}^{n+m}$. For each $\omega = (\omega_1, \cdots, \omega_{n+m}) \in \Omega$, define $ C(\omega) = \bigcap_{i=1}^{n+m} A_i^{(\omega_i)}  $. Then $\{ C(\omega) : \omega \in \Omega\}$ is a partition of $X$ and $ A_i =  \sqcup \{ C(\omega) : \omega \in \Omega, \omega_i = 1\} $, where $\sqcup$ denotes disjoint union.
Then using this, we easily find that $\mathbf{1}_{A_i} = \sum_{\omega \in \Omega} \omega_i \mathbf{1}_{C(\omega)}$ and hence $f := \sum_{i=1}^{n} a_i \mathbf{1}_{A_i}$ is given by
$$ f 
= \sum_{i=1}^{n} a_i \mathbf{1}_{A_i}
= \sum_{i=1}^{n} a_i \left( \sum_{\omega \in \Omega} \omega_i \mathbf{1}_{C(\omega)} \right)
= \sum_{\omega \in \Omega} \underbrace{\left( \sum_{i=1}^{n} a_i \omega_i \right)}_{=: a(\omega) }\mathbf{1}_{C(\omega)} $$
and
$$ \sum_{i=1}^{n} a_i \mu[A_i]
= \sum_{i=1}^{n} a_i \left( \sum_{\omega \in \Omega} \omega_i \mu[C(\omega)] \right)
= \sum_{\omega \in \Omega} \underbrace{\left( \sum_{i=1}^{n} a_i \omega_i \right)}_{=: a(\omega) } \mu[C(\omega)]. $$
Likewise, we may write $g := \sum_{j=1}^{m} b_j \mathbf{1}_{B_j}$ in the form $g = \sum_{\omega \in \Omega} b(\omega)\mathbf{1}_{C(\omega)}$ with some $b(\omega)$'s. Then $\sum_{j=1}^{m} b_j \mu[B_j] = \sum_{\omega\in\Omega} b(\omega)\mu[C(\omega)]$.
Now, whenever $C(\omega) \neq \varnothing$, we may pick $x \in C(\omega)$ to find that $a(\omega) = f(x) \leq g(x) = b(\omega)$. Therefore $a(\omega)\mu[C(\omega)] \leq b(\omega)\mu[C(\omega)]$ holds for all $\omega \in \Omega$ and
$$ \sum_{i=1}^{n} a_i \mu[A_i]
= \sum_{\omega \in \Omega} a(\omega)\mu[C(\omega)]
\leq \sum_{\omega \in \Omega} b(\omega)\mu[C(\omega)]
= \sum_{j=1}^{m} b_j \mu[B_j]. $$
