A generalized diagonal? A simple question. Let $ f:X\to Y $ be a function and let $ E_f:=\{(x, y): f (x)=f (y)\}\subset X\times X $. What is the name of the set $ E(f) $? It would be nice to have some reference also. It seems to be a well known notion/construction in set theory or topology, but I couldn't find anything about it. 
Another question is whether the following statement is true: If $ X$ is a connected topological space and the function $ f$ is continuous then $ E_f $ is connected.
 A: $E_f$ is an equivalence relation on $X$ and conversely for every equivalence  relation $R$, you can construct the topological quotient $X/R$ and for the induced map $f:X\to X/R$, $E_f=R$. There are unconnected equivalence relations on connected spaces that contradicts the above statement. 
For example $X=[0,1], R=\{(x,x):x\in X\}\cup\{(0,1),(1,0)\}, X/R = S^1$.
A: I think this is called fibered product (or rather a special case thereof) $X\times_YX$. More generally, one would have two maps $X\to Z$, $Y\to Z$ and fibered product $X\times_ZY$.
A: It's called the kernel or kernel pair of $f$. It is used all over the place in category theory, for example to describe the useful notion of regular category where one sets up Galois connections which in one direction sends a morphism $f: X \to Y$ to the pair of projections $\pi_1, \pi_2: \ker(f) \rightrightarrows X$, and in the other sends a parallel pair $K \rightrightarrows X$ to its coequalizer $X \to Q$. The image of $f: X \to Y$ in such categories is then the coequalizer of its kernel pair. 
A: 
E(f) does not have to be connected even when $\ X\ $ is.

Example: Consider $\ S^1 := \{z\in\mathbb C : |z| = 1\}\ $ -- the unit circle; and also $\ f:S^1\rightarrow S^1\ $ such that:
$$\forall_{z\in S^1}\ f(z):= z^2$$
Then $\ E(f) = \{(u\ v)\in S^1\times S^1 : u^2=v^2\}\ $ is not conected.

REMARK:   If $\ f:X\rightarrow Y\ $ is such that $\ X\ $ is connected, and $\ f^{-1}(y)\ $ is connected for every $\ y\in Y\ $, then $\ E(f)\ $ is connected

Example--just a variation of the above one:   E(f) is disjoint for $\ f:\mathbb R\rightarrow\mathbb R^2 $ given by: $\ \forall_{x\in\mathbb R}\ f(x):= \exp(\imath\cdot x)$.
A: 
@VladimirTkachev, in addition to the general case of maps $\ f:X\rightarrow Y,\ $ was also concerned with the special case of $\ Y:=\mathbb R,\ $ i.e. with $\ X\rightarrow\mathbb R.\ $ I'll give an example (negative) in the extra simple case of $\ f:\mathbb I\rightarrow\mathbb R,\ $ where $\ \mathbb I\ $ is a closed interval.


EXAMPLE   Let $\ f:[-1;1]\rightarrow\mathbb R\ $ be defined by:

$$\forall_{x\in[-1;1]}\quad f(x) := (x+1)\cdot x\cdot(x-1)$$
Then $\ E(f)\ $ is disconnected. Indeed, $\ (-1\,\ 1)\in E(f)\ $ is an isolated point of $\ E(f).\ $ Of course $\ (1\,\ -\!1)\ $ is another isolated point like this, and there are no other isolated points in $\ E(f)$.
PROOF   We have 3 cases:


*

*if $\ (x\ y)\in E(f)\ $ is such that $\ f(x)=f(y) < 0\ $ then both $\ x\ y>0\ $ are positive;

*$\ E(f)\cap f^{-1}(0)\ =\ \{-1\,\ 0\,\ 1\}^2$

*if $\ (x\ y)\in E(f)\ $ is such that $\ f(x)=f(y) > 0\ $ then both $\ x\ y<0\ $ are negative.


Thus the distance (say, Euclidean) from $\ (-1\,\ 1)\ $ or $\ (1\,\ -\!1)\ $ to any other point $\ (x\ y)\in E(f)\ $ is at least $\ 1$.
End of PROOF

(I'll add some comments/extensions).

