While studying measure theory, I encountered a simple proposition which contains a step I was not able to follow. First, here are some relevant definitions(not all of them, since there would be too many):
Definition: A real-valued function is simple if it has only a finite number of values.
A simple measurable function can be represented in the form $$ \varphi=\sum_{j=1}^{n} a_{j} \chi_{{E}_{j}} $$
where $a_{j} \in \mathbb{R}$ and $\chi_{{E}_{j}}$ is the characteristic function of a set $E_{j}$ in X.
Definition: We define the integral of $\varphi$ with respect to $\mu$ to be the extended real number $$ \int \varphi d \mu=\sum_{j=1}^{n} a_{j} \mu\left(E_{j}\right) $$
What the book states and proves: If $\lambda$ is defined for $E$ in $\boldsymbol{X}$ by $$ \lambda(E)=\int \varphi \chi_{E} d \mu $$ then $\lambda$ is a measure on $X$.
Proof:
Observe that $$ \varphi \chi_{E}=\sum_{j=1}^{n} a_{j} \chi_{E_{j} \cap E} $$
and that $$ \lambda(E)=\int \varphi \chi_{E} d \mu=\sum_{j=1}^{n} a_{j} \int \chi_{E_{j} \cap E} d \mu $$
The above expression is the issue for me. Why does $$\int \varphi \chi_{E} d \mu=\sum_{j=1}^{n} a_{j} \int \chi_{E_{j} \cap E} d \mu$$ holds?
The author is taking the summand $\sum_{j=1}^{n} a_{j}$ out of integral, but I dont know why this is valid, since $a_{j} \in \mathbb{R}$ and therefore the sum may be negative, which is a problem since we only know so far that $$ \int c \varphi d \mu=c \int \varphi d \mu $$ where $c \geq 0$.
References: The elements of Integration and Lebesgue Measure by Robert G. Bartle
Thanks in advance, Lucas
Edit: I went through the Bartle. OP should specify that the above integral is only for non-negative simple functions.
He didn't manipulate any integral. We have that $\mathbb{I}_E\varphi$ is a simple function: $$\mathbb{I}_E\varphi=\sum_{k=1}^na_k\mathbb{I}_{E_k\cap E}$$ So its integral (in OP) is defined as $$\int \mathbb{I}_E\varphi \,d\mu = \sum_{k=1}^na_k\mu(E_k\cap E)$$ We also know that $\mathbb{I}_{E_k\cap E}$ is a (very) simple function, so $$\int \mathbb{I}_{E_k\cap E}d\mu = \mu(E_k\cap E)$$ Therefore $$\int \mathbb{I}_E\varphi \,d\mu=\sum_{k=1}^na_k\int \mathbb{I}_{E_k\cap E}d\mu $$