# Upper integral of the sum of 2 piecewise functions

Let $$f,g:[0,1]\to\mathbb{R}$$ be defined by

$$f(x)= \begin{cases} 0& \text{ if }x\in\mathbb{Q},\\ -1& \text{ if }x\notin\mathbb{Q},\\ \end{cases}$$

and

$$g(x)= \begin{cases} -1& \text{ if }x\in\mathbb{Q},\\ 0& \text{ if }x\notin\mathbb{Q},\\ \end{cases}$$

(a) Compute the upper integrals $$\displaystyle\overline{\int_{0}^{1}}f(x)dx$$ and $$\displaystyle\overline{\int_{0}^{1}}g(x)dx$$.

(b) Is it true that $$\displaystyle\overline{\int_{0}^{1}}(f(x)+g(x))dx = \displaystyle\overline{\int_{0}^{1}}f(x)dx+\displaystyle\overline{\int_{0}^{1}}g(x)dx$$?

Here are my solutions, I am wondering if they make sense.

Solution for part (a):

$$S_g(D) = \sum_{i=1}^{n} \delta_i G_i \text{ where } G_i = sup\{g(x): x_{i-1} < x < x_i\}$$ $$S_f(D) = \sum_{i=1}^{n} \delta_i F_i \text{ where } F_i = sup\{f(x): x_{i-1} < x < x_i\}$$

On any interval, there are irrational and rational numbers. This means that:

$$sup\{g(x): x_{i-1} < x < x_i\} = sup\{f(x): x_{i-1} < x < x_i\} = 0$$

As a result, for all divisons $$D$$ of [0 ,1]:

$$\sum_{i=1}^{n} \delta_i G_i = \sum_{i=1}^{n} \delta_i (0) = 0$$

$$\sum_{i=1}^{n} \delta_i F_i = \sum_{i=1}^{n} \delta_i (0) = 0$$

Since the $$S_g(D) = S_f(D) = 0$$ for all divisions of $$[0, 1]$$, it follows that:

$$inf\{S_f(D): \text{D is a division of [0, 1}]\} = inf\{S_g(D): \text{D is a division of [0, 1]}\} = 0$$

Therefore $$\displaystyle\overline{\int_{0}^{1}}f(x)dx = \displaystyle\overline{\int_{0}^{1}}g(x)dx = 0$$

Solution for part (b):

This is not true. Consider the functions $$f$$ and $$g$$ from part a). We showed that

$$\displaystyle\overline{\int_{0}^{1}}f(x)dx = \displaystyle\overline{\int_{0}^{1}}g(x)dx = 0$$.

So $$\displaystyle\overline{\int_{0}^{1}}f(x)dx + \displaystyle\overline{\int_{0}^{1}}g(x)dx = 0$$

let $$h(x) = g(x) + f(x)$$.

if $$x \in \mathbb{Q}$$, we have that $$f(x) = 0$$ and $$g(x) = -1 \implies h(x) = -1 + 0 = -1 \text{ for } x \in \mathbb{Q}$$

if $$x \not\in \mathbb{Q}$$, we have that $$f(x) = -1$$ and $$g(x) = 0 \implies h(x) = 0 + -1 = -1 \text{ for } x \not\in \mathbb{Q}$$

it follows that $$h(x) = -1$$ and therefore the $$sup\{ h(x): x_{i-1 } < x < x_i\} = -1.$$

$$S_h(D) = \sum_{i=1}^{n} \delta_i H_i$$ where $$H_i = sup\{ h(x): x_{i-1 } < x < x_i\}$$ $$= \sum_{i=1}^{n} \delta_i (-1) = \sum_{i=1}^{n} -\delta_i$$

since we are on the interval $$[0, 1]$$, $$\sum_{i=1}^{n}\delta_i = 1 \implies \sum_{i=1}^{n} -\delta_i = -1$$

Therefore, the upper Darboux sums of $$h(x)$$ for any division $$D$$ of $$[0, 1] =-1$$.

This means that $$inf\{S_h(D): \text{ D is a division of [0, 1]}\} = -1$$

and $$\displaystyle\overline{\int_{0}^{1}}h(x)dx = \displaystyle\overline{\int_{0}^{1}}(f(x) + g(x))dx = -1 \ne \displaystyle\overline{\int_{0}^{1}}f(x)dx + \displaystyle\overline{\int_{0}^{1}}g(x)dx = 0$$

Yes, it is correct. However, concerning part b), after having observed that $$h=-1$$, I would then simply add that $$-1$$ is Riemann-integrable and that$$\overline{\int_0^1}h(x)\,\mathrm dx=\int_0^1-1\,\mathrm dx=-1\times(1-0)=-1.$$