The well-known Weierstrass approximation theorem says that polynomials are dense in *C*â€‰[0, 1]. That is, given any continuous function *f* on the unit interval, and any Îµ > 0, you can find a polynomial *P* such that *f* and *P* are never more than Îµ apart.

This means that linear combinations of the polynomials

1, *x*, *x*Â², *x*Â³, â€¦

are dense in *C*â€‰[0, 1].

Do you need all these powers of *x*? Could you approximate any continuous function arbitrarily well if you left out one of these powers, say *x*^{7}? Yes, you could.

You cannot omit the constant polynomial 1, but you can leave out any other power of *x*. In fact, you can leave out a lot of powers of *x*, as long as the sequence of exponents doesnâ€™t thin out too quickly.

## MÃ¼ntz approximation theorem

Herman MÃ¼ntz proved in 1914 that a necessary and sufficient pair of conditions on the exponents of *x* is that the first exponent is 0 and that the sum of the reciprocals of the exponents diverges.

In other words, the sequence of powers of *x*

*x*^{Î»0}, *x*^{Î»1}, *x*^{Î»2}, â€¦

with

Î»_{0} < Î»_{1} < Î»_{2}

is dense in *C* [0, 1] if and only if Î»_{0} = 0 and

1/Î»_{1} + 1/Î»_{2} + 1/Î»_{3} + â€¦ = âˆž

## Prime power example

Euler proved in 1737 that the sum of the reciprocals of the primes diverges, so the sequence

1, *x*^{2}, *x*^{3}, *x*^{5}, *x*^{7}, *x*^{11}, â€¦

is dense in *C* [0, 1]. We can find a polynomial as close as we like to any particular continuous function if we combine enough prime powers.

Letâ€™s see how well we can approximate |*x* âˆ’ Â½| using prime exponents up to 11.

The polynomial above is

0.4605 âˆ’ 5.233 *x*^{2} + 7.211* x*^{3} + 0.9295 *x*^{5} âˆ’ 4.4646 *x*^{7} + 1.614 *x*^{11}.

This polynomial is not the best possible uniform approximation: itâ€™s the least squares approximation. That is, it minimizes the 2-norm and not the âˆž-norm. Thatâ€™s because itâ€™s convenient to do a least squares fit in Python using `scipy.optimize.curve_fit`

.

Incidentally, the MÃ¼ntz approximation theorem holds for the 2-norm as well.