Define $f:[0,1]\to \mathbb{R}$, $f(x):=0$ if $x\notin \mathbb{Q}$, $f(p/q):=1/q$, $q>0$, $p, q$ coprime integers.
Prove that $f$ is regulated.
A function $f:[a,b]\to\Bbb R$ is a regulated function if $\forall \varepsilon>0$ there is a step function $\varphi:[a,b]\to\Bbb R$ such that $sup_{x\in[a,b]}|f(x)-\varphi(x)| <\varepsilon$.
So far I've worked out that $f$ is continuous at all irrational values of $x$ and discontinuous at all rational values of $x$ but I'm unsure what to do next.
Edit: I've also worked out that because $f=0$ or $f=1/q$ and $0<1/q\leqslant 1$ then $0\leqslant f \leqslant 1$. I'm not sure if this helps?