# Is the space of polynomials $\mathcal{P}(\mathbb{R}^n)$ dense in $\mathscr{C}(\mathbb{R}^n)$?

By the Stone-Weierstrass theorem, it is easy to see that the polynomials on a compact Hausdorff space and dense in the space of continuous functions on that same compact Hausdorff space.

The space $\mathbb{R}^n$ is not compact though. Is it still true that $\mathcal{P}(\mathbb{R}^n)$ is a dense subset of $\mathscr{C}(\mathbb{R}^n)$?

• What is your topology on $\mathscr{C}(\mathbb{R}^n)$? – Eric Wofsey Aug 6 '17 at 0:02
• @EricWofsey If we equip $\mathscr{C}(\mathbb{R}^n)$ with the topology induced from the supremum norm, will we still have a Banach space structure? – user468052 Aug 6 '17 at 0:04
• The "supremum norm" is not a norm at all because it is often infinite. See math.stackexchange.com/questions/2139117/…. – Eric Wofsey Aug 6 '17 at 0:05
• It seems like the polynomials are necessarily unbounded, but not all elements of $\mathcal C(\mathbb R^n)$ are unbounded, so there isn't even an $L^{\infty}$ (supremum) distance between non-constant polynomials and bounded functions – Thomas Andrews Aug 6 '17 at 0:06

Assuming you mean to give $\mathscr{C}(\mathbb{R}^n)$ the topology of uniform convergence, then $\mathcal{P}(\mathbb{R}^n)$ is very far from being dense. For instance, if $f\in\mathscr{C}(\mathbb{R}^n)$ is any bounded continuous function, then it is infinitely far away from any nonconstant polynomial in the supremum "norm", since any nonconstant polynomial is unbounded. Since any limit of constant functions is constant, this means a bounded function $f$ cannot be uniformly approximated by polynomials unless $f$ is constant.
It is not even true that any continuous function on $\mathbb{R}$ can be uniformly approximated by a sequence of polynomials: consider $\frac{1}{x^2+1}$, for instance. However, if your question is meant to be
Given a continuous function $f:[0,1]^n\to\mathbb{R}$, can we find a sequence of polynomials in $n$ variables providing a uniform approximation of $f$ on $[0,1]^n$?
The answer is affirmative. Let us consider just the case $n=2$ for simplicity. If we consider some large $N\in\mathbb{N}$ and the "generalized Bernstein polynomial" $$P_{j,k}(x,y)=\binom{N}{k}\binom{N}{j}x^j(1-x)^{N-j}y^k(1-y)^{N-k}$$ we have that $P_{j,k}(x,y)$ is non-negative over $[0,1]^2$, has a unit integral and is concentrated at $\left(\frac{j}{N},\frac{k}{N}\right)$. Then it is not difficult to prove that the sequence of polynomials $$Q_N(x,y) = \sum_{j,k=0}^{N} P_{j,k}(x,y)\cdot f\left(\frac{j}{N},\frac{k}{N}\right)$$ gives a uniform approximation of $f$ over $[0,1]^2$. For short: it is not difficult to extend Bernstein's proof of the Weierstrass approximation Theorem to the multi-dimensional case.
Adding to what others have said, it's worth noting the result holds if we equip $\mathscr{C}(\mathbb R^n)$ with the topology of local uniform convergence. That is, $f_k \rightarrow f$ provided for all $K \subset \mathbb R^n$ compact, we have $f_k \rightarrow f$ uniformly on $K.$
Indeed given $f \in \mathscr{C}(\mathbb R^n),$ for each $k \in \mathbb N$ by Stone-Weierstrass we can find $f_k \in \mathcal{P}(\mathbb R^n)$ such that for all $x \in [-k,k]^n,$ $|f_n(x)-f(x)| \leq 1/k.$ Then for all $K \subset \mathbb R^n$ comapct, we can find $k_0 \in \mathbb N$ such that $K \subset [-k,k]^n$ for all $k \geq k_0.$ Hence $f_k \rightarrow f$ uniformly on $K$ as $k \rightarrow \infty.$