Adjunction space and composition Let $f:A\rightarrow Y$ and $g:Y\rightarrow W$ be cointinuous functions and let $A\subseteq X$ be a closed subset. I am asked to show that the following adjunction spaces are homeomorphic: 
$$(X\cup_f Y)\cup_g W$$ and $$X\cup_{g\circ f} W.$$
I've been thinking about what elements are related. In the first case, we have $x\sim f(x)$ and then $y\sim g(y)$, where $y$ can belong to $f(A)$ or not. In the second case we have $x\sim g(f(x))$, so the elements of $Y\setminus f(A)$ are not being glued. 
Since they seem to be different, I don't know how to start the proof. I guess that I should use the hypothesis that $A$ is closed, but I don't know how.
 A: This is an answer for the mistyped version of the question, with $f\colon X\to Y$ instead of $f\colon A\to Y$.
If $f$ would go from $A$ to $Y$ then the adjunction space $X\cup_f Y$ would consist of the points of a disjoint union of $X$ and $Y$ with each point $x\in A$ identified to $f(x)\in Y$. However, here $f$ goes from $X$ to $Y$, hence each point of $X$ is identified to some point of $Y$, so $X\cup_f Y$ is just $Y$. The set $A$ is not used. If you look where from are going $g$ and $g\circ f$, you will find what those spaces are.
A: I will use "$\sqcup$" for disjoint union. By "map" I mean continuous function. 
First, note that $A$ closed implies that the canonical map $j:W \to X \sqcup W \to X \cup_{gf} W$ (inclusion and then projection) is an embedding onto a closed subspace.
First define a map $\alpha = 1_X + g:X \sqcup Y \to X \sqcup W$ by $\alpha(x) = x$, $\alpha(y) = g(y)$. Compose with the quotient map to get a map $\alpha':(X \sqcup Y) \to (X \cup_{gf} W)$. By the gluing relations, this induces a map $\alpha'':(X \cup_f Y) \to (X \cup_{gf} W)$. Then, the map $\alpha'' + j:(X \cup_f Y) \sqcup W \to (X \cup_{gf} W)$ induces our homeomorphism-to-be $\phi:(X \cup_f Y) \cup_g W \to (X \cup_{gf} W)$.
Going the other way around, we have a map $i:X \to X \sqcup Y \to (X \cup_f Y)$ which is the composition of the inclusion with the projection. This gives a map $\beta = i+1_W:X \sqcup W \to (X \cup_f Y) \sqcup W$. Composing this with the quotient map, we get $\beta':X \sqcup W \to (X\cup_f Y) \cup_g W$. Again, by the gluing relations, this yields an induced map $\psi:X \cup_{gf} W \to (X\cup_f Y) \cup_g W$.
Chasing the definitions around, we check that $\phi,\psi$ are inverses. First, look at how $\phi$ is defined. Represent $[z] \in (X \cup_f Y) \cup_g W$ by an element $z \in (X \cup_f Y) \sqcup W$. If $z \in W$, $\phi([z]) = j(z)$. If $z = [w] \in X \cup_f Y$, $\phi([z]) = \alpha''(z)$. This reduces to $\phi([z]) = \{w\}$ if $w \in X$ and $\phi([z]) = \{g(w) \}$ if $w \in Y$. (Here the curly brackets denote equivalence classes in $X \cup_{gf} W$.) Next, look at how $\psi$ is defined. Represent $\{z\} \in X \cup_{gf} W$ by $z \in X \sqcup W$. Then $\psi(\{z\}) = [z]$ if $z \in W$ and $\psi(\{z\}) = [i(z)]$ if $z \in X$. So:


*

*If $z \in W$, $\psi(\phi([z])) = \psi(j(z)) = \psi(\{z\}) = [z]$;

*If $z = [w]$ and $w \in X$, $\psi(\phi([z])) = \psi(\{w\}) = [i(w)] = [z];$

*If $z = [w]$ and $w \in Y$, $\psi(\phi([z])) = \psi(\{g(w)\}) = [i(w)] = [z];$

*If $z \in W$, $\phi(\psi(\{z\}) = \phi([z]) = j(z) = \{ z \}$;

*If $z \in X$, $\phi(\psi(\{z\}) = \phi([i(z)]) = \{z\}$.


These computations are so trivial that they leave one feeling rather silly; have we really done anything here? Well, yes: while it is obvious that $\phi$ and $\psi$ must be inverses, what their long-winded definitions really show is that they are well-defined and continuous.

In my opinion, a more satisfying way to see why this is true is as follows: note that the adjunction space is a pushout in the category of topological spaces. Moreover, the concatenation of two pushout squares is also a big pushout square (rectangle). Uniqueness of the pushout yields the statement that we seek to prove.
A: The adjunction space $X\cup_f Y$ can be created in two steps.
First, the points of $X$ are glued together according to the values of $f$, that is,
$x\sim y$ iff $f(x)=f(y)$.
Points of $X\setminus A$ remain unglued.
The topology on $X':=X/\mathord{\sim}$ is such that a set $U$ is open in $X'$
iff $f^{-1}[U]$ is open in $X$ (we used the definition of the quotient topology).
We can naturally translate $f\colon A\to Y$ to a one-to-one map $f'\colon A/\mathord{\sim}\to Y$
by letting $f'([x])=f(x)$ for $x\in A$.
In the second step, points of a disjoint union $X'\cup Y$ are glued together
according to a one-to-one correspondence $f'$, that is, $[x]$ is identified to $f(x)$ for each $x\in A$.
A subset $U$ of the obtained space $X\cup_f Y:=X'\cup Y$ is open iff
sets $U\cap X'$ and $U\cap Y$ are open in $X'$ and $Y$, respectively
(again by the definition of the quotient topology).
We should realize that two topologies we have on the domain and on the range of $f'$ can be completely different.
The resulting topology on the common part of $X\cup_f Y$ (corresponding to pairs of points identified by $f'$)
is the finest topology that is coarser from both. 
These two steps can be taken at once. The space $X\cup_f Y$ is then defined as a disjoint union of $X\setminus A$ and
$Y$, and a set $U\subseteq (X\setminus A)\cup Y$ is open in $X\cup_f Y$ iff
$(U\setminus Y)\cup f^{-1}[U]$ is open in $X$ and $U\cap Y$ is open in $Y$.
To correctly define adjunction space $(X\cup_f Y)\cup_g W$ using $g\colon Y\to W$,
we should ensure that $Y$ is a subspace of $X\cup_f Y$.
To this end we need that the topology on $A/\mathord{\sim}$ is finer than that on $f'[A/\mathord{\sim}]=f[A]$.
Equivalently, for every open set $U\subseteq f[A]$, $f'^{-1}[U]\subseteq A/\mathord{\sim}$ is open, and hence
$f^{-1}[U]\subseteq A$ is open.
This is true as we have assumed that $f\colon A\to Y$ is continuous.
So we can define $(X\cup_f Y)\cup_g W$ as a disjoint union of $(X\cup_f Y)\setminus Y$
and $W$, which is in fact a disjoint union of $(X\setminus A)$ and $W$.
A set $U\subseteq (X\setminus A)\cup W$ is open in $(X\cup_f Y)\cup_g W$ iff
$(U\setminus W)\cup g^{-1}[U]$ is open in $X\cup_f Y$ and $U\cap W$ is open in $W$.
Further, $U':=(U\setminus W)\cup g^{-1}[U]$ is open in $X\cup_f Y$ iff
$(U'\setminus Y)\cup f^{-1}[U']=(U\setminus W)\cup f^{-1}[g^{-1}[U]]$ is
open in $X$ and $g^{-1}[U]$ is open in $Y$.
Since $g\colon Y\to W$ is continuous, if $U\cap W$ is open in $W$ then $g^{-1}[U]=g^{-1}[U\cap W]$ is open in $Y$.
We can conclude that $U\subseteq (X\setminus A)\cup W$ is open in $(X\cup_f Y)\cup_g W$ iff
$(U\setminus W)\cup f^{-1}[g^{-1}[U]]$ is open in $X$ and $U\cap W$ is open in $W$.
The adjunction space $X\cup_{g\circ f}W$ is correctly defined, since $A$ (which is the domain of $g\circ f$)
is a subspace of $X$.
It is again a disjoint union of $X\setminus A$ and $W$, and a set $U\subseteq (X\setminus A)\cup W$ is open
in $X\cup_{g\circ f}W$ iff $(U\setminus W)\cup (g\circ f)^{-1}[U]$ is open in $X$ and $U\cap W$ is open in $W$.
We are done since $(g\circ f)^{-1}[U]=f^{-1}[g^{-1}[U]]$ and we can see that $U$ is open in $X\cup_{g\circ f} W$
iff it is open in $(X\cup_f Y)\cup_g W$.
Let us finally note that we have not used the assumption that $A$ is closed in $X$.
This assumption is sometimes included in the definition of the adjunction space.
If this is our case then we should, when considering the adjunction $(X\cup_f Y)\cup_g W$,
to check that $Y$ is a closed subspace of $X\cup_f Y$.
This is true if $A$ is closed in $X$:
Let $U$ be the complement of $Y$ in $X\cup_f Y$.
Then $U=X\setminus A$ is open in $X\cup_f Y$, as $(U\setminus Y)\cup f^{-1}[U]=U$ is open in $X$
and $U\cap Y=\emptyset$ is open in $Y$.
