Necessity of completeness of the inner product space in Riesz representation theorem

I wanted to find a counter example to show that the completeness of the inner product space is necessary in Riesz representation theorem. Please give an example of a bounded linear functional $T$ on an incomplete inner product space $X$ which do not have any inner product representation i.e. there does not exist any $z$ in $X$ s.t. $T(x)= \langle ,z\rangle$ for all $x$ in $X$.


Take $C[0,1]$ with the $L^2$ inner product. Let $\phi(f) = \int_{1 \over 2}^1 f(t) dt$.

It is straightforward to see that $\phi$ is bounded by Cauchy-Schwarz.

To see that $\phi$ cannot be represented by an element of $C[0,1]$ we proceed by contradiction. Suppose $\phi(f) = \int_0^1 g(t) f(t) dt$.

Let $f_n$ be the continuous function whose graph is given by joining the points $(0,1), ({1\over 2}-{1 \over n}, 1),({1 \over 2}, 0), (1,0)$. Note that $0=\phi(g \cdot f_n) = \int_0^1 g^2(t) f_n(t) dt \ge \int_0^{{1\over 2}-{1 \over n}} g^2(t) dt$ from which it follows that $g(t) = 0 $ for $t \in [0,{1 \over 2}]$.

Now choose a sequence of positive continuous functions $f_n$ such that $f_n$ has support on $[{1 \over 2}, {1 \over 2}+ {1 \over n}]$ and $\int_0^1 f_n(t) dt = 1$, then we have $\phi(f_n) = 1$ for all $n$, but continuity of $g$ gives $\lim_n \phi(f_n) = g({1 \over 2}) = 0$, a contradiction.

Addendum: Here is a marginally simpler ending to the above proof: Let $\bar{\phi}(f) = \int_0^{1 \over 2} f(t) dt$ and note that $\phi(f) + \bar{\phi}(f) = \int_0^1 f(t) dt$. Since $\int_0^1 f(t) = \langle 1, f \rangle$, if we have $\phi(f) = \int_0^1 g(t) f(t) dt $, then this gives $\bar{\phi}(f) = \int_0^1 (1-g(t)) f(t) dt$. As above, we see that we must have $g(t) = 1$ for $t \in [{1 \over 2},1]$, which contradicts the continuity of $g$ at $t={1\over 2}$.


You can take $X\subset\ell^2(\mathbb N)$ given by $$ X=\{x\in\ell^2(\mathbb N):\ \text{ only finitely many entries of $x$ are nonzero }\} $$ and $$ Tx=\sum_{n=1}^\infty\frac{x_n}n $$


In fact, this can be done quite generally for any inner product space which is not complete.

If $X$ is an inner product space which is not complete, then there is a completion1 $\widehat X$ of $X$. I.e., $\widehat X$ is a Hilbert space such that $X$ is a dense subspace of $\widehat X$.

Since $X$ is not complete, we have $\widehat X\setminus X\ne\emptyset$. Now if we take any $y\in \widehat X\setminus X$, then we have a continuous linear functional on $X$ given by $$T\colon x\mapsto \langle y,x \rangle.$$ We have simply restricted the functional corresponding to $y$.

But since $y$ is the only possible2 representation for this functional, we do not have representation of $T$ using an element of $X$.


1This is the usual notion of a completion of metric or normed space. But additionally we have to check that we also have an inner product on $\widehat X$ and which extends the given inner product on $X$.

2Assume that $\langle y,x\rangle = \langle z,x\rangle$ for each $x\in X$. This means that $\langle z-y,x\rangle=0$ for each $x\in X$. And since $X$ is dense, this implies $z-x=0$, i.e., $z=x$.