Please give your comment and help with the following exercise.
[=>]: Let $y_1, y_2 \in Y, y_1 \neq y_2$.
Since $f$ is surjective, $y_1 = f(x_1), y_2 = f(x_2)$ for some $x_1,x_2 \in X$.
Since $Y$ is Hausdorff, there exist in $Y$ open neighborhoods $N(y_1), N(y_2)$ of $y_1,y_2$ respectively, such that $N(y_1) \cap N(y_2) = \emptyset$.
Since $f$ is continuous, $f^{-1}(N(y_1)) \text{ and } f^{-1}(N(y_2))$ are open in $X$, necessarily disjointed and contain $x_1, x_2$, respectively.
It's here that I got stuck. My idea is to use what I know about $f^{-1}(N(y_1)) \text{ and } f^{-1}(N(y_2))$ to show that $(X \times X)\backslash R$ is open, hence $R$ is closed. But I don't know how to proceed.
[<=]: I might need some hints here also.