Two definitions of attaching are equivalent. Suppose $X,Y$ are topological spaces, $A\subset X$ and 
$$
f: A\to Y
$$
is a quotient map, that is, a surjective continuous map with $U\subset Y$ open if and only if $f^{-1}(U)\subset A$ is open. 
We are given two definitions of attachments of $Y$ to $X$ via $f$, namely:


*

*$(X\sqcup Y) /R$, where $R$ is the equivalence relation generated by $x R f(x)$ for $x\in A$.

*$X/\sim$, where $x_1\sim x_2$ if $x_1=x_2$ or, for $x_1, x_2\in A$, $f(x_1)=f(x_2)$.


I want to prove that these definitions are equivalent. Consider the following diagram
$$\require{AMScd}
\begin{CD}
(X\sqcup Y)/R @>{F}>> X/\sim
\\@AApA @AAqA \\
X\sqcup Y @. X
\end{CD}$$
Here, the maps $p$ and $q$ are the canonical projections. The map $F$ is defined as follows:
$$
F: (X\sqcup Y)/R \to X/\sim,
$$
$$
[(x,0)]\mapsto [x].
$$
I claim that $F$ is a homeomorphism. First, of all, $F$ is well-defined, since every element of $(X\sqcup Y)/R$ can be written as $[(x,0)]$ for some $x\in X$. If we have $[(y,1)]$ for some $y\in Y$ then there always exists $a\in A$ such that $f(a)=y$ and so $[(y,1)]=[(a,0)]$. If $[(x_1,0)]=[(x_2,0)]$ then either $x_1=x_2$ and $[x_1]=[x_2]\in X/\sim$ or it might be that $x_1,x_2\in A$ and $f(x_1)=f(x_2)$, but in that case still $[x_1]=[x_2]\in X/\sim$. $F$ has an inverse
$$
F^{-1}:X/\sim \to X\sqcup Y/R,
$$
$$
[x]\mapsto [(x,0)],
$$
with verifications for $F^{-1}$ being well-defined similar to that of $F$. 
The trouble I am having is with bicontinuity. Suppose $U\subset X/\sim$. Then I want to show that $q^{-1}(U)$ is open if and only if $p^{-1}\circ F^{-1}(U)$ is open. Denote $V:=p^{-1}\circ F^{-1} (U)$, then 
$$
V=\{(x,0)\in X\sqcup Y:[x]\in U\}.
$$
Therefore,
$$
q^{-1}(U)=V\cap A.
$$
I am not sure if my last equality is right and how the statement follows from here.

Let $G=F^{-1}$. Given an open set $U\subseteq X\cup_f Y$ (this is a notation for the space obtained by attaching $X$ to $Y$ along $A$ via $f$), such that $W \cap X$ is open in $X$, where $W=p^{-1}(U)$, then $W\cap A$ is open in $A$. But $f^{-1}(W\cap Y)=W\cap A$, and that this is open in $A$ means that $W\cap Y$ is open in $Y$ because $f:A\to Y$ is a quotient map. This implies that $U$ is open. Hence $X\hookrightarrow X\sqcup Y\to X\cup_f Y$ is a quotient map. Now it's easy to conclude that $G$ is a quotient map as well, and hence a homeomorphism.
