Let $a=(a_1,\dots, a_k)$ and $b=(b_1,\dots, b_k)$ be points in $k$-dimentional space $\mathbb{R}^k$. A $\textit{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] \rightarrow \mathbb{R}^k$, sending $t \mapsto X(t)=(x_1(t),\dots, 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 subset $S$ is path connected if $a \sim b$ for any two points $a$ and $b$ in S. I would like to show that every subset $S$ is partitioned into path-connected subsets with the property that two points in different subsets cannot be connected by a path in $S$.
If you show that path-connectedness constitutes an equivalence relation on $S$ by defining $a\sim b$ if there exists a path in $S$ joining $a$ and $b$, then you are done.
If $f$ is a path joining $a$ and $b$, and $g$ is a path joining $b$ and $c$, define $g\cdot f$ to be the path $$t\mapsto\begin{cases} f(2t), &\text{ if } 0\le t\le 1/2 \\ g(2t-1),&\text{ if } 1/2\le t\le 1 \end{cases}$$ Can you show that $g\cdot f$ is continuous?
The proof of symmetry and reflexivity is equally easy.
The equivalence classes of $S$ under $\sim$ are called path-components.
If $a,b$ are two points in the path-component $P,$ then they can be joined by a path $f$. This path must lie entirely in $P,$ for if $f(s)=y$ for some $y\notin P,$ and $s\in(0,1)$ then we could restrict $f$ to a path joining $a$ and $y$.