Properties of a map (attaching map) to the adjunction space According to this article, $X\to X\cup_f Y$ is a closed embedding if $A\subset X$ is closed. I wonder how to prove this.
The adjunction space $X\cup_f Y$ is $X\sqcup Y/{\sim}$. So the map above is the composition of the inclusion map $X\to X\sqcup Y$ and the quotient map $X\sqcup Y\to X\sqcup Y /{\sim}$. The latter map is continuous because if I have a subset of the quotient is open iff its preimage under the quotient map is open. The former map is continuous because given an open set of the disjoint union, it is a union of open sets of $X$ and $Y$, and the preimage of such a union is just the corresponding union of open subsets of $X$, which is open. Thus the composition is continuous. Is this argument correct?
Further, I need to prove injectivity and that the inverse is continuous (on the image); and also that it maps closed sets to closed sets. But I'm stuck at these points.
 A: Suppose that $A \subseteq Y$ is a closed subspace, and $f : A \to X$ is a continous map. Define an equivalence relation on $X \sqcup Y$ by $a \sim f(a), \forall a \in A$. Denote $X \cup_f Y = (X \sqcup Y)/{\sim}$ to be the quotient space, with $q : X \sqcup Y \to X \cup_f Y$ to be the quotient map. So $q|_X : X \to X\cup_f Y$.

To show that $q|_X$ is a closed embedding, first show that $q|_X$ is a closed map. 

Let $B \subseteq X$ is any closed subset. Note that
    \begin{align*}
 &(q|_X)(B) = q(B)\subseteq (X\sqcup Y)/{\sim} \quad \text{ is closed }\\ &\Leftrightarrow q^{-1}(q(B)) \subseteq X \sqcup Y \quad \text{ is closed} \\ &\Leftrightarrow q^{-1}(q(B)) \cap X \text{ and } q^{-1}(q(B)) \cap Y \text{ are both closed}
 \end{align*}
From the equivalence relation, you should be able to show that $$q^{-1}\big(q(B)\big) \cap X = B, \quad q^{-1}\big(q(B)\big) \cap Y = f^{-1}(B).$$
Both subsets above is closed, since $B$ is closed by assumption and $f$ is continous. So $q(B) \subseteq X \cup_f Y$ is closed. Thus $q|_X$ is a closed map. In particlular, $q(X)$ is closed subspace of $X \cup_f Y$.

It is well known that any injective continous closed map is an embedding. So we only need to show that $q|_X$ is injective. 

Given any two points $x_1,x_2 \in X$, the condition $[x_1] = q(x_1) = q(x_2) = [x_2]$ immidiately imply that $x_1=x_2$. So $q|_X$ is injective. This completes the proof that $q|_X : X \to X\cup_f Y$ is a closed embedding.
A: Write down each player:
$$A\subseteq Y$$
$$f:A\to X$$
$$\pi:X\sqcup Y\to X\sqcup Y/\sim$$
$$i:X\to X\sqcup Y$$
$$j=\pi\circ i:X\to X\sqcup Y/\sim$$
where closed $A$ and $f$ are given. $\pi(x)=[x]_{\sim}$ is the projection and $i(x)=x$ the inclusion.

Lemma 1. The restriction $\pi_{|X}$ is an injective closed map.

Proof.


*

*Injective: Indeed, assume that $\pi(x)=\pi(y)$ for some $x,y\in X$. So by the definition $x\sim y$. If neither $x\in f(A)$ nor $y\in f(A)$ then $x=y$. On the other hand our relation is constructed in such a way that if $a\sim b$ and $a\neq b$ then one of $a,b$ is in $A$ and the other in $f(A)$. But since we restricted ourselves to $X$ only then we must have $x=y$.

*Closed: let $C\subseteq X$ be closed. Consider $\pi(C)$ and note that $\pi(C)$ is closed if and only if $\pi^{-1}(\pi(C))$ is closed in $X\sqcup Y$. But this set is equal to $C\cup f^{-1}(C)$. And since $C$ is closed then so is $f^{-1}(C)$ but in $A$. Since $A$ is closed then $f^{-1}(C)$ is closed in $Y$ and thus $C\cup f^{-1}(C)$ is closed in $X\sqcup Y$ which completes the proof. $\Box$


Note: in general whole $\pi$ need not be closed. For that we would need $f$ to be closed, because for $D\subseteq Y$ we have $\pi^{-1}(\pi(D))=D\cup f(A\cap D)$.

Lemma 2. $j$ map is injective and closed.

Proof. This is quite straight forward because $j=\pi_{|X}$. $\Box$

Lemma 3. The inverse of $j$ (as a map from $X$ to $j(X)$) is continuous.

Proof. Let $C\subseteq X$ be closed. Then $(j^{-1})^{-1}(C)=j(C)$ is closed by Lemma 2. The property holds for every closed bijection. $\Box$
Edit: Took me a while to figure out where the assumption about $A$ being closed kicks in. When dealing with closed subsets always carefully analyze in what space are they closed.
