Consider the hyperspan of the original orthonormal system. This is the set of elements whose coefficients on ci are all 0. Since all the elements of S are faithfully represented, this characterization of the subspace T is well defined. In fact T is a linear subspace, with metric and dot product inherited from S. Is T a complete metric space? In the previous section we started with a cauchy sequence un in S, and found it's limit, by finding a cauchy sequence, and a limit, for each coordinate. If un lies entirely in T, the coefficient on each ci is 0, the limit per coordinate is 0, and the limit of the cauchy sequence lies in T. Thus T is a complete metric space. This makes T a hilbert space, and a subspace of S.
Since M lies in T, and T is complete, the completion of M lies in T. We only need show each element of T is the limit of a convergent sequence drawn from M.
Let v be represented as an infinite sum aibi. The approximations to v, i.e. the sum of the first n terms, all lie in M, and they approach v monotonically. Thus all of T lies in the completion of M, and the completion of M = T.
Note that T is also the closure of M in S, hence T is a closed subspace of S.
The second norm is sqrt(∫ f2/v). If two functions are ε apart under the first norm, they are at most ε apart under the second. Mapping M onto itself, from the first norm to the second, is a bounded linear operator, and is continuous. Going backwards, from the second norm to the first, is not continuous. A function can have ∫ f2 = 1, with a tall narrow spike. The spike can be as tall as you like. Thus the uniform norm is arbitrarily large. The operator is not bounded, and not continuous. The first norm defines more open sets than the second.
The second norm admits a dot product, namely the integral of fg/v. Sure enough, f.f = |f|2.
Let S be the completion of M with respect to the second norm, hence S is a hilbert space. This was described in detail when D was the unit interval [0,1], and it easily generalizes to well behaved domains in Rn.
Assume b1 b2 b3 etc is an orthonormal system within M. Since M is a ring containing the constant functions, the finite span of this system, call it W, lies in M. Assume W includes the constant functions, and the functions of W separate the points of D. For every pair of points x and y in D, some function in W maps x to one value and y to another. This satisfies the conditions of stone weierstrass, and the closure of W, under the uniform norm, is all of M.
A convergent sequence in the first metric is automatically convergent in the second. Therefore the closure of W, with respect to the second metric, includes all of M. Now the closure of W is closed, and contains M, and the closure of M is S, hence the closure of W is S. The complete metric space, hyperspanned by our orthonormal system, is all of S. Therefore the orthonormal system is maximal, and acts as a basis. Anything in M, or in the completion of M, has a unique representation as a square summable array of coefficients, relative to our basis, and these coefficients can be extracted using the dot product.
Let the domain D be the closed interval [-1,1], and let M be the continuous functions from D into R. Let b be the countable system of legendre polynomials on [-1,1]. These are orthogonal, and together they span all the polynomials of x. Let W be the finite span of the legendre polynomials, i.e. the polynomials in x. Since W includes the constant functions, and separates points, we can apply the above. Every function in S has a unique representation relative to the legendre polynomials.
Let f = abs(x), which is continuous. Write it as a series in legendre polynomials, and convert to a power series in x. Now abs(x) has a power series, and is real analytic, hence it is differentiable at 0.
Well there are two problems with this proof. First, converting a legendre series to a power series may not be possible. As the terms combine, do the multiples of x settle down to a limit? How about x2, and x3, etc?
Even if a power series emerges, it may not converge anywhere outside of 0. The continuous functions are the elements of S. Each new legendre polynomial yields a continuous polynomial that is closer, on average, to abs(x), but it's only an average. Far out in the series, tall thin deviations could still appear. The root mean square deviation from abs(x) is still tiny, but in places, the approximating polynomial is way off the mark. Pointwise convergence is not guaranteed. This will become clearer in the next example.
Stone Weierstrass has already been applied in this situation. Thus every function in S has a fourier series that "converges" to that function. But convergence may not be uniform, and it may not apply for certain values of x.
Take the square wave, for example. It equals 1 from 0 to π, and -1 from π to 2π. Multiply by sines and cosines and find the following fourier series.
f(x) = 4/π × ∑{n odd} sin(nx)/n
After much analysis, this series, with the terms in this order, converges uniformly to the square wave. The function is faithfully reproduced for every x, and the approach is uniform across the entire domain.
Earlier we said the order of the terms didn't matter. This is true, and it is false. Rearrange the terms, and the approximations still approach f, on average, but spikes can occur. To illustrate, let x = π/2 and substitute in the above series. The result is an alternating sum of the odd reciprocals: 1 - 1/3 + 1/5 - 1/7 … This converges to the correct value on the square wave, but convergence is not absolute. We can rearrange the terms and make this sum to anything. So, if the terms are permuted, the series still approaches the square wave for most values of x, but in some cases, such as x = π/2, the series could reach 129, instead of 1. The approximations come closer and closer to the square wave, on average, but they all have a spike at π/2, that rises to 129, more or less. The spike gets thinner with each approximation, but it's always there.
The combination of stone weierstrass and hilbert orthogonalization is just the beginning - a proof of existence. Often more calculus is required, to show the resulting series, with its terms in a prescribed order, is well behaved across the entire domain.