Question: A practice question for my analysis midterm is as follows:

Give an example of a function $f:[a, b] \to\ \mathbb R$ such that $f \in R[a, c] \forall c \in\ [a, b)$ but $$f \notin R[a, b]$$

I can't think of any examples. Any help is much appreciated. Thanks in advance.

Answer: 
$$f(x)=\left\{\begin{array}{ccc}\frac1{1-x}&\mathrm{if}&x\in[0,1)\\0&\mathrm{if}&x=1\end{array}\right.$$
Consider the function f(x) = 1/(1 - x) on [0, 1]. You can assign f(1) = any number.