The question states:
Define the function (where $n$ is in the positive integers) $$f(x)=\begin{cases} x, & \text{if $x=\frac{1}{n^2}$} \\ 0, & \text{if $x\neq\frac{1}{n^2}$} \end{cases}$$ Prove that $f$ is integrable on $[0,1]$ and that $\int_0^1f(x)\,dx=0$.
The textbook solutions uses the Riemann criterion to prove this.
My proof, on the other hand, went as follows:
Define a partition $P$ of $[0,1]$. $P=\{0,\dots,\frac{1}{n^2},\dots,1\}$. Then $n$ is constant on each open subinterval $(x_{k-1},x_k)$ of $P$. Moreover, $f(x)=0$ on all open subintervals of $P$. Hence $f$ is integrable. We then have $\int_0^1f(x)\,dx=\sum0\times(x_k-x_{k-1})=0$.
Using the Riemann criterion seems to me like 'overkill' given that this seems to me to be a step function, however I may be wrong, of course. Could anyone tell me if this is a valid proof, or must I use more sophisticated techniques like in the textbook?