Find the equivalence class of $X\coprod Y$ 
Define $i_X:X\rightarrow X\coprod Y$ as the inclusion mapping $i_X(x)=x$, and similarily $i_Y:Y\rightarrow X\coprod Y$ as the inclusion mapping $i_Y(y)=y$.
Let $X$ and $Y$ be topological spaces. Define a closed subspace $D\subset Y$ with it's inclusion mapping $g:D\rightarrow Y$, and continuous mapping $f:D\rightarrow X$. Let $\sim$ be the equivalence relation on $X\coprod Y$ created by the relation $i_X\circ f(d)\sim i_Y\circ g(d)$ for each $d\in D$.
Show that the equivalence classes in $X\coprod Y$ are of the following:
$\{i_X(x)\}$ if $x\in (X-image(f))$
$\{i_X(f(d))\}\cup i_Y\circ g(f^{-1}(f(d)))$, for $d\in D$
$\{i_Y(y)\}$ if $y\in (Y-D)$

I honestly have no clue how to even attempt this problem. I know that an equivalence class is a set of the form $[a]=\{x\in X:a\sim x\}$ for $a\in X$, but where/how do I start? I apologize for the lack of work and any hints would be much appreciated!
 A: Taking some quotient of a disjoint union is a typical construction in topology, it is the formalization for gluing two spaces $X$ and $Y$ along certain given subspaces/maps. 
Maybe an easier example of gluing can help to get the feeling:
Try to formalize the case of gluing two segments together into a circle at their endpoints.
Now, we have $X\sqcup Y$ which consists of points of $X$ (these are $i_X(x)$ for $x\in X$) and points of $Y$ (these are $i_Y(y)$ for $y\in Y$), which are so far separated from each other. 
Then, we pick $d\in D\,\subseteq Y$ and glue it to [identify it with] $\ f(d)\,\in X\ $ in the quotient space $X\sqcup Y/\sim$.
(Taking the quotient by an equivalence relation basically forces that relation to actually be equality in the quotient set.)
So, to the questions:
i) If $x$ is not in the image of $f$, then $x$ is not glued to nobody on the other side, so the copy $i_X(x)$ of $x$ will be alone in its equivalence class. (This is by definition of $\sim$.)
iii) The same holds for any $y\notin D$.
ii) Finally, if $d\in D$, then it is now glued to $f(d)$ on the other side, i.e. $i_Y(d)\sim i_X(f(d))$. 
 Who else are they glued, too?
 Note that $\sim$ must be an equivalence relation, and $f$ need not be e.g. injective.
 Well, if $f(d')=f(d)$ happens for another $d'\in D$, then we have $i_Y(d')\sim i_X(f(d))$ as well, so $i_Y(d')$ is in the same class. 
 In fact, we collect all those: that is, we take the inverse image $f^{-1}(\, f(d)\,)$.
