In mathematical analysis, the Weierstrass approximation theorem states that every continuous function defined on a closed interval  can be uniformly approximated as closely as desired by a polynomial function. Because polynomials are among the simplest functions, and because computers can directly evaluate polynomials, this theorem has both practical and theoretical relevance, especially in polynomial interpolation. The original version of this result was established by Karl Weierstrass in 1885 using the Weierstrass transform.

Marshall H. Stone considerably generalized the theorem and simplified the proof.  His result is known as the Stone–Weierstrass theorem. The Stone–Weierstrass theorem generalizes the Weierstrass approximation theorem in two directions: instead of the real interval , an arbitrary compact Hausdorff space  is considered, and instead of the algebra of polynomial functions, a variety of other families of continuous functions on  are shown to suffice, as is detailed below.  The Stone–Weierstrass theorem is a vital result in the study of the algebra of continuous functions on a compact Hausdorff space.

Further, there is a generalization of the Stone–Weierstrass theorem to noncompact Tychonoff spaces, namely, any continuous function on a Tychonoff space is approximated uniformly on compact sets by algebras of the type appearing in the Stone–Weierstrass theorem and described below.

A different generalization of Weierstrass' original theorem is Mergelyan's theorem, which generalizes it to functions defined on certain subsets of the complex plane.

Weierstrass approximation theorem 
The statement of the approximation theorem as originally discovered by Weierstrass is as follows:

A constructive proof of this theorem using Bernstein polynomials is outlined on that page.

Applications 
As a consequence of the Weierstrass approximation theorem, one can show that the space  is separable: the polynomial functions are dense, and each polynomial function can be uniformly approximated by one with rational coefficients; there are only countably many polynomials with rational coefficients. Since  is metrizable and separable it follows that  has cardinality at most .  (Remark: This cardinality result also follows from the fact that a continuous function on the reals is uniquely determined by its restriction to the rationals.)

Stone–Weierstrass theorem, real version 
The set  of continuous real-valued functions on , together with the supremum norm , is a Banach algebra, (that is, an associative algebra and a Banach space such that  for all ). The set of all polynomial functions forms a subalgebra of  (that is, a vector subspace of  that is closed under multiplication of functions), and the content of the Weierstrass approximation theorem is that this subalgebra is dense in .

Stone starts with an arbitrary compact Hausdorff space  and considers the algebra  of real-valued continuous functions on , with the topology of uniform convergence. He wants to find subalgebras of  which are dense. It turns out that the crucial property that a subalgebra must satisfy is that it separates points: a set  of functions defined on  is said to separate points if, for every two different points  and  in  there exists a function  in  with . Now we may state:

This implies Weierstrass' original statement since the polynomials on  form a subalgebra of  which contains the constants and separates points.

Locally compact version 
A version of the Stone–Weierstrass theorem is also true when  is only locally compact. Let  be the space of real-valued continuous functions on  that vanish at infinity; that is, a continuous function  is in  if, for every , there exists a compact set  such that  on . Again,  is a Banach algebra with the supremum norm. A subalgebra  of  is said to vanish nowhere if not all of the elements of  simultaneously vanish at a point; that is, for every  in , there is some  in  such that . The theorem generalizes as follows:

This version clearly implies the previous version in the case when  is compact, since in that case . There are also more general versions of the Stone–Weierstrass that weaken the assumption of local compactness.

Applications 
The Stone–Weierstrass theorem can be used to prove the following two statements, which go beyond Weierstrass's result.

 If  is a continuous real-valued function defined on the set  and , then there exists a polynomial function  in two variables such that  for all  in  and  in .
 If  and  are two compact Hausdorff spaces and  is a continuous function, then for every  there exist  and continuous functions  on  and continuous functions  on  such that . 

The theorem has many other applications to analysis, including:

 Fourier series: The set of linear combinations of functions  is dense in , where we identify the endpoints of the interval  to obtain a circle.  An important consequence of this is that the  are an orthonormal basis of the space  of square-integrable functions on .

Stone–Weierstrass theorem, complex version 
Slightly more general is the following theorem, where we consider the algebra   of complex-valued continuous functions on the compact space , again with the topology of uniform convergence. This is a C*-algebra with the *-operation given by pointwise complex conjugation.

The complex unital *-algebra generated by  consists of all those functions that can be obtained from the elements of  by throwing in the constant function  and adding them, multiplying them, conjugating them, or multiplying them with complex scalars, and repeating finitely many times.

This theorem implies the real version, because if a net of complex-valued functions uniformly approximates a given function, , then the real parts of those functions uniformly approximate the real part of that function, , and because for real subsets,  taking the real parts of the generated complex unital (selfadjoint) algebra agrees with the generated real unital algebra generated.

As in the real case, an analog of this theorem is true for locally compact Hausdorff spaces.

Stone–Weierstrass theorem, quaternion version 
Following , consider the algebra  of quaternion-valued continuous functions on the compact space , again with the topology of uniform convergence. 

If a quaternion  is written in the form 
its scalar part  is the real number .
Likewise 
the scalar part of  is  which is the real number .
the scalar part of  is  which is the real number .
the scalar part of  is  which is the real number .

Then we may state:

Stone–Weierstrass theorem, C*-algebra version 
The space of complex-valued continuous functions on a compact Hausdorff space  i.e.  is the canonical example of a unital commutative C*-algebra . The space X may be viewed as the space of pure states on , with the weak-* topology. Following the above cue, a non-commutative extension of the Stone–Weierstrass theorem, which remains unsolved, is as follows:

In 1960, Jim Glimm proved a weaker version of the above conjecture.

Lattice versions 
Let  be a compact Hausdorff space. Stone's original proof of the theorem used the idea of lattices in .  A subset  of  is called a lattice if for any two elements , the functions also belong to . The lattice version of the Stone–Weierstrass theorem states:

The above versions of Stone–Weierstrass can be proven from this version once one realizes that the lattice property can also be formulated using the absolute value  which in turn can be approximated by polynomials in . A variant of the theorem applies to linear subspaces of  closed under max:

More precise information is available:

Suppose  is a compact Hausdorff space with at least two points and  is a lattice in . The function  belongs to the closure of  if and only if for each pair of distinct points x and y in  and for each  there exists some  for which  and .

Bishop's theorem 
Another generalization of the Stone–Weierstrass theorem is due to Errett Bishop.  Bishop's theorem is as follows:

 gives a short proof of Bishop's theorem using the Krein–Milman theorem in an essential way, as well as the Hahn–Banach theorem: the process of .  See also .

Nachbin's theorem 
Nachbin's theorem gives an analog for Stone–Weierstrass theorem for algebras of complex valued smooth functions on a smooth manifold. Nachbin's theorem is as follows:

Editorial history
In 1885 it was also published in an English version of the paper whose title was On the possibility of giving an analytic representation to an arbitrary function of real variable. According to the mathematician Yamilet Quintana, Weierstrass "suspected that any analytic functions could be represented by power series".

See also 
Müntz–Szász theorem
 Bernstein polynomial
 Runge's phenomenon shows that finding a polynomial  such that  for some finely spaced  is a bad way to attempt to find a polynomial approximating  uniformly. A better approach, explained e.g. in , p. 160, eq. (51) ff., is to construct polynomials  uniformly approximating  by taking the convolution of  with a family of suitably chosen polynomial kernels.
 Mergelyan's theorem, concerning polynomial approximations of complex functions.

Notes

References 
 .
 .
 Jan Brinkhuis & Vladimir Tikhomirov (2005) Optimization: Insights and Applications, Princeton University Press  .
 
 .
 
 .
 .

Historical works 
The historical publication of Weierstrass (in German language) is freely available from the digital online archive of the Berlin Brandenburgische Akademie der Wissenschaften:

 K. Weierstrass (1885). Über die analytische Darstellbarkeit sogenannter willkürlicher Functionen einer reellen Veränderlichen. Sitzungsberichte der Königlich Preußischen Akademie der Wissenschaften zu Berlin, 1885 (II).  Erste Mitteilung (part 1) pp. 633–639, Zweite Mitteilung (part 2) pp. 789–805.

External links 
 

Theory of continuous functions
Theorems in analysis
Theorems in approximation theory
1885 in mathematics
1937 in mathematics