Using $\ker$ as an equivalence relation in general topology 
If $h: X \to  Y$ is a function, then $\ker h$ is the equivalence relation on $X$ defined by $x \sim x'$ if $h(x) = h(x')$. The corresponding quotient space is denoted by $X/\ker h$. Note that, given $h: X \to Y$, there always exists an injection $\varphi: X/\ker h \to Y$. Namely, $\varphi([x]) = h(x)$.

I'm trying to digest this example and wondering what do they mean by $\ker h$ being an equivalence relation on $X$. I'm coming from an abstract algbera background and for me $\ker h = \{x\in X \mid h(x)=0\}$. So how can we treat this as an equivalence relation? As $\ker h \subset X$ I can understand that we can form the quotient space $X/\ker h$ using the map $q: X \to X/\ker h$ defined by $$q(x)=\begin{cases} \ker h, x \in \ker h \\ \{x\}, x \notin \ker h \end{cases}$$ but I fail to see how this ties up with the proposed equivalence relation?
 A: Forget about topology for a second.
Given any sets $X$ and $Y$ and a function $f\colon X\to Y$, we can define an equivalence relation $\sim_f$ on $X$ by
$$x_1\sim_f x_2\iff f(x_1)=f(x_2).$$
It is straightforward to verify this is an equivalence relation, given by "have the same image under $f$."
Let us call this equivalence relation (for reasons that will soon become apparent) "the kernel of $f$", $\ker f$.
Note that as a set $\ker f\subseteq X\times X$, like any self-respecting equivalence relation on $X$; you can view it as a set of ordered pairs $(a,b)\in X\times X$, where $(a,b)\in\ker f\iff a\sim_f b\iff f(a)=f(b)$.
Being an equivalence relation, it induces a partition on $X$, denoted $X/\sim_f = X/\ker f$. The elements of $X/\sim_f$ are equivalence classes of elements of $x$,
$$[x]_{\sim_f} = \{x_2\in X\mid x\sim_f x_2\}.$$
And we can define an induced function $\overline{f}\colon X/\sim_f\to Y$ given by $\overline{f}([x]) = f(x)$. This is well-defined, since $[x_1]=[x_2]$ if and only if $x_1\sim_f x_2$, if and only if $f(x_1)=f(x_2)$.
We can do this with any set-theoretic function.
In the abstract algebra setting, we actually use the same definition (see e.g. here. This is the standard definition of "kernel" for semigroups, for example.
It just so happens that in a few special settings that are commonly the first algebraic structures students learn, the equivalence relation associated to a homomorphism is completely determined by the equivalence class of a special element:

*

*For vector spaces over $k$, the kernel relation of a linear transformation $T\colon \mathbf{V}\to\mathbf{W}$ is completely determined by $[\mathbf{0}]_{\sim_T}$.

*For groups, the kernel relation of a group homomorphism $f\colon G\to H$ is completely determined by $[e_G]_{\sim_f}$. (Similar for abelian groups).

*For rings (resp. rings with unity), the kernel relation of a ring homomorphism (resp. unital ring homomorphism) $f\colon R\to S$ is completely determined by $[0]_{\sim_f}$.

For example, with groups, we have that
$$\begin{align*}
[g_1]_{\sim_f}=[g_2]_{\sim_f} &\iff f(g_1)=f(g_2)\\
&\iff f(g_1)(f(g_2))^{-1} = e_H\\
&\iff f(g_1g_2^{-1}) = e_H\\
&\iff f(g_1g_2^{-1})=f(e_G)\\
&\iff [g_1g_2^{-1}]_{\sim_f} = [e_G]_{\sim_f}.
\end{align*}$$
This means that books often define kernels for linear transformations and group homomorphisms as the equivalence class of the identity element, rather than as an equivalence relation on the domain.
However, when one wants to generalize to Universal Algebra (even to monoids, which have identity elements but where the equivalence class of the identity does not determine the equivalence relation), one needs the more general definition. This is related to the notion of "congruence" on an algebra. Here is a lengthy discussion of how these equivalence relations relate to quotients and to normal subgroups in the case of groups.
Now, the key thing to think about is this:

When dealing with sets, given a function $f\colon X\to Y$, the relation $\sim_f$ gives us a (unique) function $\overline{f}\colon X/\sim_f\to Y$ such that $f = \overline{f}\circ\pi$, where $\pi\colon X\to X/\sim_f$ is the function $\pi(x)=[x]_{\sim_f}$.

If we are dealing with groups, rings, topological spaces, where we only care about some functions (group homomorphisms, ring homomorphisms, continuous functions). Given one of these functions $f\colon X\to Y$, we can certainly define $\sim_f$. But:

*

*Can we make $X/\sim_f$ into a structure of the kind we are interested in (Group, ring, topological space, etc) ?

*Can we make it so that $\pi\colon X\to X/\sim_f$ is one of the functions we are about?

*Can we make it so that $\overline{f}\colon X/\sim_f\to Y$ is one of the functions we care about?

For algebras (groups, rings, vector spaces, modules, semigroups, etc) the answer is "yes" in the "usual" way.
For topological spaces, the answer is also yes. First, we define "quotients" for topological spaces, but these are quotients modulo an equivalence relation (not merely a "subspace" or a "special subspace", the way one sometimes thinks about quotients in algebra).
The case of "quotient modulo a subspace" is actually a special case of the general quotient construction: if $U\subseteq X$, we define an equivalence relation $a\sim b$ on $X$ by
$$a\sim b\iff a=b\text{ or }a,b\in U.$$
This collapses $U$ into a single point. But we also define quotients by taking two subsets $U,V\subseteq X$, a function $f\colon U\to V$, and then definining the quotient by "gluing $U$ to $V$ along $f$", defining the equivalence relation
$$a\sim b\iff a=b\text{ or }(a,b\in U\text{ and }f(a)=f(b).$$
And more generally, given any equivalence relation $\sim$ on $X$, we can define the corresponding quotient (with the corresponding quotient topology) $X/\sim$ by using the partition induced on $\sim$ and picking the finest topology that makes $\pi\colon X\to X/\sim$ continuous.
Then we show the map $\pi\colon X\to X/\sim$ is continuous. And here we see that the map $\varphi$ will be continuous whenever $h$ is continuous. So we are realizing this general set-up in the context of topological spaces.

I understand why kernels and quotients are defined the way they are in introductory algebra courses. And with the press for time, it is hard to justify the extra lecture or two it would take to present the more general notion of kernel and quotient before you prove that you can "code" it all with normal subgroups and go with that. But sometimes I wish we would as a matter of course give the general definition and then specialize it.
That said, I often despair of advanced students who, having proven for the case of groups, vector spaces, rings, that one can check injectivity of a morphism by checking elements that map to the identity, struggle mightily by trying to establish the general implication $f(x_1)=f(x_2)\implies  x_1=x_2$ because that's the "correct" definition of injectivity. So maybe it isn't a good idea to drill the general definition in first...
A: Note that the preimages of the singleton subsets of $Y$ partitions $X$, which gives this equivalence relation by the fundamental theorem of equivalence relations.
