Example for non-Riemann integrable functions 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?
 A: The easiest example to use is the indicator function of the rationals. It takes the value 1 for rational numbers and the value 0 for irrational numbers. Since both the rationals and the irrationals are dense in $\mathbb{R}$, the highest value in every interval of the partition is 1 and the lowest is 0.Take this function on the interval $[0, 1]$.
A: 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).
A: If $f$ is bounded and continuous almost everywhere on $[a,b]$, it is Riemann integrable on $[a,b]$. So $\sin(1/x)$ is much too nice to be an example. Informally, it wiggles desperately near $0$, but the bad behaviour can be confined to an arbitrarily small interval. 
Try $f(x)=0$ if $x$ is rational, and $f(x)=1$ if $x$ is irrational.
