# Weierstrass non-differentiable function

In our analysis book it says that the following function proposed by Weierstrass is continuous everywhere, but nowhere differentiable.

$$f(x)=\sum _{n=1}^{∞}\frac{1}{2^n}\cos \left(3^nx\right)$$

The series must converge because it is the product of a convergent series and an alternating series, but the exponent inside cosine makes it tricky to evaluate.

When I graph it, it looks very strange indeed.

graph of function (n=1 to 100)

Would this be considered fractal? Is it differentiable analytically?

• Related, the Weierstrass function Mar 8 '17 at 13:23
• I've always thought of it as a fractal myself, but I'm not sure if that squares up with the official definition of the term. Mar 8 '17 at 13:25
• A fractal is a mathematical set that exhibits a repeating pattern displayed at every scale. This function definitely has that. Mar 8 '17 at 13:31
• It's actually not quite alternating; the signs oscillate but not in a regular manner except for particular values of $x$. But since $|\cos| \leq 1$ it's easy to see that it is absolutely convergent. Also, a finite truncation like you plotted is actually still differentiable, but the derivative is very oscillatory. The infinite sum will not be differentiable (because $\frac{3}{2} \geq 1$).
– Ian
Mar 8 '17 at 13:34
• It's not an alternating series (the cosine term will be close to one for large n). It converges uniformly, because the cosine is bounded and the other factor decreases rapidly.
– Dirk
Mar 8 '17 at 13:41

$$W(x)=\sum_{k=0}^\infty a^k\cos(b^n\pi x)$$
Your function is of this form with $a=\tfrac12$ and $b=3$, since then $W(\frac x\pi)=f(x)$. Weierstrass functions are nowhere differentiable yet continuous, and so is your $f$. A quote from wikipedia: