I'm trying to prove the following proposition (from T.Tao's Analysis 1 book):
Let $I$ be a bounded interval, $f\colon I\to\mathbb{R}$ function piecewise constant with respect to both P and P' partitions of $I\Rightarrow p.c.\int_{[P]}f=p.c.\int_{[P']}f$
(where $\int_{[P]}f:=\sum_{J\in P}c_J |J|$, $c_J$ constant value $f$ assumes on each subinterval $J$ of $I$ (this is the meaning of piecewise constant);
a partition P of a bounded interval $I$ is a set of bounded intervals contained in $I$ such that every $x\in I$ lies in exactly one of the bounded intervals $J$ in P;
P#P'$:=\{K\cap J:K\in $ P, J$\in$ P'$\}$)
Now, the book says to use the fact that $|I|=\sum_{J\in P}|J|$ to show that both integrals are equal to $p.c. \int_{[P\#P']}f$ so I did $\int_{[P]}f:=\sum_{J\in P}c_J |J|\overset{*}{=}\sum_{J\in P}(c_J \sum_{\{H\in P\#P':H\subset J\}}|H|)\overset{**}{=}\sum_{J\in P}(\sum_{\{H\in P\#P':H\subset J\}}c_H|H|)$ but I'm stuck here.
(*it's easy to see that $\{H\in$ P#P'; $H\subset J\}$ is a partition of each $J\in P$; ** the subscript $c_J$ can be changed to $c_H$ since $f$ constant on $J\Rightarrow f$ constant with value $c_J$ on $H$ since $H\subset J$)
Any hints?
Take $P=\left \{ a,x_1,\cdots, x_{n-2},b\right \}$ and $P'=\left \{ a,x'_1,\cdots, x'_{m-2},b\right \}$ be two partitions of $I=[a,b]$ and let $A_i=(x_{i-1},x_i]; 0\le i\le n$ where $a=x_0$ and $b=x_{n-1}$ and $B_j=(x_{j-1},x_j]; 0\le j\le m$ where $a=x_0$ and $b=x_{m-1}.$
Then, there are $\left \{ \alpha_i \right \}_i$ and $\left \{ \beta_j \right \}_j$ such that $f(x)=\sum_{i=0}^n \alpha_i \chi(A_i)=\sum_{i=0}^m \beta_j \chi(B_j).$
Now note that $\bigcup_{i,j} A_i\cap B_j=\bigcup_i A_i=\bigcup_j B_j=I$ are disjoint unions, and that $\alpha_i=\beta_j$ on $A_i\cap B_j, $ so that
$\int_I f=\sum_{i=0}^n \alpha_i |A_i|=\sum_{i=0}^n \alpha_i |A_i\cap I|=\sum_{i=0}^n \alpha_i |A_i\cap \bigcup_jB_j|=\sum_{i=0}^n\alpha_i(\sum_{j=0}^m|A_i\cap B_j|)=\sum_{i=0}^n\sum_{j=0}^m\alpha_i|A_i\cap B_j|=\sum_{i=0}^n\sum_{j=0}^m\beta_j|A_i\cap B_j|= \sum_{j=0}^m\sum_{i=0}^n\beta_j|A_i\cap B_j|=\\\sum_{j=0}^m\beta_j|\bigcup_i A_i\cap B_j|=\sum_{j=0}^m\beta_j|I\cap B_j|=\sum_{j=0}^m\beta_j|B_j|.$