I am trying to solve the below problem from Artin's algebra textbook.
Let $a = (a_1, \ldots, a_k)$ and $b = (b_1, \ldots, b_k)$ be points in $k$-dimensional space $\mathbb{R}^k$. A path from $a$ to $b$ is a continuous function on the unit interval $[0,1]$ with values in $\mathbb{R}^k$, a function $X: [0,1] \to \mathbb{R}^k$ sending $t \rightsquigarrow X(t) = (x_1 (t), \ldots, x_k (t))$, such that $X(0) = a$ and $X(1) = b$. If $S$ is a subset of $\mathbb{R}^k$ and if $a$ and $b$ are in $S$, define $a \sim b$ if $a$ and $b$ can be joined by a path lying entirely in $S$.
(a) Show that $\sim$ is an equivalence relation on $S$. Be careful to check that any paths you construct stay within the set $S$. (b) A subset $S$ is path connected if $a \sim b$ for any two points $a$ and $b$ in $S$. Show that every subset $S$ is partitioned into path-connected subsets with the property that any two points in different subsets cannot be connected by a path in $S$. (c) Which of the following loci in $\mathbb{R}^2$ are path connected: $\{x^2 + y^2 = 1\}$, $\{xy = 0\}$, $\{xy = 1\}$?
Below is my attempt. I'll pause at places of confusion for me. The first very important step is that I believe that we eventually need $S$ to be nonempty, at least for part (b). I was under the impression that we can never define an equivalence relation on an empty set, but this doesn't appear to be true: it's rather the "empty relation." I can't exactly "partition" it, though, because a partition requires (1) exhaustive (done); (2) disjointness (done); and (3) non-emptyness (impossible). I don't think I can simply say "the partition is $\{\}$. So I'm going to assume I need to discount an empty $S$ in part (b). Please correct me if I'm wrong.
Another issue is that, for this particular problem, I'm having trouble coming up with ideas. After looking the problem up, I'm able to, for the most part, understand the solution and explain it. Some help on the intuition in, for example, defining the functions in part (a) would also be appreciated.
(a) If $S = \emptyset$, we have the empty relation, which satisfies reflexivity, symmetry, and transitivity vacuously. Suppose $S \neq \emptyset$.
Reflexivity. Let $a = (a_1, \ldots, a_k) \in S \subset \mathbb{R}^k$, and define $$f: [0,1] \to \mathbb{R}^k, \; t \longmapsto a = (a_1, \ldots, a_k).$$ Then $f$ is continuous, as any constant function is continuous. We have $f(0) = f(1) = a$. And $f(t) = a \in S$ for every $t \in [0,1]$, so the path lies entirely in $S$. So $a \sim a$.
Symmetry. Suppose $a \sim b$, where $a,b \in S$. Then there exist a continuous function $f: [0,1] \to \mathbb{R}^k$ with $f(0) = a$, $f(1) = b$, and $f(t) \in S$ for all $t \in [0,1]$. Then define $g: [0,1] \to \mathbb{R}^k$ by $g(t) = f(1-t)$. As $1-t$ and $f$ are continuous functions, $g$ is a composition of continuous functions, hence continuous. Further, we have by construction $$g(0) = f(1-0) = f(1) = b, \; g(1) = f(1-1) = f(0) = a.$$ Further, the map is well defined since $0 \leq t \leq 1$, so $0 \geq -t \geq -1$, so $1 \geq 1-t \leq 0$. But $f(s) \in S$ for all $s \in [0,1]$, so $g(t) = f(1-s) \in S$ for all $t \in T$. So $g$ is a path for $b$ to $a$, so $b \sim a$.
Transitivity. Suppose $a \sim b$ and $b \sim c$, so there exists paths $f$ and $g$ entirely in $S$. Define the new mapping $h: [0,1] \to \mathbb{R}^k$ by the rule $$h(t) = \begin{cases} f(2t) \; & \text{ $0 \leq t \leq \frac{1}{2}$} \\ g(2t-1) \; & \text{ $\frac{1}{2} \leq t \leq 1$} \end{cases} $$ This mapping is well-defined since $f\left(2 \cdot \frac{1}{2}\right) = g\left(2 \cdot \frac{1}{2} - 1\right) = f(1) = g(0) = b$. Further, we have $h(0) = f(2 \cdot 0) = f(0) = a$; $h(1) = g(2 \cdot 1 - 1) = g(1) = c$. Finally, $f(t), g(t) \in S$ for all $t$, so $h(t) \in S$ for all $t$ as well. (We notice that for $0 \leq t \leq \frac{1}{2}$, we have $0 \leq 2t \leq 1$, and for $\frac{1}{2} \leq t \leq 1$, we have $1 \leq 2t \leq 2$ and hence $0 \leq 2t - 1 \leq 1$, so the map is well-defined, based on the domains of $f$ and $g$.
As for continuity, I'm trying to find the best way to prove this. I defined the mapping with $t = \frac{1}{2}$ (1) because the two piece-wise components agree at $\frac{1}{2}$ and (2) I want to invoke continuity on a closed interval, though I don't necessarily have to. So I could instead say that $f$ is continuous, so $h$ is continuous on $[0, 1/2)$; $g$ is continuous, so $h$ is continuous on $(1/2, 1)$. And we have $\lim\limits_{t \to \frac{1}{2}} h(t) = b$ since the $f$ and $g$ components agree, so $h$ is also continuous at $t = \frac{1}{2}$. So $h$ is continuous on $[0,1]$, and gives a path from $a$ to $c$.
I'm a bit shaky on this argument. I'm using the fact, I think, that a piece-wise function is continuous if and only if it is continuous on its piece-wise components. I believe that's true, but don't know exactly how I'd prove it, unless it were just a standard continuity proof by cases. Perhaps I have to induct on the number of different "components"?
(b) Now I assume $S \neq \emptyset$. As $\sim$ is an equivalence relation, it induces a partition on $S$ into equivalence classes of the form $[a] = \{b \in S \mid a \sim b\}$, so any equivalence class $[a]$ is, by definition, path-connected. Furthermore, if $[a] \neq [b]$ are distinct equivalence classes, $[a] \cap [b] = \emptyset$, so $a \not \sim b$, so $a$ and $b$ are not path connected. If they were, then by transitivity, $[a] = [b]$.
(c) I can't figure out how to even attempt this part; some help on where to get started would be great.