I found the following exercise in Introduction to Metric and Topological Spaces by Sutherland (Chapter 10 Question 20).
Prove that the topology on a space X is discrete iff the diagonal $\Delta=\{ (x,x) \mid x\in X\}$ is open in the topological product $X \times X$.
I believe I could prove in the $implies$ direction. It is the converse that got me stuck.
So,I would want to prove that if the diagonal is open in the topological product then the topology on $X$ must be discrete.
I was thinking that I could achieve the result if I could show that every singleton $\{ x\}$ is open in $X$, but I couldn't think of a way to establish this. I tried considering $X-\{ x\}$ and try to show that it's closed but I couldn't continue to anything fruitful. Also, I think I could use projection maps but I am stumped as well.
Any help/hint is appreciated. Thanks in advance.