TITLE: Example for non-Riemann integrable functions
QUESTION [9 upvotes]: According to Rudin (Principles of Mathematical Analysis) Riemann integrable functions are defined for bounded functions.For every bounded function defined on a closed interval $[a,b]$ Lower Riemann Sum and Upper Riemann sum are bounded .More mathematically $m(b-a) \leq L(P,f) \leq U(P,f) \leq M(b-a)$ where $m,M$ are lower and upper bounds of the function $f$ respectively. Rudin says that Upper Riemann Sum and Lower Riemann sum always exists,but their equality is the question.
But while searching for non-examples we need to find a bounded function whose upper sum not equal to lower sum.One of the book is given example as $\frac{1}{x}$ in the interval $[0,b]$. But this function is not bounded.
Can we use $\sin(\frac{1}{x})$ in the interval $[0,1]$. Explain how?

REPLY [5 votes]: There is a theorem due Lebesgue that says that a function is Riemann integrable in $[a,b]$ if and only if it's bounded and has the set of discontinuities of measure zero. There is an interesting article (Klippert, John. "Advanced advanced calculus: Counting the discontinuities of a real-valued function with interval domain." Mathematics Magazine (1989): 43-48.) that says we need only to count a specific kind of discontinuity (the discontinuity when both lateral limits don't exists).
The counting function of rationals do the trick, and a nice thing to notice is that this function is the (pontual) limit of Riemann-Integrable functions (just enumerate the Rational numbers and it'll be easy to see).