# Why can't we interchange differentiation with taking a limit of a series of functions?

While learning a little Fourier analysis, I ran into this interesting phenomenon:

Consider a series of sawtooth waves such that the height and width of the sawteeth shrinks to zero, but the slope of the sawteeth remains the same. To be specific, let

$$f_n(x) = \frac{nx - \lfloor nx\rfloor}{n}$$

Then define

$$F(x) = \lim_{n\to\infty}f_n(x)$$

It seems intuitively clear that $F(x) = 0$ for all $x$ because the global maximum of $f_n$ is $\frac{1}{n}$.

If $F(x) = 0$, then we should have $F'(x) = 0$ as well. However, if we choose an irrational value of $x$, then $f'_n(x) = 1$ for all $n$, so if $F'(x)$ is found instead by taking

$$F'(x) = \lim_{n\to\infty}f'_n(x)$$

we do not get $F'(x) = 0$.

It seems like the derivative of a limit is not the same as the limit of a derivative, which is pretty counterintuitive to me.

What's going on?

-
This example illustrates the principle well: Functions can be close while their derivatives are not. The standard image to invoke is similar to what you have given here: one function can be constant, while a "nearby" function can stay close to that constant function while oscillating maniacally. Another example to consider would be $\frac{\sin(nx)}{n}\to 0$. – Jonas Meyer Sep 15 '11 at 22:44
That's correct, they are not the same. (In particular, $\lim f_n'(x)$ exists only when $x$ is irrational, and is then equal to $1$ - can you see why?) Since the derivative is itself a limit, this is also a special case of the fact you cannot (in general) interchange two limits. – anon Sep 15 '11 at 22:46
@Mark Eichenlaub : As it has been stated, I'd like to mention that there is a possibility that a lot of interesting things missing when we use convergence under a norm like the $\mathcal{L}^p$. – Rajesh Dachiraju Sep 16 '11 at 8:34
You may want to have a look at this as well, although a different, you might find it interseting. en.wikipedia.org/wiki/Uniform_convergence under the section 'Applications'. It talks about the differentiability and the derivative of the limit function under pointwise convergence. – Rajesh Dachiraju Sep 16 '11 at 8:38