Weierstrass's Theorem

Theorem
There exists a real function $f: \closedint 0 1 \to \closedint 0 1$ such that:
 * $(1): \quad f$ is continuous
 * $(2): \quad f$ is nowhere differentiable.

Proof
Let $C \closedint 0 1$ denote the set of all real functions $f: \closedint 0 1 \to \R$ which are continuous on $\closedint 0 1$.

By Continuous Function on Closed Interval is Complete, $C \closedint 0 1$ is a complete metric space under the supremum norm $\norm {\,\cdot \,}_\infty$.

Let $X$ consist of the $f \in C \closedint 0 1$ such that:
 * $\map f 0 = 0$
 * $\map f 1 = 1$
 * $\forall x \in \closedint 0 1: 0 \le \map f x \le 1$

Then we have the following lemma:

Lemma 1
$X$, defined as above, is a complete metric space under $\norm {\,\cdot \,}_\infty$.

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

Furthermore, suppose that in $C \closedint 0 1$:

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 $\map f 0 \ne 0$.

Then:
 * $\forall n \in \N: \norm {f_n - f}_\infty \ge \size {\map {f_n} 0 - \map f 0} = \size {\map f 0} > 0$

This would contradict equation $(1)$.

Hence $\map f 0 = 0$.

Similarly, it is necessary that $\map f 1 = 1$.

Also, for all $n \in \N$ and $x \in \closedint 0 1$, we have that:
 * $0 \le \map {f_n} x \le 1$

Suppose there is an $x \in \closedint 0 1$ such that either:
 * $\map f x < 0$

or:
 * $\map f x > 1$

We see that it must be that:
 * $\forall n \in \N: \norm {f_n - f}_\infty \ge \norm {\map {f_n} x - \map f x} > 0$

which contradicts $(1)$.

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

For every $f \in X$, define $\hat f: \closedint 0 1 \to \R$ as follows:
 * $\map {\hat f} x = \begin{cases}

\dfrac 3 4 \map f {3 x} & : 0 \le x \le \dfrac 1 3 \\ \dfrac 1 4 + \dfrac 1 2 \map f {2 - 3 x} & : \dfrac 1 3 \le x \le \dfrac 2 3 \\ \dfrac 1 4 + \dfrac 3 4 \map f {3 x - 2} & : \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: \norm {\hat f - \hat g}_\infty \le \dfrac 3 4 \norm {f - g}_\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 \closedint 0 1$.

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 \set {1, 2, 3, 4, \ldots, 3^n}$, the following inequality holds:
 * $\size {\map h {\dfrac {k - 1} {3^n} } - \map h {\dfrac k {3^n} } } \ge 2^{-n}$

 For all $n \in \N$ and $k \in \set {1, 2, 3, \ldots, 3^n}$:
 * $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 \closedint 0 1$ be arbitrarily selected.

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

This is to be achieved by constructing a sequence $\sequence {t_n}$ with elements in $\closedint 0 1$, which has the following limit:
 * $\ds \lim_{n \mathop \to \infty} t_n = a$

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

Let $k$ be the unique largest element of $\set {1, 2, 3, 4, \ldots, 3^n}$ such that:
 * $\paren {k - 1} 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:
 * $\size {\map h {t_n} - \map h a} = \max \set {\size {\map h {\dfrac {k - 1} {3^n} } - \map h a}, \size {\map h a - \map h {\dfrac k {3^n} } } }$

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

Furthermore:
 * $2 \size {\map h {t_n} - \map h a} \ge 2^{-n}$

and:
 * $\size {t_n - a} \le 3^{-n}$

Hence, for any $n$:
 * $t_n \in \closedint 0 1$

and also:
 * $\ds \lim_{n \mathop \to \infty} t_n = a$

The above inequalities imply that:
 * $\dfrac {\size {\map h {t_n} - \map h a} } {\size {t_n - a} } \ge \dfrac 1 2 \paren {\dfrac 3 2}^n$

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

Therefore $\ds \lim_{n \mathop \to \infty} \dfrac {\map h {t_n} - \map h a} {t_n - a}$ cannot exist.

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