Weierstrass's Theorem

Theorem
There exists a real-valued function $f : \left[{{0}\,.\,.\,{1}}\right] \to \left[{{0}\,.\,.\,{1}}\right]$, such that:
 * $f$ is continuous;
 * $f$ is nowhere differentiable.

Proof
Let $C\left[{{0}\,.\,.\,{1}}\right]$ denote the set of all continuous functions $f: \left[{{0}\,.\,.\,{1}}\right] \to \R$.

By Continuous Functions on Closed Interval are Complete, $C\left[{{0}\,.\,.\,{1}}\right]$ is a complete metric space.

Let $X$ consist of the $f \in C\left[{{0}\,.\,.\,{1}}\right]$ such that:
 * $f\left({0}\right) = 0$;
 * $f\left({1}\right) = 1$;
 * for any $0 \le x \le 1$, we have $0 \le f\left({x}\right) \le 1$.

Lemma
$X$, defined as above, is a complete metric space.

Proof of Lemma
For every $f \in X$ define $\hat f : \left[{{0}\,.\,.\,{1}}\right] \to \R$ as follows:
 * $\hat f\left({x}\right) = \begin{cases}

\frac {3} {4} f\left({3x}\right) & \text{if } 0 \le x \le \frac {1} {3}\\ \frac {1} {4} + \frac {1} {2} f\left({2-3x}\right) & \text{if } \frac {1} {3} \le x \le \frac {2} {3}\\ \frac {1} {4} + \frac {3} {4} f\left({3x-2}\right) & \text{if } \frac {2} {3} \le x \le 1 \end{cases} $ Note that $\hat f \in X$ for all $f \in X$.

Furthermore, $\hat \cdot: X \to X$ is a contraction mapping, as we have the following:
 * $\forall f \in X: \left\|{\hat f}\right\|_\infty \le \frac {3} {4} \left\|{f}\right\|_\infty$

The Contraction Mapping Theorem assures existence of a unique $h \in X$ with $\hat h = h$.

This $h$ is a continuous function (as $h \in X$), and we will show that it is nowhere differentiable.

For any $n \in \N$ and $k \in \left\{{1, 2, 3,\ldots, 3^n}\right\}$, we have the following:
 * $1 \le k \le 3^n \implies 0 \le \dfrac{k-1} {3^{n+1}} < \dfrac {k} {3^{n+1}} \le \dfrac {1} {3}$.
 * $3^n < k \le 2 \cdot 3^n \implies \dfrac {1} {3} \le \dfrac {k-1} {3^{n+1}} < \dfrac {k} {3^{n+1}} \le \dfrac {2} {3}$
 * $2 \cdot 3^n < k \le 3^{n+1} \implies \dfrac {2} {3} \le \dfrac {k-1} {3^{n+1}} < \dfrac {k} {3^{n+1}} \le 1$

Using the above, by induction it follows that
 * $\forall n \in \N: \forall k \in \left\{{1, 2, 3, 4, \ldots, 3^n}\right\}: \left|h\left({ \dfrac {k-1} {3^n} }\right) - h\left({ \dfrac {k} {3^n} }\right)\right| \ge 2^{-n}$

Next, fix $a \in \left[{{0}\,.\,.\,{1}}\right]$. We will show that $h$ isn't differentiable at $a$.

We will construct a sequence $\left\langle{t_n}\right\rangle$ with elements in $ \left[{{0}\,.\,.\,{1}}\right]$, such that we have the following limit:
 * $\displaystyle \lim_{n \to \infty} t_n = a$

To this end, let $n \in \N$ be arbitrary.

Now let $k$ be the unique element of $\left\{{ 1, 2, 3, 4, \ldots, 3^n}\right\}$ such that we have:
 * $(k-1) 3^{-n} \le a \le k 3^{-n}$

By the triangle inequality, we have the following:
 * $\left|{ h\left({ \dfrac {k-1} {3^n} }\right) - h\left({a}\right) }\right| + \left|{ h\left({a}\right) - h\left({ \dfrac {k} {3^n} }\right) }\right|

\ge \left|{ h\left({ \dfrac {k-1} {3^n} }\right) - h\left({ \dfrac {k} {3^n} }\right) }\right| \ge 2^{-n}$

Next, let $t_n$ be either $\dfrac {k-1} {3^n}$ or $\dfrac {k} {3^n}$, such that the following equation is satisfied:
 * $\left|{ h\left({t_n}\right) - h\left({a}\right) }\right| = \max\left\{{ \left|{ h\left({ \dfrac {k-1} {3^n} }\right) - h\left({a}\right) }\right| ,

\left|{ h\left({a}\right) - h\left({ \dfrac {k} {3^n} }\right) }\right| }\right\}$

This implies that for any $n \in \N$, $t_n \ne a$. Furthermore, we have $2\left|{ h\left({t_n}\right) - h\left({a}\right) }\right| \ge 2^{-n}$ and $\left|{ t_n - a }\right| \le 3^{-n}$.

Hence, for any $n$, $t_n \in \left[{{0}\,.\,.\,{1}}\right]$, and also $\displaystyle \lim_{n \to \infty} t_n = a$.

The above inequalities imply that we have:
 * $\dfrac {\left|{ h\left({t_n}\right) - h\left({a}\right) }\right|} {\left|{t_n - a}\right|} \ge \dfrac {1} {2} \left({ \dfrac {3} {2} }\right)^n$

Therefore, $\displaystyle \lim_{n \to \infty} \dfrac {h\left({t_n}\right) - h\left({a}\right)} {t_n - a}$ cannot exist, as the absolute value of this expression diverges when $n$ tends to $\infty$.

From the definition of differentiability at a point, we conclude that $h$ isn't differentiable at $a$.