Clarifications on $f:S^n \to S^n$ that is a composition of a quotient map $q: S^n \to \bigvee_k S^n$ and another map $p: \bigvee_k S^n \to S^n$ In Hatcher's Algebraic Topology, example 2.31. he constructs a function $f:S^n \to S^n$ as such:

Let $k\in \Bbb N$ and $q:S^n\to {\large\lor}_kS^n$ be the quotient map
obtained by collapsing the complement of $k$ disjoint open balls $B_i$
in $S^n$ to a point. Also let $p:{\large\lor}_kS^n\to S^n$ identify
all the summands to a single sphere. Consider $f=pq$. Now for almost
all $y\in S^n$ we have $f^{-1}(y)$ consisting of one point $x_i$ in
each $B_i$. ... $f$ is a homeomorphism near $x_i$.

I am unsure of several things:

*

*Why must it be "disjoint open balls"? Why not closed? Does the quotient map 'break' somehow?

*Why isn't it the case that for all $y$ we have $f^{-1}(y)$ consisting of one point $x_i$ in each $B_i$ seeing as they are open and therefore do not include the (only) potentially problematic wedge point? (see related post at the bottom).

*Why must $f$ be a homeomorphism near $x_i$? There's no restriction on $f$ being continuous in the text, so $p$ need not be continuous either (unless the wording 'identify all the summands' in $p$'s description mean something I'm not familiar with). Is there no way of constructing some pathological map where for every $x_i$ there isn't such a neighbourhood?

(here is a related post that doesn't provide the clarifications I'm looking for).
Any help would be greatly appreciated.
 A: Note that if the balls are closed and you collapse the complement to a point, then this point is isolated in the quotient. This is what happens when you collapse open sets.
If you pick $y$ as the image of the wedge point (which you can) then the preimage is exactly the complement of all the balls. If you pick $y$ anything else, then your claim holds.
The maps $p,q$ are continuous, and therefore so is $f$. If you pick a neighborhood of $x_i$ that is included in the ball, then you completely avoid the wedge point and everything is fine.
A: I will try to be very explicit with the quotient map, so that you can see why disjoint open balls are required.
An important point:

Let $p\in\Bbb R^{n+1}$ and $0<r<1$ be such that the intersection $\overline{B_r}(p)\cap S^n$ is nonempty. Then, $\overline{B_r(p)}\cap S^n$ is homeomorphic to $D^n$ in such a way that preserves the boundaries.

To see this, 'draw a picture'. You flatten out the intersection, scale it by a suitable radius, and you have yourself a copy of $D^n$. As is often the case, figuring out an explicit map is proving a little messy, I may or may not return to fill one in. Taking this as a given, there are two ways to proceed.

Take the set of these disjoint balls and make them homeomorphic to $D^n$ as above, and consider that we need to find out what the quotient topology on the set: $$Y:=\bigsqcup_{i=1}^k(D^n\setminus S^{n-1})\sqcup\{\ast\}$$Looks like (the homeomorphism restricts to map the intersection of the open ball to an open ball, and the balls are disjoint). We need the topology where a subset of $Y$ is open iff. its image in $S^n$ is open where we replace $\{\ast\}$ with the complement of the balls and each $(D^n\setminus S^{n-1})$ with $B_i\cap S^n$. We see that any open subset of $D^n\setminus S^{n-1}$, including the whole of $D^n\setminus S^{n-1}$ itself, is open in $Y$ (here is one of the places where it is important we use open balls).
So, the only interesting thing is what happens at $\{\ast\}$. $\{\ast\}$ itself is not open in $Y$. Since each $D^n\setminus S^{n-1}$ is open in $Y$, the open neighbourhoods of $\ast$ must be open in every copy of $D^n\setminus S^{n-1}$ that they meet. Say $U\ni\ast$ is open and $V_i:=U\cap(D^n\setminus S^{n-1})_i$ is open and nonempty (in the ball) for some $i$. That $U$ is open in $Y$ means $V_i\sqcup S^{n-1}$ must be open in $D^n$, since - we took open balls! - the complements include the boundaries, which I noted were preserved in the 'obvious' homeomorphism. Conversely, if $U\subseteq Y$ contains $\ast$ and its every intersection $V_i$ is open in $D^n\setminus S^{n-1}$ and each $V_i\sqcup S^{n-1}$ is further open in $D^n$, I claim $U$ is open in $Y$. Just observe that $S^n\setminus\overline{B_i}$ is open in $S^n$ and $U$'s image union the complement of the balls is then open in $S^n$ iff. it is open in each $\overline{B_i}\cap S^n$.
Then, the open subsets of $Y$ when restricted to some $(D^n\setminus S^{n-1})$ are exactly the open subsets of $D^n/S^{n-1}\cong S^n$. The collapsed point in $D^n/S^{n-1}$ corresponds to $\ast$, and we get: $$Y\cong\bigvee_{i=1}^kS^n$$

Another way to proceed might be to do this: construct a map $q:S^n\to\vee_iS^n$ by gluing the following partial functions together:

*

*The partial function defined on the complement of the balls (which is closed!) is the constant map to the wedge point of $\bigvee_iS^n$ (trivially continuous)

*The partial functions defined on each $\overline{B_i}\cap S^n$ are the following composites: $$\overline{B_i}\cap S^n\cong D^n\twoheadrightarrow S^n\overset{\iota_i}{\hookrightarrow}\bigvee_j S^n$$Where $\iota_i$ carries the collapsed point of the image of $S^{n-1}$ to the wedge point and includes $S^n\setminus{\ast}$ into the $i$th component of the wedge sum. The middle quotient is the quotient $D^n/S^{n-1}\cong S^n$, arranged so that the collapsed point is 'the same' for each ball.

These maps are continuous, and they agree on their common domains. Here it is essential that the open balls be disjoint (at least, disjoint in their intersection with $S^n$), otherwise they would not agree on their common domains: as it is, the only common intersection would be with $\partial\overline{B_i}\cap S^n$ and the complement of the open balls, but both get sent identically to the wedge point so these agree. Therefore, by the closed gluing lemma (where it is important we used open balls for a closed complement!) the resultant $q:S^n\to\vee_i S^n$ is continuous, and indeed is a continuous surjection between compact Hausdorff spaces. As such, it is a quotient map. A quotient by what relation? Well, all of its fibres are singletons save for $q^{-1}(\ast)$ - where $\ast$ denotes the wedge point - which has preimage... the complement of the open balls. Therefore this map gives exactly the quotient that Hatcher wants.

For the other questions. $p$ is continuous and so is $f$, and a specific choice of $p$ is implied - there is no freedom to take a 'pathological' $f$.
The map $p$ is defined by gluing, again. On each $S^n$ copy it is simply the identity. This is what it means to identify the summands: if $a\in (S^n)_i$ and $b\in(S^n)_j$ - for two summands $(S^n)_{i,j}$ - are 'the same point', then $p(a)=p(b)$.
Each $S^n$ is closed, and on the common intersections - only the wedge point - they act the same, if the wedge point is understood to be 'the same' point in each copy of $S^n$. So, $p$ is continuous. For any $y\in S^n\setminus{p(\ast)}$, $f^{-1}(y)=q^{-1}(p^{-1}(y))=q^{-1}(\{y_1,y_2,\cdots,y_k\})$ where the $y_i$ are the copies of $y$ in each summand of the wedge sum - as $y\neq p(\ast)$ the $y_\bullet$ are all distinct (the 'same point' but in different summands) - and the quotient $q$ pulls them back to a point $x_i$ in each $B_i\cap S^n$. $q^{-1}$ is a well-defined continuous function away from the wedge point.
$f$ is a homeomorphism near each $x_i$ because each $x_i$ has a neighbourhood, namely $B_i\cap S^n$ itself, on which $f$ is the composite of two embeddings ($p$ and $q$ both act as embeddings away from the wedge point / the complement of the open balls).
