Problem 204
Easy Limits and Functions

The function f(z)= 1, |z| rational; 0, |z| irrational is…

The function $\ f(z)=\begin{cases}1,&|z|\text{ rational}\\0,&|z|\text{ irrational}\end{cases}\ $ is discontinuous at every point. Prove this.

Explanation of Method

At any $z_0$, build a sequence converging to $z_0$ along the same ray $\arg z=\arg z_0$ by perturbing only the modulus $r_0=|z_0|$: nudge $r_0$ by a vanishing rational amount to flip $f$ to $1-f(z_0)$ arbitrarily close to $z_0$, using density of $\mathbb Q$ and of $\mathbb R\setminus\mathbb Q$ in $\mathbb R$.

Case 1 · $|z_0|=r_0$ is rational, so $f(z_0)=1$

Let $\theta_0=\arg(z_0)$ (any branch; if $z_0=0$ treat separately below). By density of the irrationals, pick a sequence of irrational numbers $\alpha_n\to0$ small enough that $r_0+\alpha_n>0$ for all $n$, and set $$ z_n=(r_0+\alpha_n)e^{i\theta_0} $$ Then $z_n\to z_0$, and $|z_n|=r_0+\alpha_n$ is irrational (rational $+$ irrational $=$ irrational), so $f(z_n)=0$ for every $n$. Hence $$ \lim_{n\to\infty}f(z_n)=0\neq1=f(z_0) $$

Case 2 · $|z_0|=r_0$ is irrational, so $f(z_0)=0$

By density of $\mathbb Q$ in $\mathbb R$, pick a sequence of rationals $r_n\to r_0$ (with $r_n>0$ eventually), and set $$ w_n=r_ne^{i\theta_0} $$ Then $w_n\to z_0$ and $|w_n|=r_n$ is rational, so $f(w_n)=1$ for every $n$. Hence $$ \lim_{n\to\infty}f(w_n)=1\neq0=f(z_0) $$

Case $z_0=0$

Here $|z_0|=0\in\mathbb Q$, so $f(0)=1$; take $z_n=\alpha_ne^{i\theta}$ for any fixed $\theta$ and irrational $\alpha_n\to0^+$: $z_n\to0$ with $f(z_n)=0\to0\neq1=f(0)$, matching Case 1's pattern.

Conclusion

In every case, $f(z_n)\not\to f(z_0)$ along an explicitly constructed sequence $z_n\to z_0$, so $f$ fails to be continuous at $z_0$. Since $z_0\in\mathbb C$ was arbitrary, $f$ is discontinuous at every point.

Result

$$ f(z)=\begin{cases}1,&|z|\in\mathbb Q\\0,&|z|\notin\mathbb Q\end{cases}\ \text{is discontinuous at every }z_0\in\mathbb C $$

This is exactly the classical Dirichlet function's pathology, transplanted from $\mathbb R$ to $\mathbb C$ via the modulus: because rationals and irrationals are both dense in every real interval, no punctured neighborhood of any $z_0$ can avoid points where $f$ takes the opposite value.