I am reading "Measure, Integration & Real Analysis" by Sheldon Axler.
The following exercise is Exercise 7 on p.23 in Exercises 2A in this book.
I want to prove this exercise using only the knowledge up to page 23 in Axler's book.
Electronic version of "Measure, Integration & Real Analysis (20 December 2022)" is freely available from the author's site.
I think the answers at Prove that $|(a,b) \cup (c,d)| = (b-a) + (d-c) \iff (a,b) \cap (c,d) = \emptyset$ don't use only the knowlege up to page 23 in Axler's book.
Exercise 7 on p.23:
Suppose $a,b,c,d$ are real numbers with $a<b$ and $c<d$. Prove that $$|(a,b)\cup (c,d)|=(b-a)+(d-c)\text{ if and only if }(a,b)\cap (c,d)=\emptyset.$$
My proof is very ugly.
Is my proof ok?
I want to know a clean proof even if my proof is ok.
We use the following proposition in our proof.
2.14 outer measure of a closed interval on p.20:
Suppose $a,b\in\mathbb{R}$, with $a<b$. Then $|[a,b]|=b-a$.
The author proved the following proposition (we call it Lemma 1) in the proof of 2.14 on p.20.
Lemma 1:
Let $I_1,I_2,\dots,I_n$ be open intervals such that $[a,b]\subset I_1\cup I_2\cup\dots\cup I_n$.
Then, $$\sum_{k=1}^{n} \mathcal{l}(I_k)\geq b-a.$$
Lemma 2:
Suppose that $[a,b]\cap [c,d]=\emptyset$.
Then, $|[a,b]\cup [c,d]|=(b-a)+(d-c)$.
My proof of Lemma 2:
Since $[a,b]\cap [c,d]=\emptyset$, $c\notin [a,b]$.
Since $[a,b]\cap [c,d]=\emptyset$, $d\notin [a,b]$.
So, $c<a$ or $b<c$.
So, $d<a$ or $b<d$.
If $c<a$, then $b\not < d$ since $[a,b]\cap [c,d]=\emptyset$.
So, $d<a$.
So, $c<d<a<b$.
If $b<c$, then $a<b<c<d$.
So, $c<d<a<b$ or $a<b<c<d$ holds.
Without loss of generality, we can assume that $a<b<c<d$.
Suppose $I_1,I_2,\dots$ is a sequence of open intervals such that $[a,b]\cup [c,d]\subset\bigcup_{k=1}^{\infty} I_k$.
By the Heine-Borel Theorem (2.12 on p.19), there exists $n\in\mathbb{Z}^+$ such that $$[a,b]\cup [c,d]\subset I_1\cup\dots\cup I_n.$$ Let $J:=\{I_i:I_i\cap [a,b]\neq\emptyset, I_i\cap [c,d]=\emptyset\}.$
Let $K:=\{I_i:I_i\cap [a,b]=\emptyset, I_i\cap [c,d]\neq\emptyset\}.$
Let $L:=\{I_i:I_i\cap [a,b]\neq\emptyset, I_i\cap [c,d]\neq\emptyset\}.$
Let $M:=\{I_i:I_i\cap [a,b]=\emptyset, I_i\cap [c,d]=\emptyset\}.$
Let $I_i\in L$ and $I_i=(e,f)$.
Then, $e<b<c<f$.
Let $L_1:=\{I_i\cap (-\infty,\frac{b+c}{2}):I_i\cap [a,b]\neq\emptyset, I_i\cap [c,d]\neq\emptyset\}.$
Let $L_2:=\{I_i\cap (\frac{b+c}{2},\infty):I_i\cap [a,b]\neq\emptyset, I_i\cap [c,d]\neq\emptyset\}.$
Then, $J\cup L_1$ is a finite open cover of $[a,b]$.
Then, $K\cup L_2$ is a finite open cover of $[c,d]$.
Then, $$\sum_{k=1}^\infty \mathcal{l}(I_k)\geq\sum_{I\subset J\cup K\cup L\cup M}\mathcal{l}(I)\geq\sum_{I\subset J\cup K\cup L}\mathcal{l}(I)\\=\sum_{I\subset J\cup L_1}\mathcal{l}(I)+\sum_{I\subset K\cup L_2}\mathcal{l}(I)\geq (b-a)+(d-c)$$ by Lemma 1.
So, $|[a,b]\cup [c,d]|\geq (b-a)+(d-c)$.
By countable subadditivity of outer measure (2.8 on p.17), $|[a,b]\cup [c,d]|\leq |[a,b]|+|[c,d]|=(b-a)+(d-c)$.
So, $|[a,b]\cup [c,d]|= (b-a)+(d-c)$.
My proof of Exercise 7:
Suppose that $(a,b)\cap (c,d)\neq\emptyset$.
Then, there exists $x$ such that $x\in (a,b)\cap (c,d)$.
So, $\max\{a,c\}<x<\min\{b,d\}$.
So, $\max\{a,c\}<\min\{b,d\}$.
Case 1:
We consider the case in which $a=c=t$.
Then, $(a,b)\cup (c,d)=(t,\max\{b,d\})$.
So, $|(a,b)\cup (c,d)|=\max\{b,d\}-t=\max\{b-t,d-t\}=\max\{b-a,d-c\}<(b-a)+(d-c)$.
Case 2:
We consider the case in which $a\neq c$.
Without loss of generality, we can assume that $a<c$.
Case 2-1:
We consider the case in which $a<c$ and $b\leq d$.
In this case, $c=\max\{a,c\}<\min\{b,d\}=b$.
So, $(a,b)\cup (c,d)=(a,d)$.
So, $|(a,b)\cup (c,d)|=d-a=(b-a)+(d-b)<(b-a)+(d-c)$.
Case 2-2:
We consider the case in which $a<c$ and $d<b$.
$(a,b)\cup (c,d)=(a,b)$.
$|(a,b)\cup (c,d)|=b-a<(b-a)+(d-c)$.Suppose that $(a,b)\cap (c,d)=\emptyset$.
Then, $a\neq c$ since $(a,b)\cap (c,d)=\emptyset$.
Without loss of generality, we can assume that $a<c$.
Since $(a,b)\cap (c,d)=\emptyset$, $b\leq c$.
So, $a<b\leq c<d$.
Case 1:
We consider the case in which $b=c$.
In this case $[a,b]\cup [c,d]=[a,d]$.
For any positive real number $\epsilon$, $[a+\epsilon,b-\epsilon]\cup [c+\epsilon,d-\epsilon]\subset (a,b)\cup (c,d)$.
By Lemma 2, $(b-a)+(d-c)+4\epsilon=|[a+\epsilon,b-\epsilon]\cup [c+\epsilon,d-\epsilon]|\leq|(a,b)\cup (c,d)|\leq|[a,b]\cup [c,d]|=d-a$.
So, $|(a,b)\cup (c,d)|=d-a=(b-a)+(d-c)$.
Case 2:
We consider the case in which $b<c$.
In this case, $[a,b]\cap [c,d]=\emptyset$.
For any positive real number $\epsilon$, $[a+\epsilon,b-\epsilon]\cup [c+\epsilon,d-\epsilon]\subset (a,b)\cup (c,d).$
So, by Lemma 2, $(b-a)+(d-c)+4\epsilon=|[a+\epsilon,b-\epsilon]\cup [c+\epsilon,d-\epsilon]|\leq|(a,b)\cup (c,d)|\leq|[a,b]\cup [c,d]|=(b-a)+(d-c).$
So, $|(a,b)\cup (c,d)|=(b-a)+(d-c)$.
I improved my proof.
We use the result of Exercise 3 on p.23 in Exercises 2A in the book.
My proof of Exercise 3:
We use the result of Exercise 6 on p.23 in Exercises 2A in the book.
My proof of Exercise 6:
My proof of Fact 1:
My proof of Fact 2: