About the Riemann integrability of composite functions When I was teaching calculus recently, a freshman asked me the conditions of the Riemann integrability of composite functions. 
For the composite function $f \circ g$, He presented three cases:
1) both $f$ and $g$ are Riemann integrable;
2) $f$ is continuous and $g$ is Riemann integrable;
3) $f$ is Riemann integrable and $g$ is continuous.
For case 1 there is a counterexample using Riemann function. For case 2 the proof of the integrability is straight forward. However, for case 3, I can neither give a proof nor construct any counterexample. Even under the condition that $g$ is differentiable, I cannot work out anything. How to reply my student?
 A: Warning: not an answer.  Rather, some comments and some links.
I came upon this issue myself when I was teaching an undergraduate real analysis course some years ago.  The point is that in the development of the Riemann/Darboux integral, a standard technical result is that if $f: [a,b] \rightarrow [c,d]$ is integrable and $\varphi: [c,d] \rightarrow \mathbb{R}$ is continuous, then $\varphi \circ f$ is integrable.  It follows easily that the product of two integrable functions is integrable (which is not so obvious otherwise).  This result appears, for instance, as Theorem 6.11 in Rudin's Principles of Mathematical Analysis.
It is easy to see that the composition of integrable functions need not be integrable.  So it is natural to ask whether it works the other way around.  Remarkably, I know of no standard text which addresses this question.  Rudin immediately asks a much more ambitious question and then moves right on to something else.
At the time I convinced myself of the existence of continuous $f$ and integrable $\varphi$
such that $\varphi \circ f$ was not integrable.  However, in order to do so I needed to use ideas which were more advanced than I could explain in my course.  At least, this is what it says on p. 7 of my lecture notes:
http://alpha.math.uga.edu/~pete/243integrals2.pdf (Wayback Machine)
Unfortunately I didn't write down the counterexample that I had in mind (I suppose back then I was clinging naively to the idea that the lecture notes were for the students and not to preserve my own knowledge of the material in the coming years), so I don't know now what it was.
The example in Jitan Lu's 1999 Monthly article that Qiaochu referred to seems elementary enough so that it should at least be referenced in texts and courses, and possibly included explicitly.  For those who couldn't get the whole paper from the previous link, it is now also available here:
http://alpha.math.uga.edu/~pete/Lu99.pdf
Of course, I don't believe for a second that an example of this type (i.e., to show that integrable $\circ$ continuous need not be integrable) was first constructed in 1999.  Can anyone supply an earlier reference?  (I never know how to go about solving math history problems like this.)  I should say that I am impressed that Qiaochu was even able to track down this paper.  The MathSciNet review is quite unhelpful.  It says:

In this note the following result is given. If $f$ is a Riemann integrable function defined on $[a,b],\ g$ is a differentiable function with non-zero continuous derivative on $[c,d]$ and the range of $g$ is contained in $[a,b]$, then $f\circ g$ is Riemann integrable on $[c,d]$.

This is not the main result given in the paper; rather it is a proposition stated (without proof!) at the very end.
A: I think it's false, but I'm not 100% confident about this construction: let $g$ be a continuous function which takes the value zero on a nowhere dense set of positive measure $E$ but nonzero values on a dense subset of the complement of $E$.  Let $f$ be a function which is continuous except for a discontinuity at zero.  Then $f(g)$ cannot be Riemann integrable by Lebesgue's characterization, since it is discontinuous on a set of positive measure.
On the other hand the result is true for $g$ monotonic since it is possible to find the preimage of any partition.  More generally it is true for $g$ which "changes direction" finitely often.  The problem is when $g$ oscillates too wildly.
Edit:  I still don't know if the above works (I'm a little suspicious about whether $g$ exists), but an explicit counterexample is given by Jitan Lu in this AMM article.  The counterexample seems to be similar in spirit; Lu constructs a fat Cantor set to do it.
A: Let $f$ be bounded and discontinuous on exactly the Cantor set $C$ (for example, the characteristic function of $C$).  Let $g$ be continuous increasing on $[0,1]$ and map a set of positive measure (for example a fat Cantor set) onto $C$.  Then $f \circ g$ is discontinuous on a set of positive measure.  So $f$ is Riemann integrable, $g$ is continuous, and $f \circ g$ is not Riemann integrable.  Of course, a Freshman calculus student wont know about "measure zero" so this example is not good for an elementary course.
A: I am not sure about this, but I think that a simple counterexample would be:
$f(x) = 1/\sqrt{x}$ which is integrable in $(0,1)$; $g(x) = x^2$ which is continuous in $(0,1)$, and both: $g\circ f(x) = f\circ g(x) =1/x$ which is not integrable in $(0,1)$.
Of course these examples are of  divergent improper Riemann integrals, so maybe this is not what you were looking for...
