TITLE: Is Spivak wrong about this counterexample? $f$ integrable on $[-1,1]$, $F=\int_{-1}^xf$, $f$ differentiable at $0$, but $F'$ not continuous at $0$
QUESTION [8 upvotes]: Let $f$ be Riemann integrable on $[a,b]$, let $c\in(a,b)$, and let $F(x)=\int_a^xf$ for $x\in[a,b]$.
Exercise 3b in Chapter 14 of Spivak's Calculus (3rd edition) asks to give a proof or provide a counterexample of this statement:

If $f$ is differentiable at $c$, then $F'$ is continuous at $c$.

In his solutions manual, Spivak claims to give a counterexample. His function is $f:[-1,1]\to\mathbb{R}$ defined by
$$f(x)=\begin{cases}0&x=0\\1&x\in\left\{-1,1\right\}\\\frac{1}{n^2}&\frac{1}{n}\leq |x|<\frac{1}{n-1}, n\geq2\end{cases}$$
Observe that $f$ has jump discontinuities at points of the form $1/n$ for nonzero integers $n$ and is continuous everywhere else.
Now certainly $f$ is Riemann integrable on $[-1,1]$ (because its sets of discontinuities is countable, thus measure zero). Moreover $f$ is indeed differentiable at $0$.
But I don't think $F'$ is discontinuous at $0$. On the contrary, here is my proof that $F'$ is continuous at $0$.
First, since $f$ is differentiable at $0$, $f$ is continuous at $0$; it follows by the fundamental theorem that $F'$ exists at $0$ and that $F'(0)=f(0)$. We know $f(0)=0$, so $F'(0)=0$.
It remains to show that $\lim_{x\to0}F'(x)=0$. Now this is a little delicate because, as Spivak points out, $F'$ is not even defined at $1/n$ for $n$ a nonzero integer. But that doesn't prevent us from calculating the limit of $F'$. The limit simply must be taken through the domain of $F'$.
Indeed, given $\epsilon>0$, take $N$ such that $\frac{1}{N^2}<\epsilon$, and pick $\delta=\frac{1}{N}$.
Then if $0<|x|<\delta$ and $x$ is in the domain of $F'$, it follows that $|F'(x)|\leq\frac{1}{(N+1)^2}<\frac{1}{N^2}<\epsilon$.
Therefore it is indeed true that
$$\lim_{x\to0}F'(x)=F'(0)$$
so $F'$ is continuous at $0$.
What's going on here? Is this just a matter of one's definition of the limit of a function on a set that isn't an interval? Spivak seems to think "If $\lim_{x\to c}g(x)$ exists then $g$ is defined on a deleted interval around $c$."

REPLY [4 votes]: The answer to your question in the comments is yes: If $f$ is differentiable at $c,$ then $F'$ is continuous at $c$ within the domain of $F'.$
Proof: Suppose $y_n\to c^+$ (the case $y_n\to c^-$ is similar). Assume  $F'(y_n)$ exists for each $n.$ Because $f'(c)$ exists, we can write
$$\tag 1 f(x) = f(c) +f'(c)(x-c) + \epsilon(x)(x-c),$$
where $\epsilon(x)\to 0$ as $x\to c.$ Actually we don't need the $\epsilon\to 0$ property. If you divide both sides of $(1)$ by $x-c,$ you'll see $\epsilon(x)$ is bounded on $[a,b]\setminus \{c\},$ say by $M$ in absolute value.
Fix $n.$ Then for small $h>0,$
$$\tag 2 \frac{F(y_n+h)-F(y_n)}{h} = \frac{1}{h}\int_{y_n}^{y_n+h} f(x)\,dx.$$
By $(1),$ $(2)$ equals
$$\tag 3 f(c) + \frac{1}{h}\int_{y_n}^{y_n+h}(f'(c)+\epsilon(x))(x-c)\,dx.$$
Now the second expression in $(3)$ is bounded above in absolute value by
$$(|f'(c)|+M)\frac{1}{h}\int_{y_n}^{y_n+h}(x-c)\,dx = (|f'(c)|+M)(y_n-c+h).$$
Thus
$$\left |\frac{F(y_n+h)-F(y_n)}{h} - f(c)\right |\le (|f'(c)|+M)(y_n-c+h).$$
Taking the limit as $h\to 0$ then gives
$$|F'(y_n) - f(c)| \le (|f'(c)|+M)(y_n-c).$$
Now letting $n\to \infty,$ we see
$$F'(y_n) \to f(c) = F'(c),$$
and we're done.