Let us define $I(a,b)$ as a line segment between $a,b\in \mathbb{R}^n$ ($(a,b) \in I(a,b)$)
There is a family of problems where there are two sets in $\mathbb{R}^n$ and both of them have some topological property and the task is to show that the family of segments between those two sets have the same properties.
For example
(1) We have two sets $A \subset \mathbb{R}^+$, $B \subset \mathbb{R}^+$ and $A, B$ are both compact (or connected) and we have to show that $I(A,B) = \bigcup\{I((a,0),(0,b)): a\in A, b\in B\} \subset \mathbb{R^2}$ is compact (connected)
(2) $A \subset \mathbb{R}^2\times\{0\}$, $f: A \rightarrow \mathbb{R}$ and $f$ continous let $$X = \bigcup \{I(a,b): b=(0,0,f(a)), a \in A\}$$ prove that if A is compact (or connected) then X is compact (or connected).
How can I prove statements like these? Which tools (or theorems) are useful in these kind of proofs?