Prove that there doesn't exist any function $f:\mathbb R \to \mathbb R$ that is continuous only at the rational points. Suggestion: For every $n \in \mathbb N$, consider the set $$U_n=\{x \in \mathbb R : \exists U \subset \mathbb R \,\text{open, with}\, x \in U, {\rm diam}(f(U))<1/n\}.$$
I am supposed to prove this statement using the Baire Category theorem. I am not sure but I think that the suggestion points towards trying to express $\mathbb R$ as the union of the sets $U_n$. If I could prove that any $U_n$ is a nowhere dense set and I affirm $\mathbb R=\bigcup_{n \in \mathbb N} U_n$, since the Baire Category theorem says that the interior of a countable union of nowhere dense sets is empty, I would get to an absurd. I have two problems: what does this have to do with the fact that there can't be any function $f$ continuous only at rational points? How can I assure that every $x \in \mathbb R$ is in some $U_n$? Moreover, is there any non-empty $U_n$?
You've got it backwards. It's not $U_n$ that will be nowhere dense, but its complement.
Show that $\bigcap_n U_n$ is precisely the set of points at which $f$ is continuous.
Show that $U_n$ is open.
Suppose $f$ is continuous at the rationals. Show $U_n$ is also dense. Hence, $U_n^c$ is closed and nowhere dense.
Using the previous statement and the fact that the rationals are countable, write $\mathbb{R}$ as a countable union of nowhere dense sets, contradicting the Baire category theorem.
Taking complements can be used to restate the Baire category theorem in the following equivalent way: a countable intersection of dense open subsets of $\mathbb{R}$ is dense.