Let XX be a set. The set B(X)B(X) of bounded functions f:X→R,f:X\rightarrow\mathbb{R}, those with sup⁡x∈X∣f(x)∣<∞,\sup_{x\in X}\lvert f(x)\rvert<\infty, is a vector space under pointwise addition and scalar multiplication, and the supremum norm of f∈B(X)f\in B(X) is its largest absolute value.

∥f∥∞:=sup⁡x∈X∣f(x)∣\lVert f\rVert_\infty:=\sup_{x\in X}\lvert f(x)\rvert

The supremum norm satisfies the norm axioms, so B(X)B(X) is a normed vector space with the induced metric d∞(f,g)=∥f−g∥∞,d_\infty(f,g)=\lVert f-g\rVert_\infty, and a sequence in B(X)B(X) converges in this metric if and only if it converges uniformly on X.X. Convergence in the supremum norm is therefore also called uniform convergence, and the metric topology it induces is the topology of uniform convergence. Pointwise convergence is not induced by any metric on B(X)B(X) when XX is uncountable.

Let XX be a topological space. The set C(X)C(X) of continuous functions f:X→Rf:X\rightarrow\mathbb{R} is a vector space, and if XX is compact then every continuous function on XX is bounded, so C(X)⊆B(X)C(X)\subseteq B(X) is a normed vector space under the supremum norm. For a closed bounded interval this space is written C[a,b].C[a,b]. When XX is not compact, the bounded continuous functions Cb(X):=C(X)∩B(X)C_b(X):=C(X)\cap B(X) are used instead.

The space B(X)B(X) is complete, since a Cauchy sequence in the supremum norm is a Cauchy sequence at every point and so converges pointwise to a function, which is bounded and is the uniform limit of the sequence. The uniform limit of continuous functions is continuous, so Cb(X)C_b(X) is a closed subset of B(X)B(X) and is therefore complete. In particular C(X)C(X) is a Banach space for every compact space X,X, and C[a,b]C[a,b] is a Banach space. This is the setting in which the contraction mapping theorem produces solutions of equations whose unknown is a function. The supremum norm on C[a,b]C[a,b] is not induced by an inner product, and C[a,b]C[a,b] with the norm ∥f∥2:=(∫abf(x)2 dx)12,\lVert f\rVert_2:=\left(\int_a^b f(x)^2\,dx\right)^{\frac{1}{2}}, which is induced by the inner product ⟨f,g⟩:=∫abf(x) g(x) dx,\langle f,g\rangle:=\int_a^b f(x)\,g(x)\,dx, is not complete.

The Weierstrass approximation theorem states that the polynomials are dense in C[a,b]:C[a,b]: for every continuous f:[a,b]→Rf:\left[a,b\right]\rightarrow\mathbb{R} and every ε>0\varepsilon>0 there is a polynomial pp with ∥f−p∥∞≤ε.\lVert f-p\rVert_\infty\leq\varepsilon. On [0,1]\left[0,1\right] the Bernstein polynomials of ff converge uniformly to f,f, which proves the theorem constructively.

Bnf(x):=∑k=0nf(kn)n!k!(n−k)!xk(1−x)n−kB_n f(x):=\sum_{k=0}^{n}f\left(\frac{k}{n}\right)\frac{n!}{k!\left(n-k\right)!}x^k\left(1-x\right)^{n-k}

The approximating polynomials are not Taylor polynomials, and ff need not be differentiable. Since the polynomials with rational coefficients are countable and dense in the polynomials, C[a,b]C[a,b] has a countable dense subset.

Let XX be a compact Hausdorff space. A subset A⊆C(X)\mathcal{A}\subseteq C(X) is a subalgebra if it is a vector subspace that is closed under pointwise multiplication, and it separates points if for any two distinct points x,y∈Xx,y\in X there exists f∈Af\in\mathcal{A} with f(x)≠f(y).f(x)\neq f(y). The Stone–Weierstrass theorem states that a subalgebra of C(X)C(X) that contains the constant functions and separates points is dense in C(X).C(X). The polynomials on [a,b]\left[a,b\right] form such a subalgebra, since x↦xx\mapsto x separates points, which recovers the Weierstrass approximation theorem; the polynomials in nn variables are dense in C(K)C(K) for any compact K⊆Rn;K\subseteq\mathbb{R}^n; and the trigonometric polynomials x↦a0+∑k=1n(akcos⁡kx+bksin⁡kx)x\mapsto a_0+\sum_{k=1}^{n}\left(a_k\cos kx+b_k\sin kx\right) are dense in the continuous functions on [−π,π]\left[-\pi,\pi\right] with f(−π)=f(π),f\left(-\pi\right)=f\left(\pi\right), since they separate the points of the unit circle. The theorem holds for complex-valued functions provided that the subalgebra is also closed under complex conjugation.