Weierstrass's Theorem

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

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

By Continuous Functions on Closed Interval are Complete, $C \left[{0 \,.\,.\, 1}\right]$ is a complete metric space under the supremum norm $\left\Vert{\cdot}\right\Vert_\infty$.

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

Then we have the following lemma:

Lemma 1
$X$, defined as above, is a complete metric space under $\left\Vert{\cdot}\right\Vert_\infty$.

 For every $n \in \N$, let $f_n \in X$.

Furthermore, suppose that in $C \left[{0 \,.\,.\, 1}\right]$:

If we can prove that $f \in X$, we know $X$ contains all its limit points.

Hence by Closed Set iff Contains all its Limit Points, $X$ is closed.

From Topological Completeness is Weakly Hereditary, $X$ is complete.

It is now to be proved that $f \in X$.

Suppose $f \left({0}\right) \ne 0$.

Then:
 * $\forall n \in \N: \left\Vert{f_n - f}\right\Vert_\infty \ge \left\vert{f_n \left({0}\right) - f \left({0}\right)}\right\vert = \left\vert{f(0)}\right\vert > 0$

This would contradict equation $(1)$.

Hence $f \left({0}\right) = 0$.

Similarly, it is necessary that $f \left({1}\right) = 1$.

Also, for all $n \in \N$ and $x \in \left[{0 \,.\,.\, 1}\right]$, we have that:
 * $0 \le f_n \left({x}\right) \le 1$

Suppose there is an $x \in \left[{0 \,.\,.\, 1}\right]$ such that either:
 * $f \left({x}\right) < 0$

or:
 * $f \left({x}\right) > 1$

We see that it must be that:
 * $\forall n \in \N: \left\Vert{f_n - f}\right\Vert_\infty \ge \left\vert{f_n \left({x}\right) - f \left({x}\right)}\right\vert > 0$

which contradicts $(1)$.

Therefore, $f \in X$, and hence $X$ is complete.

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

\dfrac 3 4 f \left({3 x}\right) & : 0 \le x \le \dfrac 1 3 \\ \dfrac 1 4 + \dfrac 1 2 f \left({2 - 3 x}\right) & : \dfrac 1 3 \le x \le \dfrac 2 3 \\ \dfrac 1 4 + \dfrac 3 4 f \left({3 x - 2}\right) & : \dfrac 2 3 \le x \le 1 \end{cases}$

We have the following lemma:

Lemma 2
$\hat \cdot: X \to X$ is a contraction mapping.

Furthermore, we have the following inequality:
 * $\forall f, g \in X: \left\Vert{\hat f - \hat g}\right\Vert_\infty \le \frac 3 4 \left\Vert{f - g}\right\Vert_\infty$



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

We have that $h \in X \subset C \left[{0 \,.\,.\, 1}\right]$.

Thus, by definition, $h$ is a continuous real function.

It remains to be shown that $h$ is nowhere differentiable.

To do this, we establish the following lemma:

Lemma 3
For every $n \in \N$ and $k \in \left\{{1, 2, 3, 4, \ldots, 3^n}\right\}$, the following inequality holds:
 * $\left\vert{h \left({\dfrac {k - 1} {3^n} }\right) - h \left({\dfrac k {3^n} }\right)}\right\vert \ge 2^{-n}$

 For any $n \in \N$ and $k \in \left\{{1, 2, 3, \ldots, 3^n}\right\}$:
 * $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$

Let $a \in \left[{0 \,.\,.\, 1}\right]$ be arbitrarily selected.

It is to be shown that $h$ is not differentiable at $a$.

This is to be achieved by constructing a sequence $\left\langle{t_n}\right\rangle$ with elements in $\left[{0 \,.\,.\, 1}\right]$, which has the following limit:
 * $\displaystyle \lim_{n \to \infty} t_n = a$

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

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

By the triangle inequality:

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

This implies:
 * $\forall n \in \N: t_n \ne a$

Furthermore:
 * $2 \left\vert{h \left({t_n}\right) - h \left({a}\right) }\right\vert \ge 2^{-n}$

and:
 * $\left\vert{t_n - a}\right\vert \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:
 * $\dfrac {\left\vert{h \left({t_n}\right) - h \left({a}\right) }\right\vert} {\left\vert{t_n - a}\right\vert} \ge \dfrac 1 2 \left({\dfrac 3 2}\right)^n$

But the absolute value of this expression diverges when $n$ tends to $\infty$.

Therefore $\displaystyle \lim_{n \to \infty} \dfrac {h \left({t_n}\right) - h \left({a}\right)} {t_n - a}$ cannot exist.

From the definition of differentiability at a point, we conclude that $h$ is not differentiable at $a$.