Problem: Suppose that $f: [0,1] \to \mathbb{R} $ is a continuous function and $f(x) = 1$ for every irrational number $x \in [0,1]$. Prove that $f \equiv 1$ on $[0,1]$.
Solution: We now that rationals are dense in reals, that is, given any real number $x$, we can always find a sequence of rational numbers $\left\{ q_n \right\} $ such that $q_n \rightarrow x$. Using this we can show that irrationals are also dense in reals. For that we take $x \in \mathbb{R} $. Take q sequence of rationals, say $\left\{ q_n \right\} $ such that $q_n \rightarrow \sqrt{2} x$. Consider the sequence $\left\{ \frac{q_n}{\sqrt{2} } \right\} \subseteq \mathbb{Q} ^c$. It is clear that $\frac{q_n}{\sqrt{2} } \rightarrow x$. We will use this fact to find the value of $f$ on rationals.
Let $x\in [0,1]$ be any rational number. Choose a sequence of irrational numbers, say $x_n$ converging to $x$. Since $f$ is continuous function, we must have $f(x_n) \rightarrow f(x)$. Since $f(x_n) = 1$ for all $n \in \mathbb{N} $ and hence $\{ f(x_n) \} $ is a constant sequence. Thus, $f(x) = 1$. Therefore, we proved that
\[
f(x) \equiv 1,\ x \in [0,1].
\]