There is a famous example of a function that has no derivative: the Weierstrass function:

enter image description here

But just by looking at this equation - I can't seem to understand why exactly the Weierstrass Function does not have a derivative?

I tried looking at a few articles online (e.g. https://www.quora.com/Why-isnt-the-Weierstrass-function-differentiable), but I still can't seem to understand what prevents this function from having a derivative?

For example, if you expand the summation term for some very large (finite) value of $n$: $$ f(x) = a \cos(b\pi x) + a^2\cos(b^2\pi x) + a^3\cos(b^3\pi x) + ... + a^{100}\cos(b^{100}\pi x) $$ What is preventing us from taking the derivative of $f(x)$? Is the Weierstrass function non-differentiable only because it has "infinite terms" - and no function with infinite terms can be differentiated?

For a finite value of $n$, is the Weierstrass function differentiable?

Thank you!

  • 11
    $\begingroup$ Any truncated version of the series will be differentiable (it is a finite sum of differentiable functions). There are many examples where infinite function series are differentiable (analytic functions for example). If you assume for example $ab<1$ for the Weierstrass function instead of $ab>1+\frac{3\pi}{2}$, it will be differentiable. $\endgroup$
    – Gary
    Commented Jan 17, 2022 at 5:43
  • 2
    $\begingroup$ The finite series is differentiable everywhere as a finite sum of differentiable terms. The infinite series clearly converges absolutely when $0<a<1$ as each term is less than $a^n$ and you can compare to a geometric series. But the derivative of each term is $-(ab)^n \pi \sin(b^n \pi x)$ and that can cause problems when $ab>1$. On the face of it, there is the question of what happens when $x=0$ (or any integer) and that is a deeper question leading to the $ab>1+\frac{3\pi}{2}$ requirement $\endgroup$
    – Henry
    Commented Jan 18, 2022 at 9:18

8 Answers 8


Nothing is preventing us from taking the derivative of any finite partial sum of this series. This is a trigonometric polynomial and it has derivatives of all orders.

However, this infinite sum represents the pointwise limit of such trigonometric polynomials. A pointwise limit of differentiable functions has no obligation to be differentiable.

On the other hand, the sheer fact that this function is an infinite sum doesn’t automatically imply that it’s nowhere differentiable. An infinite power series or infinite trigonometric series may be differentiable everywhere, differentiable nowhere, or differentiable in some places and not others.

To check if a function is differentiable at a point $x_0$, you must determine if the limit $\lim_{h\to 0}(f(x_0+h)-f(x_0))/h$ exists. If it doesn’t, the function isn’t differentiable at $x_0$.

There are various theorems which help us bypass the need for doing this directly. For example, we can show that the composition of differentiable functions is differentiable, and that various elementary functions are differentiable everywhere, which lets us conclude that things like $\cos(17x^2)-e^x$ are differentiable everywhere.

One of these shortcuts applies when you have infinite sums with uniformly convergent derivatives. This very important result allows us to conclude that many functions defined by infinite series do indeed have derivatives, and those derivatives are what you’d expect. But this doesn’t apply here, since this sum does not have uniformly convergent derivatives.

And once again, this fact alone isn’t enough to show that the function is nowhere differentiable. To show that, you have to roll up your sleeves and work out inequalities that apply everywhere and prevent the limit above from existing. This is done carefully here, for example.

  • $\begingroup$ the link does not work, do you have another reference? $\endgroup$ Commented Jul 3 at 23:52

In order to calculate the derivative of a function at a given point (e.g. $x=0$), you just need to keep zooming on this point until the curve gets smooth:


Oh, wait...

  • 5
    $\begingroup$ This is a good visual explanation. Fractal it is! $\endgroup$
    – Paladin
    Commented Jan 18, 2022 at 23:58

As other answers have pointed out, while the partial sums of the function converge, the partial sums of the derivatives do not. To see this, I just did a quick calculation. Let $f_m(x)$ be the partial sums, $$f_m(x) = \sum_{n=0}^m a^n \cos(b^n \pi x)$$ For the first few partial sums with $a=0.6$ and $b=7$ it looks like

enter image description here

Let's look at the convergence at a few select points, arbitrarily chosen

enter image description here

We see it fairly rapidly converges to the asymptotic values. Taking these same points, let's look at the convergence of the first derivative, $f'_m(x)$. I'm going to plot the absolute value so you can see what's going on (note the logarithmic scale on the vertical axis)

enter image description here

Clearly the partial sums of the first derivatives do not converge! In fact they diverge exponentially fast.

  • $\begingroup$ The parameters you have chosen do not meet the condition $ab > 1+ \frac{3}{2} \pi$, so the function you are working with is smoother (and potentially differentiable, but I doubt it) than the intended function(s). On the other hand, the graph in OP's image has $a = 1/2$, $b = 3$, so is also tamer than the intended functions. $\endgroup$ Commented Jan 18, 2022 at 17:03
  • 1
    $\begingroup$ @kai This fails to answer the question "WHY?" $\endgroup$
    – Mark Viola
    Commented Jan 18, 2022 at 20:18
  • $\begingroup$ This fails to even illustrate that $f$ is non-differentiable. It only shows that $(f_n')$ does not converge. $\endgroup$
    – durianice
    Commented Nov 25, 2023 at 6:22

It's not that it is an infinite sum, any analytic function can be written as an infinite sum by definition and is differentiable.

The issue is that the function has the nature of a fractal, at every zoom level it continues have sharp changes in direction. So yes, at any finite level you can take a derivative at most points, because a finite level doesn't have the infinite zoom that prevents a local derivative from existing.

Remember, the derivative is a local existence of a limit, $f(x)$ is differentiable at $a$ if for some small neighborhood around $a$,

$$\frac {f(x)-f(a)}{x-a}$$

stays close to a value. But this function will obtain all different kinds of slopes in any tiny neighborhood...you just have to zoom in far enough to see the jagged behavior.


While others have given answers saying that a pointwise limit of differentiable functions needn’t be differentiable, here is a simple example explaining why that is true.
One can find a limit of smooth functions which converge to the absolute value function which is not differentiable at $0$, as shown by the following image:enter image description here


The value of an infinite series is defined to be the limit of the values of its partial sums: $$ \sum_{n=0}^\infty f(n) = \lim_{N \rightarrow \infty} \sum_{n=0}^N f(n) \text{.} $$ so the right thing to do when trying to understand the convergence of the given series and its termwise derivative is to look at what the partial sums do as we add more and more terms.

Let's do that. Let's pick $a = 1/2$ and $b = 13$ (the smallest odd integer that satisfies $ab > 1 + \frac{3}{2}\pi$). (Aside: the image in your question has $a = 1/2$, $b = 3$, so is a picture of a much too tame function.) Let's define $$ W_N = \sum_{n=0}^N (1/2)^n \cos( 13^n \pi x) \text{,} $$ the sum of the first $N$ terms. Also, since $W_N$ is a finite sum, we can find its derivative by differentiating term-by-term. (This doesn't always work for infinite sums because the (outside) limit for the derivative and the (inside) limit for the sum don't necessarily commute -- swapping the order of the limits can give different results. So more care must be taken when that happens.) $$ W_N' = -\sum_{n=0}^N (1/2)^n 13^n \pi \sin(13^n \pi x) $$

Before we go to pictures, let's take a second to see what is already present. In $W_N$, the coefficient of the trig function is $(1/2)^n$. Since $0 < a < 1$, successive powers of $a$ get smaller -- successive cosines mix in with smaller and smaller amplitudes. Every time we increment $N$, the new term is dwarfed by each preceding term, so it's plausible that the function given by the sequence of partial sums settles into some limit function by making smaller and smaller adjustments as we add more terms.

However, the coefficients of the sines in $W_N'$, $(13/2)^n\pi $, are increasing faster than the powers of $\left(1 + \frac{3}{2}\pi\right) = 5.7123{\dots}$. This means each new sinusoid has amplitude at least 5-times larger (in fact, $13/2$-times larger) than the preceding one -- every time we increment $N$, the new term dwarfs the sum of all the preceding terms. This means the $W_N'$ do not settle in towards some function; instead oscillating with rapidly greater amplitude and frequency, failing to settle toward a limit.

Here's $W_5(x)$ on $[-3/2,3/2]$ and then on $[0,1/25\,000]$ (to show the contribution from the last term).

W_5(x) on [-3/2,3/2]

W_5(x) on [0,1/25000]

Now let's look at $W_5'$ on the same intervals.

W_5'(x) on [-3/2,3/2]

W_5'(x) on [0,1/25000]

We see that the narrow wiggles caused by the fifth term in the series are producing derivatives that flail from $-40\,000$ to $40\,000$ everywhere, with tiny variations from the previous terms.

Let's get the same four pictures for six terms.

W_6(x) on [-3/2,3/2]

W_6(x) on [0,1/25,000]

W_6'(x) on [-3/2,3/2]

W_6'(x) on [0,1/25,000]

For the function, $W_6(x)$, the sixth term adjusted the function values by $\pm 0.02$ or less. For the derivative, the narrow ripples now have the derivative flailing from almost $-300\,000$ to almost $300\,000$ with very high frequency.

And the pattern continues as we take more terms -- $W_N$ approaches a continuous function and $W_N'$ tries harder and harder to make its graph go through every point on the plane.


The basic concept used in constructing the Weierstrass function is that when you have $\sum r^n$, this converges for $|r|<1$ and diverges for $|r|\ge1$. So if you can get a function that involves $\sum r^n$ with $|r|<1$, and whose derivative increases $|r|$ above $1$, then the derivative will diverge.

When we take the derivative of $a^n\cos(b^n\pi x)$, we get $-a^nb^n\pi\sin(b^n\pi x)$, or $-(ab)^n\pi\sin(b^n\pi x)$. So before the derivative, our $r$ is $a$, but after the derivative it's $ab$. So ignoring the trigonometric functions, if $|a|<1$ and $|ab|\ge1$, the function converges and the derivative diverges. The trigonometric functions complicate it somewhat, making us need $|ab|$ to be greater than $1+\frac 32 \pi$, but the basic idea survives.

Merely having a function defined in terms of an infinite series doesn't mean that we can't take the derivative, it simply introduces the issue that the derivative might not converge. There are plenty of these functions that we can take the derivative of; if you've seen Taylor or Fourier series, you'll see plenty of examples of functions with well-defined derivatives. For instance, the derivative of $e^{2x}=\sum_{n=0}^{\infty}\frac{(2x)^n}{n!}$ is $\sum_{n=0}^{\infty}\frac{2(2x)^n}{n!}=2e^{2x}$.

If you take the derivative of a triangle wave, you get a square wave. Both of these waves have Fourier series, but the Fourier series for the square wave has repeated discontinuities. Each of these discontinuities are just points, and the derivative is still well-defined in the intervals between them. You can think of the Weierstrass function as being similar to a sum of an infinite number triangle waves, so that each interval, no matter how small, contains a point where the at least one of the triangle waves has a derivative that doesn't converge, and thus the derivative doesn't exist anywhere.

  • $\begingroup$ "sawtooth wave" - You mean "triangle wave". Also, a function can be differentiable at a point without being differentiable on an interval. $\endgroup$
    – mr_e_man
    Commented Mar 23, 2023 at 18:54
  • $\begingroup$ @mr_e_man If the non-differentiable points are dense in an interval, then I don't think there can be any differentiable points in that interval. $\endgroup$ Commented Mar 23, 2023 at 23:05
  • $\begingroup$ Just consider $xW(x)$ where $W$ is Weierstrass. The derivative at $x=0$ is $W(0)$, but there is no derivative elsewhere since $1/x$ is differentiable. $\endgroup$
    – mr_e_man
    Commented Mar 24, 2023 at 0:07
  • $\begingroup$ A function can even be differentiable at a point without being continuous on an interval; e.g. $$\begin{cases}x^2,\quad x\in\mathbb Q\\0,\quad x\not\in\mathbb Q\end{cases}$$ $\endgroup$
    – mr_e_man
    Commented Mar 24, 2023 at 0:17
  • $\begingroup$ Furthermore, a sequence of non-differentiable functions can have a limit that is differentiable: $$f_m(x)=W(x)-\sum_{n=0}^{m-1}a^n\cos(b^n\pi x)=\sum_{n=m}^\infty a^n\cos(b^n\pi x)$$ $$\nexists\,f_m',\quad\lim_{m\to\infty}f_m=0,\quad\exists\,0'$$ So the triangular waves don't really tell us anything about differentiability of their sum. $\endgroup$
    – mr_e_man
    Commented Mar 24, 2023 at 1:07

[Here are the bounds for a specific example. Taken from Lec-18 here.]

Consider ${ f(x) = \sum _{k=0} ^{\infty} \frac{1}{4 ^k} \cos(160 ^k x) .}$

Continuity of f:

Each term ${ f _k (x) }$ has magnitude ${ \vert f _k (x) \vert }$ ${ = \vert \frac{1}{4 ^k} \cos(160 ^k x) \vert }$ ${ \leq \frac{1}{4 ^k} }$ and ${ \sum _{k \geq 0} \frac{1}{4 ^k} }$ converges.
So (partial sums of) ${ f(x) }$ are uniformly Cauchy (on ${ \mathbb{R} }$) hence uniformly convergent.

Non-differentiability of f:

Let ${ c \in \mathbb{R} }.$ We will find a sequence ${ (x _n) }$ such that ${ x _n \to c ,}$ but ${ \left( \frac{f(x _n) - f(c)}{x _n - c}\right) }$ diverges, as ${ n \to \infty .}$

For every ${ n }$ pick ${ x _n }$ so that ${ {\color{red}{160 ^n x _n}} \in ({\color{blue}{160 ^n c}} + \pi, {\color{blue}{160 ^n c}} + 3\pi ) }$ and ${ \vert \cos({\color{red}{160 ^n x _n}}) - \cos({\color{blue}{160 ^n c}}) \vert \geq 1 }.$ Note ${ \vert x _n - c \vert }$ ${ \leq \frac{3\pi}{160 ^n} }$ ${ \to 0 }$ as ${ n \to \infty .}$

We also have an upper bound ${ \vert \cos(160 ^n x _n) - \cos(160 ^n c) \vert }$ ${= \vert \frac{d}{dx} \cos(160 ^n x) \text{ at } \theta _n \text{ between } x _n, c \vert \vert x _n - c \vert }$ ${ \leq 160 ^n \vert x _n - c \vert }.$

Now ${ f (x _n) - f(c) }$ ${ = {\color{red}{(f _n (x _n) - f _n(c))}} }$ ${ + {\color{green}{\sum _{k=0} ^{n-1} (f _k (x _n) - f _k (c))}} }$ ${ + {\color{blue}{\sum _{k = n+1} ^{\infty} (f _k (x _n) - f _k (c))}} . }$

The red part has bounds ${ 4 ^{-n} \leq {\color{red}{4 ^{-n} \vert \cos(160 ^n x _n) - \cos(160 ^n c) \vert }} \leq 4 ^{-n} 160 ^n \vert x _n - c \vert }.$
The green and blue parts have upper bounds ${ \vert {\color{green}{\sum _{k=0} ^{n-1} (f _k (x _n) - f _k (c))}} \vert }$ ${ \leq \sum _{k=0} ^{n-1} \vert f _k (x _n) - f _k (c) \vert }$ ${ \leq \sum _{k=0} ^{n-1} 4 ^{-k} 160 ^k \vert x _n - c \vert }$ ${ \leq \frac{3\pi}{160 ^n} \sum _{k=0} ^{n-1} 40 ^k }$ ${\leq \frac{3 \pi}{160 ^n} \frac{40 ^n}{39} }$ ${ = 4 ^{-n} \frac{\pi}{13}, }$ and ${ \vert {\color{blue}{\sum _{k = n+1} ^{\infty} (f _k (x _n) - f _k (c))}} \vert }$ ${ \leq \sum _{k=n+1} ^{\infty} \vert f _k (x _n) - f _k (c) \vert }$ ${ \leq \sum _{k=n+1} ^{\infty} 2 \cdot 4 ^{-k} }$ ${ = 2 \cdot 4 ^{-(n+1)} \cdot \left(\frac{1}{1 - \frac{1}{4}} \right) }$ ${ = \frac{2}{3} 4 ^{-n}. }$

Hence ${ \vert f (x _n) - f(c) \vert }$ ${ = \vert \text{red part + green part + blue part} \vert }$ ${ \geq \vert \text{red part} \vert - \vert \text{green part} \vert - \vert \text{blue part} \vert }$ ${ \geq 4 ^{-n} - 4 ^{-n} \frac{4}{13} - 4 ^{-n} \frac{2}{3} }$ ${ = 4 ^{-n} \frac{1}{39} .}$

So ${ \frac{\vert f (x _n) - f(c) \vert}{\vert x _n - c \vert} }$ ${ \geq 4 ^{-n} \frac{1}{39} \frac{160 ^n}{3 \pi} }$ ${ (\to \infty \text{ as } n \to \infty) },$ giving non-differentiability at ${ c }.$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .